mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-20 07:59:00 +00:00
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
|
dnl and various less common threadsafe functions
|
||||||
AC_CHECK_FUNCS_ONCE([cfmakeraw geteuid getgid getgrnam_r getmntent_r \
|
AC_CHECK_FUNCS_ONCE([cfmakeraw geteuid getgid getgrnam_r getmntent_r \
|
||||||
getpwuid_r getuid initgroups kill mmap newlocale posix_fallocate \
|
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 Availability of pthread functions (if missing, win32 threading is
|
||||||
dnl assumed). Because of $LIB_PTHREAD, we cannot use AC_CHECK_FUNCS_ONCE.
|
dnl assumed). Because of $LIB_PTHREAD, we cannot use AC_CHECK_FUNCS_ONCE.
|
||||||
|
@ -161,12 +161,14 @@ testPrepImages(void)
|
|||||||
if (virCommandRun(cmd, NULL) < 0)
|
if (virCommandRun(cmd, NULL) < 0)
|
||||||
goto skip;
|
goto skip;
|
||||||
|
|
||||||
|
#ifdef HAVE_SYMLINK
|
||||||
/* Create some symlinks in a sub-directory. */
|
/* Create some symlinks in a sub-directory. */
|
||||||
if (symlink("../qcow2", datadir "/sub/link1") < 0 ||
|
if (symlink("../qcow2", datadir "/sub/link1") < 0 ||
|
||||||
symlink("../wrap", datadir "/sub/link2") < 0) {
|
symlink("../wrap", datadir "/sub/link2") < 0) {
|
||||||
fprintf(stderr, "unable to create symlink");
|
fprintf(stderr, "unable to create symlink");
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
ret = 0;
|
ret = 0;
|
||||||
cleanup:
|
cleanup:
|
||||||
@ -364,6 +366,7 @@ mymain(void)
|
|||||||
canonraw, absraw, datadir, VIR_STORAGE_FILE_RAW,
|
canonraw, absraw, datadir, VIR_STORAGE_FILE_RAW,
|
||||||
true, 1024, false,
|
true, 1024, false,
|
||||||
};
|
};
|
||||||
|
#if HAVE_SYMLINK
|
||||||
const testFileData link1_rel = {
|
const testFileData link1_rel = {
|
||||||
canonraw, "../raw", "sub/../sub/..", VIR_STORAGE_FILE_RAW,
|
canonraw, "../raw", "sub/../sub/..", VIR_STORAGE_FILE_RAW,
|
||||||
true, 1024, false,
|
true, 1024, false,
|
||||||
@ -380,6 +383,7 @@ mymain(void)
|
|||||||
canonqcow2, "../sub/link1", datadir "/sub/../sub",
|
canonqcow2, "../sub/link1", datadir "/sub/../sub",
|
||||||
VIR_STORAGE_FILE_QCOW2, true, 1024, false,
|
VIR_STORAGE_FILE_QCOW2, true, 1024, false,
|
||||||
};
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
/* The actual tests, in several groups. */
|
/* The actual tests, in several groups. */
|
||||||
|
|
||||||
@ -522,6 +526,7 @@ mymain(void)
|
|||||||
chain12a, EXP_PASS,
|
chain12a, EXP_PASS,
|
||||||
chain12b, ALLOW_PROBE | EXP_PASS);
|
chain12b, ALLOW_PROBE | EXP_PASS);
|
||||||
|
|
||||||
|
#ifdef HAVE_SYMLINK
|
||||||
/* Rewrite qcow2 and wrap file to use backing names relative to a
|
/* Rewrite qcow2 and wrap file to use backing names relative to a
|
||||||
* symlink from a different directory */
|
* symlink from a different directory */
|
||||||
virCommandFree(cmd);
|
virCommandFree(cmd);
|
||||||
@ -545,6 +550,7 @@ mymain(void)
|
|||||||
chain13a, ALLOW_PROBE | EXP_PASS,
|
chain13a, ALLOW_PROBE | EXP_PASS,
|
||||||
chain13c, EXP_PASS,
|
chain13c, EXP_PASS,
|
||||||
chain13c, ALLOW_PROBE | EXP_PASS);
|
chain13c, ALLOW_PROBE | EXP_PASS);
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Final cleanup */
|
/* Final cleanup */
|
||||||
testCleanupImages();
|
testCleanupImages();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user