提交 ed25dcc2 编写于 作者: M Matthias Bolte

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.
上级 2095dc39
...@@ -77,7 +77,7 @@ EXTRA_DIST = \ ...@@ -77,7 +77,7 @@ EXTRA_DIST = \
check_PROGRAMS = virshtest conftest sockettest \ check_PROGRAMS = virshtest conftest sockettest \
nodeinfotest qparamtest virbuftest \ nodeinfotest qparamtest virbuftest \
commandtest commandhelper commandtest commandhelper seclabeltest
if WITH_XEN if WITH_XEN
check_PROGRAMS += xml2sexprtest sexpr2xmltest \ check_PROGRAMS += xml2sexprtest sexpr2xmltest \
...@@ -98,14 +98,6 @@ if WITH_VMX ...@@ -98,14 +98,6 @@ if WITH_VMX
check_PROGRAMS += vmx2xmltest xml2vmxtest check_PROGRAMS += vmx2xmltest xml2vmxtest
endif endif
if WITH_SECDRIVER_SELINUX
check_PROGRAMS += seclabeltest
endif
if WITH_SECDRIVER_APPARMOR
check_PROGRAMS += secaatest
endif
if WITH_CIL if WITH_CIL
check_PROGRAMS += object-locking check_PROGRAMS += object-locking
endif endif
...@@ -166,6 +158,7 @@ TESTS = virshtest \ ...@@ -166,6 +158,7 @@ TESTS = virshtest \
virbuftest \ virbuftest \
sockettest \ sockettest \
commandtest \ commandtest \
seclabeltest \
$(test_scripts) $(test_scripts)
if WITH_XEN if WITH_XEN
...@@ -191,14 +184,6 @@ if WITH_VMX ...@@ -191,14 +184,6 @@ if WITH_VMX
TESTS += vmx2xmltest xml2vmxtest TESTS += vmx2xmltest xml2vmxtest
endif endif
if WITH_SECDRIVER_SELINUX
TESTS += seclabeltest
endif
if WITH_SECDRIVER_APPARMOR
TESTS += secaatest
endif
if WITH_LIBVIRTD if WITH_LIBVIRTD
check_PROGRAMS += eventtest check_PROGRAMS += eventtest
TESTS += eventtest TESTS += eventtest
...@@ -376,21 +361,9 @@ commandhelper_SOURCES = \ ...@@ -376,21 +361,9 @@ commandhelper_SOURCES = \
commandhelper_CFLAGS = -Dabs_builddir="\"`pwd`\"" commandhelper_CFLAGS = -Dabs_builddir="\"`pwd`\""
commandhelper_LDADD = $(LDADDS) commandhelper_LDADD = $(LDADDS)
if WITH_SECDRIVER_SELINUX
seclabeltest_SOURCES = \ seclabeltest_SOURCES = \
seclabeltest.c seclabeltest.c
seclabeltest_LDADD = ../src/libvirt_driver_security.la $(LDADDS) 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_SOURCES = \
qparamtest.c testutils.h testutils.c qparamtest.c testutils.h testutils.c
......
#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;
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册