mirror of https://gitee.com/openkylin/libvirt.git
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 <berrange@redhat.com>
This commit is contained in:
parent
3f85de5292
commit
c78a2b13a6
|
@ -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.
|
||||
|
|
|
@ -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();
|
||||
|
|
Loading…
Reference in New Issue