From ed25dcc2c11c674d4e3c08620121101b616c78dc Mon Sep 17 00:00:00 2001 From: Matthias Bolte Date: Fri, 14 Jan 2011 22:37:55 +0100 Subject: [PATCH] tests: Remove obsolete secaatest Before the security driver was refactored in d6623003 seclabeltest and secaatest were basically the same. seclabeltest was meant for SELinux and secaatest for AppArmor. Both tests exited early when the specific security driver backend wasn't enabled. With the new security manager trying to initialize a disabled security driver backend is an error that can't be distinguished from other errors anymore. Therefore, the updated seclabeltest just asks for the first available backend as this will always work even with SELinux and AppArmor backend being disabled due to the new Nop backend. Remove the obsolete secaatest and compile and run the seclabeltest unconditional. This fixes make check on systems that support AppArmor. --- tests/Makefile.am | 31 ++----------------------------- tests/secaatest.c | 45 --------------------------------------------- 2 files changed, 2 insertions(+), 74 deletions(-) delete mode 100644 tests/secaatest.c diff --git a/tests/Makefile.am b/tests/Makefile.am index 345cf4611a..5922b64ffc 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -77,7 +77,7 @@ EXTRA_DIST = \ check_PROGRAMS = virshtest conftest sockettest \ nodeinfotest qparamtest virbuftest \ - commandtest commandhelper + commandtest commandhelper seclabeltest if WITH_XEN check_PROGRAMS += xml2sexprtest sexpr2xmltest \ @@ -98,14 +98,6 @@ if WITH_VMX check_PROGRAMS += vmx2xmltest xml2vmxtest endif -if WITH_SECDRIVER_SELINUX -check_PROGRAMS += seclabeltest -endif - -if WITH_SECDRIVER_APPARMOR -check_PROGRAMS += secaatest -endif - if WITH_CIL check_PROGRAMS += object-locking endif @@ -166,6 +158,7 @@ TESTS = virshtest \ virbuftest \ sockettest \ commandtest \ + seclabeltest \ $(test_scripts) if WITH_XEN @@ -191,14 +184,6 @@ if WITH_VMX TESTS += vmx2xmltest xml2vmxtest endif -if WITH_SECDRIVER_SELINUX -TESTS += seclabeltest -endif - -if WITH_SECDRIVER_APPARMOR -TESTS += secaatest -endif - if WITH_LIBVIRTD check_PROGRAMS += eventtest TESTS += eventtest @@ -376,21 +361,9 @@ commandhelper_SOURCES = \ commandhelper_CFLAGS = -Dabs_builddir="\"`pwd`\"" commandhelper_LDADD = $(LDADDS) -if WITH_SECDRIVER_SELINUX seclabeltest_SOURCES = \ seclabeltest.c seclabeltest_LDADD = ../src/libvirt_driver_security.la $(LDADDS) -else -EXTRA_DIST += seclabeltest.c -endif - -if WITH_SECDRIVER_APPARMOR -secaatest_SOURCES = \ - secaatest.c -secaatest_LDADD = ../src/libvirt_driver_security.la $(LDADDS) -else -EXTRA_DIST += secaatest.c -endif qparamtest_SOURCES = \ qparamtest.c testutils.h testutils.c diff --git a/tests/secaatest.c b/tests/secaatest.c deleted file mode 100644 index d9d6b4acd3..0000000000 --- a/tests/secaatest.c +++ /dev/null @@ -1,45 +0,0 @@ -#include - -#include -#include -#include -#include -#include -#include "security/security_driver.h" - -int -main (int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED) -{ - int ret; - - const char *doi, *model; - virSecurityDriverPtr security_drv; - - ret = virSecurityDriverStartup (&security_drv, "apparmor", false); - if (ret == -1) - { - fprintf (stderr, "Failed to start security driver"); - exit (-1); - } - /* No security driver wanted to be enabled: just return */ - if (ret == -2) - return 0; - - model = virSecurityDriverGetModel (security_drv); - if (!model) - { - fprintf (stderr, "Failed to copy secModel model: %s", - strerror (errno)); - exit (-1); - } - - doi = virSecurityDriverGetDOI (security_drv); - if (!doi) - { - fprintf (stderr, "Failed to copy secModel DOI: %s", - strerror (errno)); - exit (-1); - } - - return 0; -} -- GitLab