mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-07 17:28:15 +00:00
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.
This commit is contained in:
parent
2095dc39af
commit
ed25dcc2c1
@ -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
|
||||
|
@ -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;
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user