[PATCH 2/2] Build vircaps2xmltest and requirements only on Linux

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

 



The mock, as well as the test, is only available on Linux.  So skip
building it everywhere else, especially when it fails on mingw.

Signed-off-by: Martin Kletzander <mkletzan@xxxxxxxxxx>
---
 tests/Makefile.am       | 17 ++++++++++-------
 tests/vircaps2xmltest.c | 16 ++--------------
 2 files changed, 12 insertions(+), 21 deletions(-)

diff --git a/tests/Makefile.am b/tests/Makefile.am
index 076734feda70..67cf497b8b27 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -192,7 +192,6 @@ test_programs = virshtest sockettest \
 	domaincapstest \
 	domainconftest \
 	virhostdevtest \
-	vircaps2xmltest \
 	virnetdevtest \
 	virtypedparamtest \
 	$(NULL)
@@ -206,7 +205,6 @@ test_libraries = libshunload.la \
 	virnetdevmock.la \
 	virrandommock.la \
 	virhostcpumock.la \
-	virnumamock.la \
 	domaincapsmock.la \
 	$(NULL)

@@ -225,8 +223,10 @@ endif WITH_REMOTE
 if WITH_LINUX
 test_programs += fchosttest
 test_programs += scsihosttest
+test_programs += vircaps2xmltest
 test_libraries += virusbmock.la \
 	virnetdevbandwidthmock.la \
+	virnumamock.la \
 	virtestmock.la \
 	$(NULL)
 endif WITH_LINUX
@@ -941,11 +941,6 @@ vircapstest_SOURCES += testutilsxen.c testutilsxen.h
 endif WITH_XEN
 vircapstest_LDADD = $(qemu_LDADDS) $(LDADDS)

-vircaps2xmltest_SOURCES = \
-	vircaps2xmltest.c testutils.h testutils.c
-vircaps2xmltest_LDADD = $(LDADDS)
-
-
 domaincapsmock_la_SOURCES = domaincapsmock.c
 domaincapsmock_la_CFLAGS = $(AM_CFLAGS)
 domaincapsmock_la_LDFLAGS = $(MOCKLIBS_LDFLAGS)
@@ -1125,11 +1120,19 @@ virhostcpumock_la_CFLAGS = $(AM_CFLAGS)
 virhostcpumock_la_LDFLAGS = $(MOCKLIBS_LDFLAGS)
 virhostcpumock_la_LIBADD = $(MOCKLIBS_LIBS)

+if WITH_LINUX
+vircaps2xmltest_SOURCES = \
+	vircaps2xmltest.c testutils.h testutils.c
+vircaps2xmltest_LDADD = $(LDADDS)
+
 virnumamock_la_SOURCES = \
 	virnumamock.c
 virnumamock_la_CFLAGS = $(AM_CFLAGS)
 virnumamock_la_LDFLAGS = $(MOCKLIBS_LDFLAGS)
 virnumamock_la_LIBADD = $(MOCKLIBS_LIBS)
+else ! WITH_LINUX
+EXTRA_DIST += vircaps2xmltest.c virnumamock.c
+endif ! WITH_LINUX

 if WITH_NSS
 nsstest_SOURCES = \
diff --git a/tests/vircaps2xmltest.c b/tests/vircaps2xmltest.c
index 4dccd452cc82..ffbe9a783811 100644
--- a/tests/vircaps2xmltest.c
+++ b/tests/vircaps2xmltest.c
@@ -30,8 +30,6 @@

 #define VIR_FROM_THIS VIR_FROM_NONE

-#ifdef __linux__
-
 struct virCapabilitiesData {
     const char *filename;
     virArch arch;
@@ -90,7 +88,7 @@ mymain(void)
 {
     int ret = 0;

-# define DO_TEST_FULL(filename, arch, offlineMigrate, liveMigrate)       \
+#define DO_TEST_FULL(filename, arch, offlineMigrate, liveMigrate)       \
     do {                                                                \
         struct virCapabilitiesData data = {filename, arch,              \
                                            offlineMigrate,              \
@@ -99,7 +97,7 @@ mymain(void)
             ret = -1;                                                   \
     } while (0)

-# define DO_TEST(filename, arch) DO_TEST_FULL(filename, arch, true, true)
+#define DO_TEST(filename, arch) DO_TEST_FULL(filename, arch, true, true)

     DO_TEST_FULL("basic", VIR_ARCH_X86_64, false, false);
     DO_TEST_FULL("basic", VIR_ARCH_AARCH64, true, false);
@@ -110,13 +108,3 @@ mymain(void)
 }

 VIRT_TEST_MAIN_PRELOAD(mymain, abs_builddir "/.libs/virnumamock.so")
-
-#else /* !__linux__ */
-
-int
-main(void)
-{
-    return EXIT_AM_SKIP;
-}
-
-#endif /* !__linux__ */
-- 
2.12.2

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]
  Powered by Linux