[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] [PATCH] build: skip ld_preload tests on non-Linux systems

A cross build to mingw fails with:

  CC       virsystemdtest-virsystemdtest.o
../../tests/virsystemdtest.c: In function 'testCreateNoSystemd':
../../tests/virsystemdtest.c:97:9: error: implicit declaration of function 'unsetenv' [-Werror=implicit-function-declaration]
../../tests/virsystemdtest.c:97:9: error: nested extern declaration of 'unsetenv' [-Werror=nested-externs]

We could cop out and pull in the gnulib unsetenv module.  But when
you stop and think about it, this test requires LD_PRELOAD to work,
and systemd is a Linux-only concept anyways, both of which mean
the test could never work on mingw in the first place.  Simpler is
to just fix the test to behave like our other LD_PRELOAD tests.

* tests/virsystemdtest.c: Provide non-Linux implementation.

Signed-off-by: Eric Blake <eblake redhat com>

Pushing under the build-breaker rule.

 tests/virsystemdtest.c | 23 +++++++++++++++++------
 1 file changed, 17 insertions(+), 6 deletions(-)

diff --git a/tests/virsystemdtest.c b/tests/virsystemdtest.c
index 7dc7520..e68b3ac 100644
--- a/tests/virsystemdtest.c
+++ b/tests/virsystemdtest.c
@@ -20,13 +20,16 @@

 #include <config.h>

-#include <stdlib.h>
-#include "virsystemd.h"
-#include "virlog.h"
 #include "testutils.h"

+#ifdef __linux__
+# include <stdlib.h>
+# include "virsystemd.h"
+# include "virlog.h"

 static int testCreateContainer(const void *opaque ATTRIBUTE_UNUSED)
@@ -188,7 +191,7 @@ mymain(void)
     if (virtTestRun("Test create bad systemd ", 1, testCreateBadSystemd, NULL) < 0)
         ret = -1;

-#define TEST_SCOPE(name, partition, unitname)                           \
+# define TEST_SCOPE(name, partition, unitname)                          \
     do {                                                                \
         struct testScopeData data = {                                   \
             name, partition, unitname                                   \
@@ -209,3 +212,11 @@ mymain(void)

 VIRT_TEST_MAIN_PRELOAD(mymain, abs_builddir "/.libs/virsystemdmock.so")
+    return EXIT_AM_SKIP;

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]