]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/libvirt.git/commitdiff
tests: Rename LIBVIRT_FAKE_SYSFS_DIR to LIBVIRT_FAKE_ROOT_DIR
authorAndrea Bolognani <abologna@redhat.com>
Fri, 4 Dec 2015 12:38:16 +0000 (13:38 +0100)
committerAndrea Bolognani <abologna@redhat.com>
Wed, 9 Dec 2015 14:22:58 +0000 (15:22 +0100)
The old name is no longer accurate, since now we're using its value as
the root of the fake filesystem.

No functional changes.

tests/vircgroupmock.c
tests/vircgrouptest.c
tests/virhostdevtest.c
tests/virpcimock.c
tests/virpcitest.c

index ead18b6935261ce6a2ca65a696f28a314e70bb22..fb33af1d3688ca58f993c73fb35b47f86002f7a1 100644 (file)
@@ -67,9 +67,9 @@ const char *fakedevicedir1 = FAKEDEVDIR1;
  *
  * In any open/acces/mkdir calls we look at path and if
  * it starts with /not/really/sys/fs/cgroup, we rewrite
- * the path to point at a temporary directory referred
- * to by LIBVIRT_FAKE_SYSFS_DIR env variable that is
- * set by the main test suite
+ * the path to point at a subdirectory of the temporary
+ * directory referred to by LIBVIRT_FAKE_ROOT_DIR env
+ * variable that is set by the main test suite
  *
  * In mkdir() calls, we simulate the cgroups behaviour
  * whereby creating the directory auto-creates a bunch
@@ -420,8 +420,8 @@ static void init_sysfs(void)
     if (fakerootdir && fakesysfsdir)
         return;
 
-    if (!(fakerootdir = getenv("LIBVIRT_FAKE_SYSFS_DIR"))) {
-        fprintf(stderr, "Missing LIBVIRT_FAKE_SYSFS_DIR env variable\n");
+    if (!(fakerootdir = getenv("LIBVIRT_FAKE_ROOT_DIR"))) {
+        fprintf(stderr, "Missing LIBVIRT_FAKE_ROOT_DIR env variable\n");
         abort();
     }
 
index 731ecc4094e202c10aefeebb2b09879d0b1da45b..7ea6e13657eed391e162ed9bbaf68ec2ebc974b5 100644 (file)
@@ -847,25 +847,25 @@ static int testCgroupGetBlkioIoDeviceServiced(const void *args ATTRIBUTE_UNUSED)
     return ret;
 }
 
