diff --git a/parser/tst/Makefile b/parser/tst/Makefile index 4a06c6af7..be0ddf668 100644 --- a/parser/tst/Makefile +++ b/parser/tst/Makefile @@ -4,6 +4,8 @@ TESTS=simple.pl PARSER_DIR=.. PARSER_BIN=apparmor_parser PARSER=$(PARSER_DIR)/$(PARSER_BIN) +# parser.conf to use in tests. Note that some test scripts have the parser options hardcoded, so passing PARSER_ARGS=... is not enough to override it. +PARSER_ARGS=--config-file=./parser.conf PROVE_ARG=-f ifeq ($(VERBOSE),1) @@ -30,14 +32,14 @@ gen_dbus: $(GEN_TRANS_DIRS) ./gen-dbus.pl error_output: $(PARSER) - LANG=C $(PARSER) -S -I errors >/dev/null errors/okay.sd - LANG=C $(PARSER) -S -I errors 2>&1 >/dev/null errors/single.sd | \ + LANG=C $(PARSER) $(PARSER_ARGS) -S -I errors >/dev/null errors/okay.sd + LANG=C $(PARSER) $(PARSER_ARGS) -S -I errors 2>&1 >/dev/null errors/single.sd | \ grep -q "AppArmor parser error for errors/single.sd in errors/single.sd at line 3: Could not open 'failure'" - LANG=C $(PARSER) -S -I errors 2>&1 >/dev/null errors/double.sd | \ + LANG=C $(PARSER) $(PARSER_ARGS) -S -I errors 2>&1 >/dev/null errors/double.sd | \ grep -q "AppArmor parser error for errors/double.sd in errors/includes/busted at line 66: Could not open 'does-not-exist'" - LANG=C $(PARSER) -S -I errors 2>&1 >/dev/null errors/modefail.sd | \ + LANG=C $(PARSER) $(PARSER_ARGS) -S -I errors 2>&1 >/dev/null errors/modefail.sd | \ grep -q "AppArmor parser error for errors/modefail.sd in errors/modefail.sd at line 6: syntax error" - LANG=C $(PARSER) -S -I errors 2>&1 >/dev/null errors/multi_include.sd | \ + LANG=C $(PARSER) $(PARSER_ARGS) -S -I errors 2>&1 >/dev/null errors/multi_include.sd | \ grep -q "AppArmor parser error for errors/multi_include.sd in errors/multi_include.sd at line 12: Could not open 'failure'" @echo "Error Output: PASS" @@ -48,13 +50,13 @@ caching: $(PARSER) LANG=C ./caching.py -p "$(PARSER)" $(PYTEST_ARG) minimize: $(PARSER) - LANG=C APPARMOR_PARSER="$(PARSER)" ./minimize.sh + LANG=C APPARMOR_PARSER="$(PARSER) $(PARSER_ARGS)" ./minimize.sh equality: $(PARSER) - LANG=C APPARMOR_PARSER="$(PARSER)" ./equality.sh + LANG=C APPARMOR_PARSER="$(PARSER) $(PARSER_ARGS)" ./equality.sh valgrind: $(PARSER) gen_xtrans gen_dbus - LANG=C ./valgrind_simple.py -p "$(PARSER)" -v simple_tests + LANG=C ./valgrind_simple.py -p "$(PARSER) $(PARSER_ARGS)" -v simple_tests $(PARSER): $(MAKE) -C $(PARSER_DIR) $(PARSER_BIN) diff --git a/parser/tst/simple.pl b/parser/tst/simple.pl index 6349fc646..e11d95230 100755 --- a/parser/tst/simple.pl +++ b/parser/tst/simple.pl @@ -81,7 +81,7 @@ sub test_profile { # child open(STDOUT, ">/dev/null") or die "Failed to redirect STDOUT"; open(STDERR, ">/dev/null") or die "Failed to redirect STDERR"; - exec("$config{'parser'}", "-M", "features_files/features.all", "-S", "-I", "$config{'includedir'}") or die "Bail out! couldn't open parser"; + exec("$config{'parser'}", "--config-file=./parser.conf", "-M", "features_files/features.all", "-S", "-I", "$config{'includedir'}") or die "Bail out! couldn't open parser"; # noreturn }