[apparmor] [PATCH] tests: Conditionalize when to build/run stacking tests

Tyler Hicks tyhicks at canonical.com
Fri Mar 18 23:05:47 UTC 2016


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 at canonical.com>
---
 tests/regression/apparmor/Makefile | 21 ++++++++++++++-------
 1 file changed, 14 insertions(+), 7 deletions(-)

diff --git a/tests/regression/apparmor/Makefile b/tests/regression/apparmor/Makefile
index 21c7fb3..c61f141 100644
--- a/tests/regression/apparmor/Makefile
+++ b/tests/regression/apparmor/Makefile
@@ -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+=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+=aa_policy_cache stackonexec stackprofile
 endif
 
 EXEC=$(SRC:%.c=%)
@@ -219,8 +228,6 @@ TESTS=aa_exec \
       swap \
       sd_flags \
       setattr \
-      stackonexec \
-      stackprofile \
       symlink \
       syscall \
       tcp \
@@ -237,7 +244,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=
-- 
2.7.3




More information about the AppArmor mailing list