[libvirt PATCH 301/351] meson: tests: add selinux specific tests

Pavel Hrdina phrdina at redhat.com
Thu Jul 16 09:58:57 UTC 2020


Signed-off-by: Pavel Hrdina <phrdina at redhat.com>
---
 tests/Makefile.am | 39 ---------------------------------------
 tests/meson.build | 15 +++++++++++++++
 2 files changed, 15 insertions(+), 39 deletions(-)

diff --git a/tests/Makefile.am b/tests/Makefile.am
index ecc2a76a80f..7b2cba16eff 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -16,16 +16,6 @@
 ## License along with this library.  If not, see
 ## <http://www.gnu.org/licenses/>.
 
-if WITH_SECDRIVER_SELINUX
-if WITH_ATTR
-test_programs += securityselinuxtest \
-                 viridentitytest
-if WITH_QEMU
-test_programs += securityselinuxlabeltest
-endif WITH_QEMU
-endif WITH_ATTR
-endif WITH_SECDRIVER_SELINUX
-
 if WITH_QEMU
 test_helpers += qemucapsprobe
 endif WITH_QEMU
@@ -215,15 +205,6 @@ virstoragetest_LDADD = $(LDADDS) \
 	../src/libvirt_driver_storage_impl.la \
 	$(NULL)
 
-viridentitytest_SOURCES = \
-	viridentitytest.c testutils.h testutils.c
-viridentitytest_LDADD = $(LDADDS)
-if WITH_SELINUX
-viridentitytest_LDADD += $(SELINUX_LIBS)
-viridentitytest_DEPENDENCIES = libsecurityselinuxhelper.la \
-	../src/libvirt.la
-endif WITH_SELINUX
-
 if WITH_NSS
 ## Intentionaly not linking with anything else.
 ## See the test source for more detailed explanation.
@@ -257,26 +238,6 @@ test_programs += \
 	virnetdevopenvswitchtest
 endif ! WITH_YAJL
 
-if WITH_SECDRIVER_SELINUX
-if WITH_ATTR
-
-securityselinuxtest_SOURCES = \
-	securityselinuxtest.c testutils.h testutils.c
-securityselinuxtest_LDADD = $(LDADDS) $(SELINUX_LIBS)
-securityselinuxtest_DEPENDENCIES = libsecurityselinuxhelper.la \
-	../src/libvirt.la
-
-if WITH_QEMU
-securityselinuxlabeltest_SOURCES = \
-	securityselinuxlabeltest.c testutils.h testutils.c \
-        testutilsqemu.h testutilsqemu.c
-securityselinuxlabeltest_LDADD = $(qemu_LDADDS) $(SELINUX_LIBS)
-securityselinuxlabeltest_DEPENDENCIES = libsecurityselinuxhelper.la \
-	../src/libvirt.la
-endif WITH_QEMU
-endif WITH_ATTR
-endif WITH_SECDRIVER_SELINUX
-
 virjsontest_SOURCES = \
 	virjsontest.c testutils.h testutils.c
 virjsontest_LDADD = $(LDADDS)
diff --git a/tests/meson.build b/tests/meson.build
index 4e01585da11..67b9cd11d1c 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -472,6 +472,21 @@ if conf.has('WITH_REMOTE')
   ]
 endif
 
+if conf.has('WITH_SECDRIVER_SELINUX')
+  if conf.has('WITH_ATTR')
+    tests += [
+      { 'name': 'securityselinuxtest' },
+      { 'name': 'viridentitytest' },
+    ]
+
+    if conf.has('WITH_QEMU')
+      tests += [
+        { 'name': 'securityselinuxlabeltest', 'link_with': [ test_utils_qemu_lib ] },
+      ]
+    endif
+  endif
+endif
+
 foreach data : tests
   test_sources = '@0 at .c'.format(data['name'])
   test_bin = executable(
-- 
2.26.2




More information about the libvir-list mailing list