提交 cd012587 编写于 作者: A Andrea Bolognani

tests: Stop looking for abs_top_srcdir in the environment

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: NAndrea Bolognani <abologna@redhat.com>
Reviewed-by: NMartin Kletzander <mkletzan@redhat.com>
上级 625c78b5
...@@ -41,7 +41,6 @@ ...@@ -41,7 +41,6 @@
# define VIR_FROM_THIS VIR_FROM_LIBXL # define VIR_FROM_THIS VIR_FROM_LIBXL
static const char *abs_top_srcdir;
static virCapsPtr caps; static virCapsPtr caps;
static int static int
...@@ -172,10 +171,6 @@ mymain(void) ...@@ -172,10 +171,6 @@ mymain(void)
{ {
int ret = 0; 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. /* Set the timezone because we are mocking the time() function.
* If we don't do that, then localtime() may return unpredictable * If we don't do that, then localtime() may return unpredictable
* results. In order to detect things that just work by a blind * results. In order to detect things that just work by a blind
......
...@@ -36,8 +36,6 @@ ...@@ -36,8 +36,6 @@
# define VIR_FROM_THIS VIR_FROM_NONE # define VIR_FROM_THIS VIR_FROM_NONE
static const char *abs_top_srcdir;
# ifdef __linux__ # ifdef __linux__
# define RULESTYPE "linux" # define RULESTYPE "linux"
# else # else
...@@ -136,10 +134,6 @@ mymain(void) ...@@ -136,10 +134,6 @@ mymain(void)
{ {
int ret = 0; int ret = 0;
abs_top_srcdir = getenv("abs_top_srcdir");
if (!abs_top_srcdir)
abs_top_srcdir = abs_srcdir "/..";
# define DO_TEST(name) \ # define DO_TEST(name) \
do { \ do { \
static struct testInfo info = { \ static struct testInfo info = { \
......
...@@ -35,8 +35,6 @@ ...@@ -35,8 +35,6 @@
# define VIR_FROM_THIS VIR_FROM_NONE # define VIR_FROM_THIS VIR_FROM_NONE
static const char *abs_top_srcdir;
# ifdef __linux__ # ifdef __linux__
# define RULESTYPE "linux" # define RULESTYPE "linux"
# else # else
...@@ -459,10 +457,6 @@ mymain(void) ...@@ -459,10 +457,6 @@ mymain(void)
{ {
int ret = 0; int ret = 0;
abs_top_srcdir = getenv("abs_top_srcdir");
if (!abs_top_srcdir)
abs_top_srcdir = abs_srcdir "/..";
# define DO_TEST(name) \ # define DO_TEST(name) \
do { \ do { \
static struct testInfo info = { \ static struct testInfo info = { \
......
...@@ -19,7 +19,6 @@ ...@@ -19,7 +19,6 @@
# define VIR_FROM_THIS VIR_FROM_QEMU # define VIR_FROM_THIS VIR_FROM_QEMU
static const char *abs_top_srcdir;
static virQEMUDriver driver; static virQEMUDriver driver;
struct testInfo { struct testInfo {
...@@ -74,10 +73,6 @@ mymain(void) ...@@ -74,10 +73,6 @@ mymain(void)
setenv("LIBVIRT_FAKE_ROOT_DIR", fakerootdir, 1); 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) { if (qemuTestDriverInit(&driver) < 0) {
VIR_FREE(fakerootdir); VIR_FREE(fakerootdir);
return EXIT_FAILURE; return EXIT_FAILURE;
......
...@@ -33,7 +33,6 @@ ...@@ -33,7 +33,6 @@
# define VIR_FROM_THIS VIR_FROM_QEMU # define VIR_FROM_THIS VIR_FROM_QEMU
static const char *abs_top_srcdir;
static virQEMUDriver driver; static virQEMUDriver driver;
static unsigned char * static unsigned char *
...@@ -653,10 +652,6 @@ mymain(void) ...@@ -653,10 +652,6 @@ mymain(void)
setenv("LIBVIRT_FAKE_ROOT_DIR", fakerootdir, 1); 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. /* Set the timezone because we are mocking the time() function.
* If we don't do that, then localtime() may return unpredictable * If we don't do that, then localtime() may return unpredictable
* results. In order to detect things that just work by a blind * results. In order to detect things that just work by a blind
......
...@@ -30,7 +30,6 @@ ...@@ -30,7 +30,6 @@
VIR_LOG_INIT("tests.scsitest"); VIR_LOG_INIT("tests.scsitest");
static const char *abs_top_srcdir;
static char *virscsi_prefix; static char *virscsi_prefix;
static int static int
...@@ -195,10 +194,6 @@ mymain(void) ...@@ -195,10 +194,6 @@ mymain(void)
char *tmpdir = NULL; char *tmpdir = NULL;
char template[] = "/tmp/libvirt_XXXXXX"; 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) { if (virAsprintf(&virscsi_prefix, "%s" VIR_SCSI_DATA, abs_srcdir) < 0) {
ret = -1; ret = -1;
goto cleanup; goto cleanup;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册