[apparmor] [patch 23/24] Make dbus tests be conditionally run based on pkg-config

john.johansen at canonical.com john.johansen at canonical.com
Fri Mar 7 17:31:44 UTC 2014


The addition of the dbus tests requires dbus dev libraries be installed
to run the test suite. This is not always desirable or even possible.

So make building and running the dbus tests conditional on the
pkg-config info from those libs. If they are not present output a
message about skipping the tests.

Signed-off-by: John Johansen <john.johansen at canonical.com>


---
 tests/regression/apparmor/Makefile |   18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

--- 2.9-test.orig/tests/regression/apparmor/Makefile
+++ 2.9-test/tests/regression/apparmor/Makefile
@@ -56,9 +56,6 @@
     chown.c \
     clone.c \
     coredump.c \
-    dbus_eavesdrop.c \
-    dbus_message.c \
-    dbus_service.c \
     deleted.c \
     environ.c \
     env_check.c \
@@ -115,6 +112,13 @@
 SRC+=syscall_ioperm.c syscall_iopl.c
 endif
 
+#only do dbus if proper libs are installl
+ifneq (,$(pkg-config --cflags --libs dbus-1))
+SRC+=dbus_eavesdrop.c dbus_message.c dbus_service.c
+else
+$(info No dbus pkg-config skipping dbus_eavesdrop dbus_message dbus_services tests ...)
+endif
+
 EXEC=$(SRC:%.c=%)
 
 TESTS=access \
@@ -128,9 +132,6 @@
       chdir \
       clone \
       coredump \
-      dbus_eavesdrop \
-      dbus_message \
-      dbus_service \
       deleted \
       environ \
       exec \
@@ -169,6 +170,11 @@
       xattrs\
       longpath
 
+#only do dbus if proper libs are installl
+ifneq (,$(pkg-config --cflags --libs dbus-1))
+TESTS+=dbus_eavesdrop dbus_message dbus_service
+endif
+
 # Tests that can crash the kernel should be placed here
 RISKY_TESTS=
 




More information about the AppArmor mailing list