[PATCH v3 7/8] tests: Add support for more complicated hierarchies in vircaps2xmltest

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

 



More directories will need to be mocked, so let's prepare for that.

Signed-off-by: Martin Kletzander <mkletzan@xxxxxxxxxx>
---
 tests/vircaps2xmltest.c | 20 +++++++++++++-------
 1 file changed, 13 insertions(+), 7 deletions(-)

diff --git a/tests/vircaps2xmltest.c b/tests/vircaps2xmltest.c
index c957120aae44..675ed019a63b 100644
--- a/tests/vircaps2xmltest.c
+++ b/tests/vircaps2xmltest.c
@@ -35,6 +35,7 @@ struct virCapabilitiesData {
     virArch arch;
     bool offlineMigrate;
     bool liveMigrate;
+    bool resctrl; /* Whether both resctrl and system sysfs are used */
 };

 static int
@@ -48,8 +49,13 @@ test_virCapabilities(const void *opaque)
     char *dir = NULL;
     int ret = -1;

-    if (virAsprintf(&dir, "%s/vircaps2xmldata/linux-%s",
-                    abs_srcdir, data->filename) < 0)
+    /*
+     * We want to keep our directory structure clean, so if there's both resctrl
+     * and system used, we need to use slightly different path; a subdir.
+     */
+    if (virAsprintf(&dir, "%s/vircaps2xmldata/linux-%s%s",
+                    abs_srcdir, data->filename,
+                    data->resctrl ? "/system" : "") < 0)
         goto cleanup;

     virFileWrapperAddPrefix("/sys/devices/system", dir);
@@ -89,19 +95,19 @@ mymain(void)
 {
     int ret = 0;

-#define DO_TEST_FULL(filename, arch, offlineMigrate, liveMigrate)       \
+#define DO_TEST_FULL(filename, arch, offlineMigrate, liveMigrate, resctrl) \
     do {                                                                \
         struct virCapabilitiesData data = {filename, arch,              \
                                            offlineMigrate,              \
-                                           liveMigrate};                \
+                                           liveMigrate, resctrl};       \
         if (virTestRun(filename, test_virCapabilities, &data) < 0)      \
             ret = -1;                                                   \
     } while (0)

-#define DO_TEST(filename, arch) DO_TEST_FULL(filename, arch, true, true)
+#define DO_TEST(filename, arch) DO_TEST_FULL(filename, arch, true, true, false)

-    DO_TEST_FULL("basic", VIR_ARCH_X86_64, false, false);
-    DO_TEST_FULL("basic", VIR_ARCH_AARCH64, true, false);
+    DO_TEST_FULL("basic", VIR_ARCH_X86_64, false, false, false);
+    DO_TEST_FULL("basic", VIR_ARCH_AARCH64, true, false, false);

     DO_TEST("caches", VIR_ARCH_X86_64);

-- 
2.12.2

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]
  Powered by Linux