mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-03 03:25:20 +00:00
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: Andrea Bolognani <abologna@redhat.com> Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
This commit is contained in:
parent
625c78b5c1
commit
cd01258714
@ -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
|
||||
|
@ -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 = { \
|
||||
|
@ -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 = { \
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user