提交 46468c62 编写于 作者: A Andrea Bolognani

tests: Rename LIBVIRT_FAKE_SYSFS_DIR to LIBVIRT_FAKE_ROOT_DIR

The old name is no longer accurate, since now we're using its value as
the root of the fake filesystem.

No functional changes.
上级 bc80c45d
......@@ -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();
}
......
......@@ -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;
}
......
......@@ -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;
}
......
......@@ -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)
......
......@@ -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;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册