From c78a2b13a6d36244afe8886b668745a7d939164b Mon Sep 17 00:00:00 2001 From: "Daniel P. Berrange" Date: Mon, 15 Apr 2013 17:00:17 +0100 Subject: [PATCH] Conditionalize use of symlink() function in test suite On Win32 symlink() is not available, so virstoragetest.c must be conditionalized to avoid compile failures. Signed-off-by: Daniel P. Berrange --- configure.ac | 2 +- tests/virstoragetest.c | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 11b332f772..789d1c9cfd 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 d495e6a723..0e6ba9e75c 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();