[libvirt] [PATCH] virstoragetest: Don't run the test on 32 bit arches

Michal Privoznik mprivozn at redhat.com
Tue Apr 29 08:36:51 UTC 2014


Currently, there's an issue with virStrToLong_* APIs that they turn
"-1" into UINT_MAX. While this is not acceptable, it works on 64 bit
architectures and doesn't work on 32 bit ones. I know that much
cleaner solution is required, but given that we are in the freeze we
may as well just skip the test on 32 bits.

Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
---
 tests/virstoragetest.c | 54 ++++++++++++++++++++++++++++++++------------------
 1 file changed, 35 insertions(+), 19 deletions(-)

diff --git a/tests/virstoragetest.c b/tests/virstoragetest.c
index 018469a..9e81782 100644
--- a/tests/virstoragetest.c
+++ b/tests/virstoragetest.c
@@ -23,19 +23,26 @@
 #include <stdlib.h>
 
 #include "testutils.h"
-#include "vircommand.h"
-#include "virerror.h"
-#include "virfile.h"
-#include "virlog.h"
-#include "virstoragefile.h"
-#include "virstring.h"
-#include "dirname.h"
 
-#define VIR_FROM_THIS VIR_FROM_NONE
+/*
+ * XXX An awful workaround as this test doesn't run
+ * cleanly on 32 bit architectures.
+ */
+#ifdef __LP64__
+
+# include "vircommand.h"
+# include "virerror.h"
+# include "virfile.h"
+# include "virlog.h"
+# include "virstoragefile.h"
+# include "virstring.h"
+# include "dirname.h"
+
+# define VIR_FROM_THIS VIR_FROM_NONE
 
 VIR_LOG_INIT("tests.storagetest");
 
-#define datadir abs_builddir "/virstoragedata"
+# define datadir abs_builddir "/virstoragedata"
 
 /* This test creates the following files, all in datadir:
 
@@ -239,14 +246,14 @@ testPrepImages(void)
         goto cleanup;
     }
 
-#ifdef HAVE_SYMLINK
+# ifdef HAVE_SYMLINK
     /* Create some symlinks in a sub-directory. */
     if (symlink("../qcow2", datadir "/sub/link1") < 0 ||
         symlink("../wrap", datadir "/sub/link2") < 0) {
         fprintf(stderr, "unable to create symlink");
         goto cleanup;
     }
-#endif
+# endif
 
     ret = 0;
  cleanup:
@@ -513,7 +520,7 @@ mymain(void)
     if ((ret = testPrepImages()) != 0)
         return ret;
 
-#define TEST_ONE_CHAIN(id, start, format, flags, ...)                \
+# define TEST_ONE_CHAIN(id, start, format, flags, ...)               \
     do {                                                             \
         size_t i;                                                    \
         memset(&data, 0, sizeof(data));                              \
@@ -528,10 +535,10 @@ mymain(void)
             ret = -1;                                                \
     } while (0)
 
-#define VIR_FLATTEN_2(...) __VA_ARGS__
-#define VIR_FLATTEN_1(_1) VIR_FLATTEN_2 _1
+# define VIR_FLATTEN_2(...) __VA_ARGS__
+# define VIR_FLATTEN_1(_1) VIR_FLATTEN_2 _1
 
-#define TEST_CHAIN(id, relstart, absstart, format, chain1, flags1,   \
+# define TEST_CHAIN(id, relstart, absstart, format, chain1, flags1,  \
                    chain2, flags2, chain3, flags3, chain4, flags4)   \
     do {                                                             \
         TEST_ONE_CHAIN(#id "a", relstart, format, flags1,            \
@@ -788,7 +795,7 @@ mymain(void)
                (&dir), EXP_PASS,
                (&dir), ALLOW_PROBE | EXP_PASS);
 
-#ifdef HAVE_SYMLINK
+# ifdef HAVE_SYMLINK
     /* Rewrite qcow2 and wrap file to use backing names relative to a
      * symlink from a different directory */
     virCommandFree(cmd);
@@ -838,7 +845,7 @@ mymain(void)
                (&link2, &link1, &raw), ALLOW_PROBE | EXP_PASS,
                (&link2, &link1, &raw), EXP_PASS,
                (&link2, &link1, &raw), ALLOW_PROBE | EXP_PASS);
-#endif
+# endif
 
     /* Rewrite qcow2 to be a self-referential loop */
     virCommandFree(cmd);
@@ -894,7 +901,7 @@ mymain(void)
         goto cleanup;
     }
 
-#define TEST_LOOKUP_TARGET(id, target, name, index, result, meta, parent)   \
+# define TEST_LOOKUP_TARGET(id, target, name, index, result, meta, parent)  \
     do {                                                                    \
         struct testLookupData data2 = { chain, target, name, index,         \
                                         result, meta, parent, };            \
@@ -902,7 +909,7 @@ mymain(void)
                         testStorageLookup, &data2) < 0)                     \
             ret = -1;                                                       \
     } while (0)
-#define TEST_LOOKUP(id, name, result, meta, parent)                         \
+# define TEST_LOOKUP(id, name, result, meta, parent)                        \
     TEST_LOOKUP_TARGET(id, NULL, name, 0, result, meta, parent)
 
     TEST_LOOKUP(0, "bogus", NULL, NULL, NULL);
@@ -1012,3 +1019,12 @@ mymain(void)
 }
 
 VIRT_TEST_MAIN(mymain)
+
+#else
+
+int main(void)
+{
+    return EXIT_AM_SKIP;
+}
+
+#endif /* __LP64___ */
-- 
1.9.0




More information about the libvir-list mailing list