[apparmor] [patch] make coverage should fail if one of the tests fails

Steve Beattie steve at nxnw.org
Thu Jan 15 23:48:05 UTC 2015


On Mon, Dec 22, 2014 at 08:39:54PM +0100, Christian Boltz wrote:
> Hmm, adding that message would make the code quite interesting ;-) 
> because of the way $(foreach ...) is expanded. I tried some variants, 
> but didn't find a non-ugly solution ;-)

Yeah, it's not trivial to implement this. Would be nice, though, for
when I forget.

> [ utils-test-coverage-fail-on-failed-tests.diff ]
> 
> === modified file 'utils/test/Makefile'
> --- utils/test/Makefile 2014-11-04 21:01:14 +0000
> +++ utils/test/Makefile 2014-12-22 19:23:12 +0000
> @@ -31,6 +31,13 @@
>  HTML_COVR_ARGS=-d $(COVERAGE_OUT)
>  endif
>  
> +# use   make COVERAGE_IGNORE_FAILURES=true coverage   to build coverage data even if some tests fail
> +ifeq ($(COVERAGE_IGNORE_FAILURES), true)
> +  COVERAGE_IGNORE_FAILURES_CMD=true
> +else
> +  COVERAGE_IGNORE_FAILURES_CMD=set -e
> +endif
> +
>  .PHONY: clean check coverage coverage-report coverage-html
>  ifndef VERBOSE
>  .SILENT: clean check .coverage coverage coverage-report coverage-html
> @@ -43,7 +50,7 @@
>         export PYTHONPATH=.. ; $(foreach test, $(wildcard test-*.py), $(call pyalldo, $(test)))
>  
>  .coverage: $(wildcard ../aa-* ../apparmor/*.py test-*.py)
> -       export PYTHONPATH=.. ; $(foreach test, $(wildcard test-*.py), $(PYTHON) -m coverage run --branch -p $(test); )
> +       export PYTHONPATH=.. ; $(COVERAGE_IGNORE_FAILURES_CMD) ; $(foreach test, $(wildcard test-*.py), $(PYTHON) -m coverage run --branch -p $(test); )
>         $(PYTHON) -m coverage combine
>  
>  coverage: .coverage

Signed-off-by: Steve Beattie <steve at nxnw.org>, thanks.

-- 
Steve Beattie
<sbeattie at ubuntu.com>
http://NxNW.org/~steve/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <https://lists.ubuntu.com/archives/apparmor/attachments/20150115/0609d553/attachment.pgp>


More information about the AppArmor mailing list