From 725a4e544eec1aaf1b04e96bef3633183c6af461 Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Wed, 29 Mar 2017 08:13:44 +0200 Subject: [PATCH] fix coverage and some other test related issues --- .gitlab-ci.yml | 54 +++++++++++++++++++++++----------- Makefile | 2 +- lib/Makefile.inc | 3 +- tests/Makefile.inc | 8 ++--- tests/integration/Makefile.inc | 4 +++ tests/unit/Makefile.gcov.inc | 2 +- tests/unit/Makefile.inc | 6 ++-- thirdparty/libwebsockets | 2 +- 8 files changed, 52 insertions(+), 29 deletions(-) create mode 100644 tests/integration/Makefile.inc diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 5c07dc742..326e14d09 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,26 +1,23 @@ variables: - # This registry is a linked docker container running on the same host - # and configured in gitlab-ci-runner config.toml as a linked service - DOCKER_REGISTRY: acs-public:5000 PREFIX: /usr/ + BUILDDIR: build/release stages: - prepare - build - test - - packaging - deploy # Stage: prepare ############################################################################## # Build docker image which is used to build & test VILLASnode -docker-images: +docker-dev: stage: prepare before_script: - - git submodule sync --recursive - - git submodule update --recursive --init - docker info + - git submodule sync --recursive + - git submodule update --init --recursive script: - docker pull fedora:latest - make docker-dev @@ -42,7 +39,7 @@ build: artifacts: name: "${CI_PROJECT_NAME}-${CI_BUILD_REF}" paths: - - build/release/ + - $BUILDDIR/ image: $DOCKER_REGISTRY/villas-dev tags: - docker @@ -52,13 +49,29 @@ docs: artifacts: name: "${CI_PROJECT_NAME}-doc-${CI_BUILD_REF}" paths: - - build/release/doc/ + - $BUILDDIR/doc/ script: - make doc image: $DOCKER_REGISTRY/villas-dev tags: - docker +packages: + stage: build + before_script: + - curl -s https://$DEPLOY_USER:$DEPLOY_PASS@$DEPLOY_HOST/packages/villas.repo > /etc/yum.repos.d/villas.repo + - dnf -y --refresh install libwebsockets-devel libxil-devel + script: + - make dist + - make rpm-villas + artifacts: + name: "${CI_PROJECT_NAME}-packages-${CI_BUILD_REF}" + paths: + - $BUILDDIR/packaging/ + image: $DOCKER_REGISTRY/villas-dev + tags: + - docker + # Stage: test ############################################################################## @@ -93,6 +106,10 @@ integration: - build script: - make run-integration-tests + artifacts: + name: "${CI_PROJECT_NAME}-integration-tests-${CI_BUILD_REF}" + paths: + - BUILDDIR/tests/integration/ image: $DOCKER_REGISTRY/villas-dev tags: - docker @@ -110,25 +127,28 @@ website: tags: - villas-deploy -rpm: - stage: packaging +docker: + stage: deploy script: - - make rpm + - make docker + - docker tag -f villas $DOCKER_REGISTRY/villas:latest + - docker push $DOCKER_REGISTRY/villas:latest + dependencies: + - packages tags: - shell - - fedora + - linux deliver: stage: deploy script: - - rsync -r build/release/doc/html/ $DEPLOY_HOST:$DEPLOY_PATH/doc/$CI_BUILD_REF_NAME/ - rsync -r build/release-coverage/coverage/ $DEPLOY_HOST:$DEPLOY_PATH/coverage/$CI_BUILD_REF_NAME/ - - rsync -r build/release/packaging/rpm/RPMS $DEPLOY_HOST:$DEPLOY_PATH/../packages + - rsync -r $BUILDDIR/doc/html/ $DEPLOY_HOST:$DEPLOY_PATH/doc/$CI_BUILD_REF_NAME/ + - rsync -r $BUILDDIR/packaging/rpm/RPMS $DEPLOY_HOST:$DEPLOY_PATH/../packages - ssh $DEPLOY_HOST createrepo $DEPLOY_PATH/../packages dependencies: - docs - coverage - - rpm + - packages tags: - villas-deploy - diff --git a/Makefile b/Makefile index 18e2f5ae7..6785cde3f 100644 --- a/Makefile +++ b/Makefile @@ -74,7 +74,7 @@ VERSION_NUM = $(shell VERSION=$(VERSION); echo $${VERSION:1}) ifdef CI GIT_REV = ${CI_BUILD_REF:0:7} - VARIANT := ci-$(VARIANT) + VARIANT := ci~$(VARIANT) else GIT_REV = $(shell REV=$$(git rev-parse HEAD); echo $${REV:0:7}) endif diff --git a/lib/Makefile.inc b/lib/Makefile.inc index 6b2408e4e..985e90b87 100644 --- a/lib/Makefile.inc +++ b/lib/Makefile.inc @@ -1,7 +1,7 @@ LIB_NAME = libvillas LIB_ABI_VERSION = 1 -LIB = $(BUILDDIR)/$(LIB_NAME).so +LIB = $(BUILDDIR)/$(LIB_NAME).so.$(LIB_ABI_VERSION) # Object files for libvillas LIB_SRCS = $(addprefix lib/nodes/, file.c cbuilder.c) \ @@ -86,6 +86,7 @@ lib: $(LIB) # Link $(LIB): $(LIB_OBJS) $(CC) $(LIB_LDFLAGS) -o $@ $^ $(LIB_LDLIBS) + ln -srf $@ $(BUILDDIR)/$(LIB_NAME).so # Compile $(BUILDDIR)/lib/%.o: lib/%.c $(BUILDDIR)/defines | $$(dir $$@) diff --git a/tests/Makefile.inc b/tests/Makefile.inc index dad98fc1d..9ab2a61a7 100644 --- a/tests/Makefile.inc +++ b/tests/Makefile.inc @@ -1,10 +1,8 @@ -include tests/unit/Makefile.inc +-include tests/integration/Makefile.inc -tests: unit-tests +tests: unit-tests integration-tests run-tests: run-unit-tests run-integration-tests - -run-integration-tests: src tools - @$(SRCDIR)/tests/integration-tests.sh -.PHONY: tests run-tests run-integration-tests +.PHONY: tests run-tests diff --git a/tests/integration/Makefile.inc b/tests/integration/Makefile.inc new file mode 100644 index 000000000..88ee001e8 --- /dev/null +++ b/tests/integration/Makefile.inc @@ -0,0 +1,4 @@ +integration-tests: src tools + +run-integration-tests: integration-tests + @$(SRCDIR)/tests/integration-tests.sh \ No newline at end of file diff --git a/tests/unit/Makefile.gcov.inc b/tests/unit/Makefile.gcov.inc index 4d1a3e7f1..1c53c19dd 100644 --- a/tests/unit/Makefile.gcov.inc +++ b/tests/unit/Makefile.gcov.inc @@ -4,7 +4,7 @@ COVERAGE_OBJS = $(LIB_OBJS) $(SRC_OBJS) GCDAS = $(COVERAGE_OBJS:.o=.gcda) GCNOS = $(COVERAGE_OBJS:.o=.gcno) -GCOVR_OPTS = --exclude ^include --root . --sort-percentage --print-summary +GCOVR_OPTS = --exclude ^include --root $(SRCDIR) --sort-percentage --print-summary coverage: $(BUILDDIR)/coverage/index.html $(BUILDDIR)/coverage.xml $(BUILDDIR)/coverage.txt diff --git a/tests/unit/Makefile.inc b/tests/unit/Makefile.inc index 98b54dd77..64e87c3a2 100644 --- a/tests/unit/Makefile.inc +++ b/tests/unit/Makefile.inc @@ -11,15 +11,15 @@ run-unit-tests: tests $(BUILDDIR)/unit-tests # Compile -$(BUILDDIR)/tests/unit/%.o: tests/unit/%.c | $$(dir $$@) +$(BUILDDIR)/tests/unit/%.o: tests/unit/%.c $(BUILDDIR)/defines | $$(dir $$@) $(CC) $(TEST_CFLAGS) -c $< -o $@ # Link -$(BUILDDIR)/unit-tests: $(TEST_OBJS) | $(LIBS) +$(BUILDDIR)/unit-tests: $(TEST_OBJS) $(LIB) $(CC) $(TEST_LDFLAGS) $(TEST_LDLIBS) $^ -o $@ ifdef COVERAGE --include tests/Makefile.gcov.inc +-include tests/unit/Makefile.gcov.inc endif # Tests are not installed diff --git a/thirdparty/libwebsockets b/thirdparty/libwebsockets index a38b7b166..42b2334c5 160000 --- a/thirdparty/libwebsockets +++ b/thirdparty/libwebsockets @@ -1 +1 @@ -Subproject commit a38b7b1664cf5bebff287ec40e4024d85a4475e8 +Subproject commit 42b2334c5c4b1b3da5dd75bd92451bb49983c236