2006-04-11 21:52:54 +00:00
|
|
|
#
|
2006-05-31 21:30:50 +00:00
|
|
|
PROVE=/usr/bin/prove
|
2006-04-11 21:52:54 +00:00
|
|
|
TESTS=simple.pl
|
2010-06-04 18:47:44 -07:00
|
|
|
PARSER_DIR=..
|
|
|
|
PARSER_BIN=apparmor_parser
|
|
|
|
PARSER=$(PARSER_DIR)/$(PARSER_BIN)
|
2018-09-16 21:58:28 +02:00
|
|
|
# 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
|
2011-08-09 01:10:19 -07:00
|
|
|
PROVE_ARG=-f
|
2006-04-11 21:52:54 +00:00
|
|
|
|
2006-05-31 21:30:50 +00:00
|
|
|
ifeq ($(VERBOSE),1)
|
2011-08-09 01:10:19 -07:00
|
|
|
PROVE_ARG+=-v
|
2013-11-27 21:25:06 -08:00
|
|
|
PYTEST_ARG = -v
|
2015-03-23 11:45:45 -07:00
|
|
|
else
|
2015-03-31 02:46:45 -07:00
|
|
|
VERBOSE=
|
2006-05-31 21:30:50 +00:00
|
|
|
endif
|
|
|
|
|
2006-04-11 21:52:54 +00:00
|
|
|
all: tests
|
|
|
|
|
2013-12-03 15:37:57 -08:00
|
|
|
.PHONY: tests error_output gen_dbus gen_xtrans parser_sanity caching minimize equality valgrind
|
2013-11-27 21:25:06 -08:00
|
|
|
tests: error_output caching minimize equality parser_sanity
|
2010-12-20 11:53:52 -08:00
|
|
|
|
2013-07-31 09:20:56 -07:00
|
|
|
GEN_TRANS_DIRS=simple_tests/generated_x/ simple_tests/generated_perms_leading/ simple_tests/generated_perms_safe/ simple_tests/generated_dbus
|
2011-08-09 01:10:19 -07:00
|
|
|
|
|
|
|
gen_xtrans: $(GEN_TRANS_DIRS)
|
2010-12-20 11:53:52 -08:00
|
|
|
./gen-xtrans.pl
|
2010-06-04 18:47:44 -07:00
|
|
|
|
2011-08-09 01:10:19 -07:00
|
|
|
$(GEN_TRANS_DIRS):
|
|
|
|
mkdir $@
|
|
|
|
|
2013-07-31 09:20:56 -07:00
|
|
|
gen_dbus: $(GEN_TRANS_DIRS)
|
|
|
|
./gen-dbus.pl
|
|
|
|
|
2010-06-04 18:47:44 -07:00
|
|
|
error_output: $(PARSER)
|
2018-09-16 21:58:28 +02:00
|
|
|
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 | \
|
2010-06-04 18:47:44 -07:00
|
|
|
grep -q "AppArmor parser error for errors/single.sd in errors/single.sd at line 3: Could not open 'failure'"
|
2018-09-16 21:58:28 +02:00
|
|
|
LANG=C $(PARSER) $(PARSER_ARGS) -S -I errors 2>&1 >/dev/null errors/double.sd | \
|
2010-12-20 13:06:54 -08:00
|
|
|
grep -q "AppArmor parser error for errors/double.sd in errors/includes/busted at line 66: Could not open 'does-not-exist'"
|
2018-09-16 21:58:28 +02:00
|
|
|
LANG=C $(PARSER) $(PARSER_ARGS) -S -I errors 2>&1 >/dev/null errors/modefail.sd | \
|
2010-06-25 12:43:48 -07:00
|
|
|
grep -q "AppArmor parser error for errors/modefail.sd in errors/modefail.sd at line 6: syntax error"
|
2018-09-16 21:58:28 +02:00
|
|
|
LANG=C $(PARSER) $(PARSER_ARGS) -S -I errors 2>&1 >/dev/null errors/multi_include.sd | \
|
2010-06-25 12:43:48 -07:00
|
|
|
grep -q "AppArmor parser error for errors/multi_include.sd in errors/multi_include.sd at line 12: Could not open 'failure'"
|
2010-06-04 18:47:44 -07:00
|
|
|
@echo "Error Output: PASS"
|
|
|
|
|
2013-10-31 12:04:12 -07:00
|
|
|
parser_sanity: $(PARSER) gen_xtrans gen_dbus
|
2012-11-05 17:22:37 -08:00
|
|
|
$(Q)LANG=C APPARMOR_PARSER="$(PARSER)" ${PROVE} ${PROVE_ARG} ${TESTS}
|
2006-04-11 21:52:54 +00:00
|
|
|
|
2010-09-14 12:45:34 -07:00
|
|
|
caching: $(PARSER)
|
2013-11-27 21:25:06 -08:00
|
|
|
LANG=C ./caching.py -p "$(PARSER)" $(PYTEST_ARG)
|
2010-09-14 12:45:34 -07:00
|
|
|
|
2012-03-09 04:20:19 -08:00
|
|
|
minimize: $(PARSER)
|
2018-09-16 21:58:28 +02:00
|
|
|
LANG=C APPARMOR_PARSER="$(PARSER) $(PARSER_ARGS)" ./minimize.sh
|
2012-03-09 04:20:19 -08:00
|
|
|
|
2013-07-31 09:22:11 -07:00
|
|
|
equality: $(PARSER)
|
2018-09-16 21:58:28 +02:00
|
|
|
LANG=C APPARMOR_PARSER="$(PARSER) $(PARSER_ARGS)" ./equality.sh
|
2013-07-31 09:22:11 -07:00
|
|
|
|
2013-10-31 12:04:12 -07:00
|
|
|
valgrind: $(PARSER) gen_xtrans gen_dbus
|
2018-09-16 21:58:28 +02:00
|
|
|
LANG=C ./valgrind_simple.py -p "$(PARSER) $(PARSER_ARGS)" -v simple_tests
|
2013-10-15 17:06:26 -07:00
|
|
|
|
2010-06-04 18:47:44 -07:00
|
|
|
$(PARSER):
|
2017-11-01 23:04:26 +00:00
|
|
|
$(MAKE) -C $(PARSER_DIR) $(PARSER_BIN)
|
2010-12-20 11:53:52 -08:00
|
|
|
|
|
|
|
clean:
|
2011-08-09 01:10:19 -07:00
|
|
|
find $(GEN_TRANS_DIRS) -type f | xargs rm -f
|
2013-12-06 05:31:11 -08:00
|
|
|
rm -f gmon.out
|