From b61a91954a44536f9db167d84182419e177b680b Mon Sep 17 00:00:00 2001 From: "Brian C. Lane" Date: Tue, 13 Nov 2018 17:06:40 -0800 Subject: [PATCH] Fix reporting of coverage results to coverall.io When I re-arranged the test-in-docker I didn't realize how .travis.yml was extracting the results. This should fix it. When running with test-in-docker we mount the source read-only on /linux-ro/ inside the container and copy it over to /lorax/ for running the tests. The local directory ./.test-results/ is mounted on /test-results/ in the container and the .coverage file is copied into there so that it is available on the host. --- .gitignore | 1 + .travis.yml | 4 +--- Dockerfile.test | 5 +++-- Makefile | 7 ++++--- 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/.gitignore b/.gitignore index 03e5268c..0274f244 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,4 @@ __pycache__/ .coverage pylint-log .pytest_cache/ +.test-results/ diff --git a/.travis.yml b/.travis.yml index 992f32c7..0bb94fd4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,9 +9,7 @@ script: after_success: - | - sudo docker create --name results-cont welder/lorax /bin/echo - sudo docker cp results-cont:/lorax/.coverage .coverage.docker - sudo docker rm results-cont + cp .test-results/.coverage ./.coverage.docker pip install coverage coveralls coverage combine diff --git a/Dockerfile.test b/Dockerfile.test index b1014e35..fa07dd07 100644 --- a/Dockerfile.test +++ b/Dockerfile.test @@ -32,5 +32,6 @@ RUN dnf -y install \ which && \ touch /.in-container RUN useradd weldr -VOLUME /lorax -WORKDIR /lorax +VOLUME /lorax-ro +VOLUME /test-results +WORKDIR /lorax-ro diff --git a/Makefile b/Makefile index 9002fe0b..bcdae1dd 100644 --- a/Makefile +++ b/Makefile @@ -77,12 +77,13 @@ local: @echo "The archive is in $(PKGNAME)-$(VERSION).tar.gz" test-in-copy: - rsync -aP --exclude=.git /lorax/ /lorax-test/ - make -C /lorax-test/ check test + rsync -aP --exclude=.git /lorax-ro/ /lorax/ + make -C /lorax/ check test + cp /lorax/.coverage /test-results/ test-in-docker: sudo $(DOCKER) build -t welder/lorax-tests:$(IMAGE_RELEASE) -f Dockerfile.test . - sudo $(DOCKER) run --rm -it -v `pwd`:/lorax:ro --security-opt label=disable welder/lorax-tests:$(IMAGE_RELEASE) make test-in-copy + sudo $(DOCKER) run --rm -it -v `pwd`/.test-results/:/test-results -v `pwd`:/lorax-ro:ro --security-opt label=disable welder/lorax-tests:$(IMAGE_RELEASE) make test-in-copy docs-in-docker: sudo $(DOCKER) run -it --rm -v `pwd`/docs/html/:/lorax/docs/html/ --security-opt label=disable welder/lorax-tests:$(IMAGE_RELEASE) make docs