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

[libvirt] [PATCH v5 5/6] tests: Allow comma separate list of libs to preload



Adjust the model to allow callers to provide a comma separated list
of libraries to be loaded. For those tests that may need more than
one mock library loaded.

Signed-off-by: John Ferlan <jferlan redhat com>
---
 tests/testutils.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/tests/testutils.c b/tests/testutils.c
index 9180e86..69cd77c 100644
--- a/tests/testutils.c
+++ b/tests/testutils.c
@@ -854,8 +854,16 @@ int virtTestMain(int argc,
     if (getenv("VIR_TEST_FILE_ACCESS"))
         VIRT_TEST_PRELOAD(TEST_MOCK);
 
-    if (lib)
-        VIRT_TEST_PRELOAD(lib);
+    if (lib) {
+        char **liblist;
+        size_t count = 0;
+        size_t i;
+
+        liblist = virStringSplitCount(lib, ",", 0, &count);
+        for (i = 0; i < count; i++)
+            VIRT_TEST_PRELOAD(liblist[i]);
+        virStringFreeListCount(liblist, count);
+    }
 
     progname = last_component(argv[0]);
     if (STRPREFIX(progname, "lt-"))
-- 
2.5.5


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