tests: Conditionalize when to build/run stacking tests

The stacking test binary links against libapparmor for
aa_stack_profile() and aa_stack_onexec(), which will be present in 2.11.
This means that regression test builds using the system libapparmor
should not build the stacking test binary unless the libapparmor 2.11 or
newer is present.

Signed-off-by: Tyler Hicks <tyhicks@canonical.com>
Acked-by: Steve Beattie <steve@nxnw.org>
This commit is contained in:
Tyler Hicks 2016-03-19 03:03:18 -05:00
parent 6050d110e1
commit cdbe3f088b

View file

@ -119,7 +119,6 @@ SRC=access.c \
readdir.c \
rw.c \
socketpair.c \
stacking.c \
symlink.c \
syscall_mknod.c \
swap.c \
@ -160,16 +159,26 @@ endif
ifdef USE_SYSTEM
ifneq (,$(shell pkg-config --atleast-version 2.10 libapparmor && echo TRUE))
SRC+=aa_policy_cache.c
AA_POLICY_CACHE_TEST=aa_policy_cache
CONDITIONAL_TESTS+=aa_policy_cache
else
$(warning ${nl}\
************************************************************************${nl}\
Skipping aa_policy_cache tests: requires libapparmor 2.10 or newer ...${nl}\
************************************************************************${nl})
endif
ifneq (,$(shell pkg-config --atleast-version 2.11 libapparmor && echo TRUE))
SRC+=stacking.c
CONDITIONAL_TESTS+=exec_stack stackonexec stackprofile
else
$(warning ${nl}\
************************************************************************${nl}\
Skipping stacking tests: requires libapparmor 2.11 or newer ...${nl}\
************************************************************************${nl})
endif
else
SRC+=aa_policy_cache.c
AA_POLICY_CACHE_TEST=aa_policy_cache
SRC+=aa_policy_cache.c stacking.c
CONDITIONAL_TESTS+=exec_stack aa_policy_cache stackonexec stackprofile
endif
EXEC=$(SRC:%.c=%)
@ -190,7 +199,6 @@ TESTS=aa_exec \
environ \
exec \
exec_qual \
exec_stack \
fchdir \
fd_inheritance \
fork \
@ -219,8 +227,6 @@ TESTS=aa_exec \
swap \
sd_flags \
setattr \
stackonexec \
stackprofile \
symlink \
syscall \
tcp \
@ -237,7 +243,7 @@ ifneq (,$(shell pkg-config --exists dbus-1 && echo TRUE))
TESTS+=dbus_eavesdrop dbus_message dbus_service dbus_unrequested_reply
endif
TESTS+=$(AA_POLICY_CACHE_TEST)
TESTS+=$(CONDITIONAL_TESTS)
# Tests that can crash the kernel should be placed here
RISKY_TESTS=