Various tests try to open a connection to 'test:///default' and
must be skipped when the test driver is disabled.

Signed-off-by: Daniel P. Berrangé <berra...@redhat.com>
---
 tests/fchosttest.c |  9 ++++++---
 tests/meson.build  | 37 ++++++++++++++++++++++++-------------
 2 files changed, 30 insertions(+), 16 deletions(-)

diff --git a/tests/fchosttest.c b/tests/fchosttest.c
index d050458a58..14f9975157 100644
--- a/tests/fchosttest.c
+++ b/tests/fchosttest.c
@@ -33,6 +33,7 @@ static char *fchost_prefix;
 #define TEST_FC_HOST_NUM 5
 #define TEST_FC_HOST_NUM_NO_FAB 6
 
+#ifdef WITH_TEST
 /* virNodeDeviceCreateXML using "<parent>" to find the vport capable HBA */
 static const char test7_xml[] =
 "<device>"
@@ -85,7 +86,7 @@ static const char test11_xml[] =
 "    <path>/dev/disk/by-path</path>"
 "  </target>"
 "</pool>";
-
+#endif /* WITH_TEST */
 
 /* Test virIsVHBACapable */
 static int
@@ -222,7 +223,7 @@ test6(const void *data G_GNUC_UNUSED)
 }
 
 
-
+#ifdef WITH_TEST
 /* Test manageVHBAByNodeDevice
  *  - Test both virNodeDeviceCreateXML and virNodeDeviceDestroy
  *  - Create a node device vHBA allowing usage of various different
@@ -313,7 +314,7 @@ manageVHBAByStoragePool(const void *data)
         virConnectClose(conn);
     return ret;
 }
-
+#endif
 
 static int
 mymain(void)
@@ -334,6 +335,7 @@ mymain(void)
         ret = -1;
     if (virTestRun("virVHBAGetConfig-empty-fabric_wwn", test6, NULL) < 0)
         ret = -1;
+#ifdef WITH_TEST
     if (virTestRun("manageVHBAByNodeDevice-by-parent", manageVHBAByNodeDevice,
                    test7_xml) < 0)
         ret = -1;
@@ -349,6 +351,7 @@ mymain(void)
     if (virTestRun("manageVHBAByStoragePool-by-parent", 
manageVHBAByStoragePool,
                    test11_xml) < 0)
         ret = -1;
+#endif
 
     VIR_FREE(fchost_prefix);
     return ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
diff --git a/tests/meson.build b/tests/meson.build
index 7270840428..73b87be2a0 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -74,7 +74,6 @@ endif
 
 mock_libs = [
   { 'name': 'domaincapsmock' },
-  { 'name': 'shunload', 'sources': [ 'shunloadhelper.c' ] },
   { 'name': 'vircgroupmock' },
   { 'name': 'virdnsmasqmock' },
   { 'name': 'virfilecachemock' },
@@ -106,6 +105,11 @@ if host_machine.system() != 'windows'
   ]
 endif
 
+if conf.has('WITH_TEST')
+  mock_libs += [
+    { 'name': 'shunload', 'sources': [ 'shunloadhelper.c' ] },
+  ]
+endif
 
 # build libraries used by tests
 
@@ -258,15 +262,11 @@ tests += [
   { 'name': 'domainconftest' },
   { 'name': 'genericxml2xmltest' },
   { 'name': 'interfacexml2xmltest' },
-  { 'name': 'metadatatest' },
-  { 'name': 'networkmetadatatest' },
   { 'name': 'networkxml2xmlupdatetest' },
   { 'name': 'nodedevxml2xmltest' },
   { 'name': 'nwfilterxml2xmltest' },
-  { 'name': 'objecteventtest' },
   { 'name': 'seclabeltest' },
   { 'name': 'secretxml2xmltest' },
-  { 'name': 'shunloadtest', 'deps': [ thread_dep ] },
   { 'name': 'sockettest' },
   { 'name': 'storagevolxml2xmltest' },
   { 'name': 'sysinfotest' },
@@ -298,7 +298,6 @@ tests += [
   { 'name': 'virportallocatortest' },
   { 'name': 'virrotatingfiletest' },
   { 'name': 'virschematest' },
-  { 'name': 'virshtest', 'depends': [ virsh_prog ] },
   { 'name': 'virstringtest' },
   { 'name': 'virsystemdtest' },
   { 'name': 'virtimetest' },
@@ -333,6 +332,17 @@ if host_machine.system() == 'linux'
   endif
 endif
 
+if conf.has('WITH_TEST')
+  tests += [
+    { 'name': 'fdstreamtest' },
+    { 'name': 'metadatatest' },
+    { 'name': 'networkmetadatatest' },
+    { 'name': 'objecteventtest' },
+    { 'name': 'shunloadtest', 'deps': [ thread_dep ] },
+    { 'name': 'virshtest', 'depends': [ virsh_prog ] },
+  ]
+endif
+
 if conf.has('WITH_BHYVE')
   tests += [
     { 'name': 'bhyveargv2xmltest', 'link_with': [ bhyve_driver_impl ] },
@@ -364,7 +374,6 @@ endif
 if conf.has('WITH_LIBVIRTD')
   tests += [
     { 'name': 'eventtest', 'deps': [ thread_dep ] },
-    { 'name': 'fdstreamtest' },
     { 'name': 'virdriverconnvalidatetest' },
     { 'name': 'virdrivermoduletest' },
   ]
@@ -619,12 +628,14 @@ test(
   suite: 'script',
 )
 
-# vsh based client self-test, which can be run directly from meson
-test('virsh self-test',
-  virsh_prog,
-  args: [ '-q', '-c', 'test:///default', 'self-test' ],
-  suite: 'bin',
-)
+if conf.has('WITH_TEST')
+  # vsh based client self-test, which can be run directly from meson
+  test('virsh self-test',
+    virsh_prog,
+    args: [ '-q', '-c', 'test:///default', 'self-test' ],
+    suite: 'bin',
+  )
+endif
 
 if conf.has('WITH_REMOTE')
   test('virt-admin self-test',
-- 
2.43.0
_______________________________________________
Devel mailing list -- devel@lists.libvirt.org
To unsubscribe send an email to devel-le...@lists.libvirt.org

Reply via email to