[PATCH] tests: Remove obsolete secaatest

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 |   24 ------------------------
 tests/secaatest.c |   45 ---------------------------------------------
 2 files changed, 0 insertions(+), 69 deletions(-)
 delete mode 100644 tests/secaatest.c

diff --git a/tests/Makefile.am b/tests/Makefile.am
index 345cf46..72beb23 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -98,13 +98,7 @@ 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
@@ -191,13 +185,7 @@ 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
@@ -376,21 +364,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 d9d6b4a..0000000
--- a/tests/secaatest.c
+++ /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;
-}
-- 
1.7.0.4

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]