[PATCH] Conditionalize use of symlink() function in test suite

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

 



From: "Daniel P. Berrange" <berrange@xxxxxxxxxx>

On Win32 symlink() is not available, so virstoragetest.c
must be conditionalized to avoid compile failures.

Signed-off-by: Daniel P. Berrange <berrange@xxxxxxxxxx>

Pushed as a win32 build breaker fix

---
 configure.ac           | 2 +-
 tests/virstoragetest.c | 6 ++++++
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/configure.ac b/configure.ac
index 11b332f..789d1c9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -194,7 +194,7 @@ dnl Availability of various common functions (non-fatal if missing),
 dnl and various less common threadsafe functions
 AC_CHECK_FUNCS_ONCE([cfmakeraw geteuid getgid getgrnam_r getmntent_r \
   getpwuid_r getuid initgroups kill mmap newlocale posix_fallocate \
-  posix_memalign regexec sched_getaffinity setns])
+  posix_memalign regexec sched_getaffinity setns symlink])
 
 dnl Availability of pthread functions (if missing, win32 threading is
 dnl assumed).  Because of $LIB_PTHREAD, we cannot use AC_CHECK_FUNCS_ONCE.
diff --git a/tests/virstoragetest.c b/tests/virstoragetest.c
index d495e6a..0e6ba9e 100644
--- a/tests/virstoragetest.c
+++ b/tests/virstoragetest.c
@@ -161,12 +161,14 @@ testPrepImages(void)
     if (virCommandRun(cmd, NULL) < 0)
         goto skip;
 
+#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
 
     ret = 0;
 cleanup:
@@ -364,6 +366,7 @@ mymain(void)
         canonraw, absraw, datadir, VIR_STORAGE_FILE_RAW,
         true, 1024, false,
     };
+#if HAVE_SYMLINK
     const testFileData link1_rel = {
         canonraw, "../raw", "sub/../sub/..", VIR_STORAGE_FILE_RAW,
         true, 1024, false,
@@ -380,6 +383,7 @@ mymain(void)
         canonqcow2, "../sub/link1", datadir "/sub/../sub",
         VIR_STORAGE_FILE_QCOW2, true, 1024, false,
     };
+#endif
 
     /* The actual tests, in several groups. */
 
@@ -522,6 +526,7 @@ mymain(void)
                chain12a, EXP_PASS,
                chain12b, ALLOW_PROBE | EXP_PASS);
 
+#ifdef HAVE_SYMLINK
     /* Rewrite qcow2 and wrap file to use backing names relative to a
      * symlink from a different directory */
     virCommandFree(cmd);
@@ -545,6 +550,7 @@ mymain(void)
                chain13a, ALLOW_PROBE | EXP_PASS,
                chain13c, EXP_PASS,
                chain13c, ALLOW_PROBE | EXP_PASS);
+#endif
 
     /* Final cleanup */
     testCleanupImages();
-- 
1.8.1.4

--
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]