-# define FAKESYSFSDIRTEMPLATE abs_builddir "/fakesysfsdir-XXXXXX"
+# define FAKEROOTDIRTEMPLATE abs_builddir "/fakerootdir-XXXXXX"
 
 static int
 mymain(void)
 {
     int ret = 0;
-    char *fakesysfsdir;
+    char *fakerootdir;
 
-    if (VIR_STRDUP_QUIET(fakesysfsdir, FAKESYSFSDIRTEMPLATE) < 0) {
+    if (VIR_STRDUP_QUIET(fakerootdir, FAKEROOTDIRTEMPLATE) < 0) {
         fprintf(stderr, "Out of memory\n");
         abort();
     }
 
-    if (!mkdtemp(fakesysfsdir)) {
-        fprintf(stderr, "Cannot create fakesysfsdir");
+    if (!mkdtemp(fakerootdir)) {
+        fprintf(stderr, "Cannot create fakerootdir");
         abort();
     }
 
-    setenv("LIBVIRT_FAKE_SYSFS_DIR", fakesysfsdir, 1);
+    setenv("LIBVIRT_FAKE_ROOT_DIR", fakerootdir, 1);
 
 # define DETECT_MOUNTS(file)                                            \
     do {                                                                \
@@ -937,9 +937,9 @@ mymain(void)
     unsetenv("VIR_CGROUP_MOCK_MODE");
 
     if (getenv("LIBVIRT_SKIP_CLEANUP") == NULL)
-        virFileDeleteTree(fakesysfsdir);
+        virFileDeleteTree(fakerootdir);
 
-    VIR_FREE(fakesysfsdir);
+    VIR_FREE(fakerootdir);
 
     return ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
 }
index faebdd4506220d89ede9ef9406f0efc9d5a0c5be..2a7497604e9cb5ca05b91fbdb577417d3d7dd1ba 100644 (file)
@@ -410,25 +410,25 @@ testVirHostdevUpdateActivePCIHostdevs(const void *oaque ATTRIBUTE_UNUSED)
     return ret;
 }
 
-# define FAKESYSFSDIRTEMPLATE abs_builddir "/fakesysfsdir-XXXXXX"
+# define FAKEROOTDIRTEMPLATE abs_builddir "/fakerootdir-XXXXXX"
 
 static int
 mymain(void)
 {
     int ret = 0;
-    char *fakesysfsdir;
+    char *fakerootdir;
 
-    if (VIR_STRDUP_QUIET(fakesysfsdir, FAKESYSFSDIRTEMPLATE) < 0) {
+    if (VIR_STRDUP_QUIET(fakerootdir, FAKEROOTDIRTEMPLATE) < 0) {
         fprintf(stderr, "Out of memory\n");
         abort();
     }
 
-    if (!mkdtemp(fakesysfsdir)) {
-        fprintf(stderr, "Cannot create fakesysfsdir");
+    if (!mkdtemp(fakerootdir)) {
+        fprintf(stderr, "Cannot create fakerootdir");
         abort();
     }
 
-    setenv("LIBVIRT_FAKE_SYSFS_DIR", fakesysfsdir, 1);
+    setenv("LIBVIRT_FAKE_ROOT_DIR", fakerootdir, 1);
 
 # define DO_TEST(fnc)                                   \
     do {                                                \
@@ -458,9 +458,9 @@ mymain(void)
     myCleanup();
 
     if (getenv("LIBVIRT_SKIP_CLEANUP") == NULL)
-        virFileDeleteTree(fakesysfsdir);
+        virFileDeleteTree(fakerootdir);
 
-    VIR_FREE(fakesysfsdir);
+    VIR_FREE(fakerootdir);
 
     return ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
 }
index f1517ce73b9a90abb3c101027048335128a7da8f..97787839fe13b988d800d3d18074483d8de96fe8 100644 (file)
@@ -71,7 +71,7 @@ char *fakesysfsdir;
  * The plan:
  *
  * Mock some file handling functions. Redirect them into a stub tree passed via
- * LIBVIRT_FAKE_SYSFS_DIR env variable. All files and links within stub tree is
+ * LIBVIRT_FAKE_ROOT_DIR env variable. All files and links within stub tree is
  * created by us. There are some actions that we must take if some special
  * files are written to. Here's the list of files we watch:
  *
@@ -804,8 +804,8 @@ init_env(void)
     if (fakerootdir && fakesysfsdir)
         return;
 
-    if (!(fakerootdir = getenv("LIBVIRT_FAKE_SYSFS_DIR")))
-        ABORT("Missing LIBVIRT_FAKE_SYSFS_DIR env variable\n");
+    if (!(fakerootdir = getenv("LIBVIRT_FAKE_ROOT_DIR")))
+        ABORT("Missing LIBVIRT_FAKE_ROOT_DIR env variable\n");
 
     if (virAsprintfQuiet(&fakesysfsdir, "%s%s",
                          fakerootdir, PCI_SYSFS_PREFIX) < 0)
index d4d3253c82fe75ffe2f1e194bb1374e54e4c367c..f1c53694271ea17b07b00e2bcaffed5de9cdf7ff 100644 (file)
@@ -350,25 +350,25 @@ testVirPCIDeviceUnbind(const void *opaque)
     return ret;
 }
 
-# define FAKESYSFSDIRTEMPLATE abs_builddir "/fakesysfsdir-XXXXXX"
+# define FAKEROOTDIRTEMPLATE abs_builddir "/fakerootdir-XXXXXX"
 
 static int
 mymain(void)
 {
     int ret = 0;
-    char *fakesysfsdir;
+    char *fakerootdir;
 
-    if (VIR_STRDUP_QUIET(fakesysfsdir, FAKESYSFSDIRTEMPLATE) < 0) {
+    if (VIR_STRDUP_QUIET(fakerootdir, FAKEROOTDIRTEMPLATE) < 0) {
         VIR_TEST_DEBUG("Out of memory\n");
         abort();
     }
 
-    if (!mkdtemp(fakesysfsdir)) {
-        VIR_TEST_DEBUG("Cannot create fakesysfsdir");
+    if (!mkdtemp(fakerootdir)) {
+        VIR_TEST_DEBUG("Cannot create fakerootdir");
         abort();
     }
 
-    setenv("LIBVIRT_FAKE_SYSFS_DIR", fakesysfsdir, 1);
+    setenv("LIBVIRT_FAKE_ROOT_DIR", fakerootdir, 1);
 
 # define DO_TEST(fnc)                                   \
     do {                                                \
@@ -445,9 +445,9 @@ mymain(void)
     DO_TEST_PCI_DRIVER(0, 0x0a, 3, 0, NULL);
 
     if (getenv("LIBVIRT_SKIP_CLEANUP") == NULL)
-        virFileDeleteTree(fakesysfsdir);
+        virFileDeleteTree(fakerootdir);
 
-    VIR_FREE(fakesysfsdir);
+    VIR_FREE(fakerootdir);
 
     return ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
 }