]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
tests: Stop looking for abs_top_srcdir in the environment
authorAndrea Bolognani <abologna@redhat.com>
Tue, 12 Mar 2019 13:21:18 +0000 (14:21 +0100)
committerAndrea Bolognani <abologna@redhat.com>
Thu, 14 Mar 2019 09:05:25 +0000 (10:05 +0100)
This code snippet has clearly been cargo-culted, and all its
instances can be safely dropped seeing as 1) a much better
way to handle the scenario in C programs would be to pass the
value via the preprocessor, and 2) the value is actually not
used anywhere after being defined.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
tests/libxlxml2domconfigtest.c
tests/networkxml2firewalltest.c
tests/nwfilterxml2firewalltest.c
tests/qemumemlocktest.c
tests/qemuxml2argvtest.c
tests/virscsitest.c

index 677103bfebf4f1b68e631501df3f8dbf7b18416c..048e6c0431dfee1a6171e641185695a522e25e60 100644 (file)
@@ -41,7 +41,6 @@
 
 # define VIR_FROM_THIS VIR_FROM_LIBXL
 
-static const char *abs_top_srcdir;
 static virCapsPtr caps;
 
 static int
@@ -172,10 +171,6 @@ mymain(void)
 {
     int ret = 0;
 
-    abs_top_srcdir = getenv("abs_top_srcdir");
-    if (!abs_top_srcdir)
-        abs_top_srcdir = abs_srcdir "/..";
-
     /* Set the timezone because we are mocking the time() function.
      * If we don't do that, then localtime() may return unpredictable
      * results. In order to detect things that just work by a blind
index 91bb6e6b8a2b67b93cdca5a95fee3b10c9b151e7..575b68379af0a53f32d33b1dcb0773f7ca0bc916 100644 (file)
@@ -36,8 +36,6 @@
 
 # define VIR_FROM_THIS VIR_FROM_NONE
 
-static const char *abs_top_srcdir;
-
 # ifdef __linux__
 #  define RULESTYPE "linux"
 # else
@@ -136,10 +134,6 @@ mymain(void)
 {
     int ret = 0;
 
-    abs_top_srcdir = getenv("abs_top_srcdir");
-    if (!abs_top_srcdir)
-        abs_top_srcdir = abs_srcdir "/..";
-
 # define DO_TEST(name) \
     do { \
         static struct testInfo info = { \
index b4cfe5769e601572ec44243f65ec855ccf3c2fa5..bea267f0fc76f557b7117fad5db7cdc7f909a966 100644 (file)
@@ -35,8 +35,6 @@
 
 # define VIR_FROM_THIS VIR_FROM_NONE
 
-static const char *abs_top_srcdir;
-
 # ifdef __linux__
 #  define RULESTYPE "linux"
 # else
@@ -459,10 +457,6 @@ mymain(void)
 {
     int ret = 0;
 
-    abs_top_srcdir = getenv("abs_top_srcdir");
-    if (!abs_top_srcdir)
-        abs_top_srcdir = abs_srcdir "/..";
-
 # define DO_TEST(name) \
     do { \
         static struct testInfo info = { \
index 786f647cf0e40c5bab6ee966357cecb708850a59..42a4643338cec0e3b5508beb06a8ec70b6f3ad9c 100644 (file)
@@ -19,7 +19,6 @@
 
 # define VIR_FROM_THIS VIR_FROM_QEMU
 
-static const char *abs_top_srcdir;
 static virQEMUDriver driver;
 
 struct testInfo {
@@ -74,10 +73,6 @@ mymain(void)
 
     setenv("LIBVIRT_FAKE_ROOT_DIR", fakerootdir, 1);
 
-    abs_top_srcdir = getenv("abs_top_srcdir");
-    if (!abs_top_srcdir)
-        abs_top_srcdir = abs_srcdir "/..";
-
     if (qemuTestDriverInit(&driver) < 0) {
         VIR_FREE(fakerootdir);
         return EXIT_FAILURE;
index 03e8d795954b8eb9eb07e4cdf817f50e722d260e..67c5c74ec5e99aeb96299f1338eb0a742018e4b4 100644 (file)
@@ -33,7 +33,6 @@
 
 # define VIR_FROM_THIS VIR_FROM_QEMU
 
-static const char *abs_top_srcdir;
 static virQEMUDriver driver;
 
 static unsigned char *
@@ -653,10 +652,6 @@ mymain(void)
 
     setenv("LIBVIRT_FAKE_ROOT_DIR", fakerootdir, 1);
 
-    abs_top_srcdir = getenv("abs_top_srcdir");
-    if (!abs_top_srcdir)
-        abs_top_srcdir = abs_srcdir "/..";
-
     /* Set the timezone because we are mocking the time() function.
      * If we don't do that, then localtime() may return unpredictable
      * results. In order to detect things that just work by a blind
index 665f70e28bf51ceac8ba1da2315beffaa8d37c5c..be3ef6234e9ab4ad694d0815e56a6bf0949c8d26 100644 (file)
@@ -30,7 +30,6 @@
 
 VIR_LOG_INIT("tests.scsitest");
 
-static const char *abs_top_srcdir;
 static char *virscsi_prefix;
 
 static int
@@ -195,10 +194,6 @@ mymain(void)
     char *tmpdir = NULL;
     char template[] = "/tmp/libvirt_XXXXXX";
 
-    abs_top_srcdir = getenv("abs_top_srcdir");
-    if (!abs_top_srcdir)
-        abs_top_srcdir = abs_srcdir "/..";
-
     if (virAsprintf(&virscsi_prefix, "%s" VIR_SCSI_DATA, abs_srcdir) < 0) {
         ret = -1;
         goto cleanup;