]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
tests: Remove obsolete secaatest
authorMatthias Bolte <matthias.bolte@googlemail.com>
Fri, 14 Jan 2011 21:37:55 +0000 (22:37 +0100)
committerMatthias Bolte <matthias.bolte@googlemail.com>
Sat, 15 Jan 2011 22:36:31 +0000 (23:36 +0100)
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
tests/secaatest.c [deleted file]

index 345cf4611a6367b040b4a33306fbfb11954b0b22..5922b64ffcd63c6c67e56239d2db74cb33e70455 100644 (file)
@@ -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 (file)
index d9d6b4a..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-#include <config.h>
-
-#include <unistd.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <errno.h>
-#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;
-}