diff --git a/README b/README index 54bc47f8d..5fa95c2b3 100644 --- a/README +++ b/README @@ -79,16 +79,16 @@ $ make check $ make install -Utilities: -$ cd utils -$ make +parser: +$ cd parser +$ make # depends on libapparmor having been built first $ make check $ make install -parser: -$ cd parser -$ make # depends on libapparmor having been built first +Utilities: +$ cd utils +$ make $ make check $ make install diff --git a/utils/test/Makefile b/utils/test/Makefile index db2312efb..cce58d1ba 100644 --- a/utils/test/Makefile +++ b/utils/test/Makefile @@ -36,7 +36,7 @@ else PARSER=../../parser/apparmor_parser endif -.PHONY: __libapparmor +.PHONY: __libapparmor __parser __libapparmor: ifndef USE_SYSTEM @if [ ! -f $(LD_LIBRARY_PATH)libapparmor.so ]; then \ @@ -47,6 +47,16 @@ ifndef USE_SYSTEM fi endif +__parser: +ifndef USE_SYSTEM + @if [ ! -f $(PARSER) ]; then \ + echo "error: $(PARSER) is missing. Pick one of these possible solutions:" 1>&2; \ + echo " 1) Test using the in-tree parser by building it first and then trying again. See the top-level README for help." 1>&2; \ + echo " 2) Test using the system parser by adding USE_SYSTEM=1 to your make command." 1>&2; \ + exit 1; \ + fi +endif + COVERAGE_OMIT=test-*.py,common_test.py ifneq ($(COVERAGE_OUT), ) HTML_COVR_ARGS=-d $(COVERAGE_OUT) @@ -67,10 +77,10 @@ endif clean: rm -rf __pycache__/ .coverage htmlcov -check: __libapparmor +check: __libapparmor __parser export PYTHONPATH=$(PYTHONPATH) LD_LIBRARY_PATH=$(LD_LIBRARY_PATH) LC_ALL=C __AA_CONFDIR=$(CONFDIR) __AA_BASEDIR=$(BASEDIR) __AA_PARSER=$(PARSER) ; $(foreach test, $(wildcard test-*.py), echo ; echo === $(test) === ; $(call pyalldo, $(test))) -.coverage: $(wildcard ../aa-* ../apparmor/*.py test-*.py) __libapparmor +.coverage: $(wildcard ../aa-* ../apparmor/*.py test-*.py) __libapparmor __parser export PYTHONPATH=$(PYTHONPATH) LD_LIBRARY_PATH=$(LD_LIBRARY_PATH) LC_ALL=C __AA_CONFDIR=$(CONFDIR) __AA_BASEDIR=$(BASEDIR) __AA_PARSER=$(PARSER) ; $(COVERAGE_IGNORE_FAILURES_CMD) ; $(foreach test, $(wildcard test-*.py), echo ; echo === $(test) === ; $(PYTHON) -m coverage run --branch -p $(test); ) $(PYTHON) -m coverage combine