From: Michihiro NAKAJIMA Date: Mon, 16 Feb 2009 07:56:21 +0000 (-0500) Subject: Skip symlink tests on Windows. X-Git-Tag: v2.7.0~262 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fc5c59feb963628a389b435b8dc01232b349fd5e;p=thirdparty%2Flibarchive.git Skip symlink tests on Windows. Now, all bsdtar tests passed on Windows. Results are: 0 of 13 tests reported failures Total of 84126 assertions checked. Total of 0 assertions failed. Total of 9 assertions skipped. Still needs more improvement. SVN-Revision: 644 --- diff --git a/tar/test/test_copy.c b/tar/test/test_copy.c index 349651c39..af77cf601 100644 --- a/tar/test/test_copy.c +++ b/tar/test/test_copy.c @@ -64,6 +64,7 @@ create_tree(void) buff2[0] = 'm'; assertEqualInt(0, link(buff, buff2)); +#ifndef _WIN32 /* Create a symlink named "s/abcdef..." to the above. */ strcpy(buff2 + 3, buff); buff[0] = 's'; @@ -71,7 +72,9 @@ create_tree(void) buff2[1] = '.'; buff2[2] = '/'; assertEqualInt(0, symlink(buff2, buff)); - +#else + skipping("create a symlink to the above"); +#endif /* Create a dir named "d/abcdef...". */ buff[0] = 'd'; assertEqualInt(0, mkdir(buff, 0775)); @@ -153,6 +156,7 @@ verify_tree(int limit) } } +#ifndef _WIN32 /* * Symlink text doesn't include the 'original/' prefix, * so the limit here is 100 characters. @@ -174,7 +178,9 @@ verify_tree(int limit) } } } - +#else + skipping("verify symlink"); +#endif /* Verify dir "d/abcdef...". */ strcpy(name1, "d/"); strcat(name1, filename); diff --git a/tar/test/test_strip_components.c b/tar/test/test_strip_components.c index 9bade16de..8ecf29a44 100644 --- a/tar/test/test_strip_components.c +++ b/tar/test/test_strip_components.c @@ -64,7 +64,11 @@ DEFINE_TEST(test_strip_components) failure("d0/d1/ is too short and should not get restored"); assertEqualInt(-1, lstat("target/d1", &st)); failure("d0/d1/s2 is a symlink to something that won't be extracted"); +#ifndef _WIN32 assertEqualInt(-1, stat("target/s2", &st)); +# + skipping("symlink with stat()"); +#endif assertEqualInt(0, lstat("target/s2", &st)); failure("d0/d1/d2 should be extracted"); assertEqualInt(0, lstat("target/d2", &st)); diff --git a/tar/test/test_symlink_dir.c b/tar/test/test_symlink_dir.c index 569da65a5..c60e42901 100644 --- a/tar/test/test_symlink_dir.c +++ b/tar/test/test_symlink_dir.c @@ -75,18 +75,25 @@ DEFINE_TEST(test_symlink_dir) assertEqualInt(0, mkdir("dest1", 0755)); /* "dir" is a symlink to an existing "real_dir" */ assertEqualInt(0, mkdir("dest1/real_dir", 0755)); +#ifndef _WIN32 assertEqualInt(0, symlink("real_dir", "dest1/dir")); /* "dir2" is a symlink to a non-existing "real_dir2" */ assertEqualInt(0, symlink("real_dir2", "dest1/dir2")); +#else + skipping("symlink does not work on this platform"); +#endif /* "dir3" is a symlink to an existing "non_dir3" */ assertEqualInt(0, mkfile("dest1/non_dir3", 0755, "abcdef", 6)); assertEqualInt(0, symlink("non_dir3", "dest1/dir3")); /* "file" is a symlink to existing "real_file" */ assertEqualInt(0, mkfile("dest1/real_file", 0755, "abcdefg", 7)); assertEqualInt(0, symlink("real_file", "dest1/file")); +#ifndef _WIN32 /* "file2" is a symlink to non-existing "real_file2" */ assertEqualInt(0, symlink("real_file2", "dest1/file2")); - +#else + skipping("symlink does not work on this platform"); +#endif assertEqualInt(0, systemf("%s -xf test.tar -C dest1", testprog)); /* dest1/dir symlink should be removed */ @@ -116,23 +123,31 @@ DEFINE_TEST(test_symlink_dir) assertEqualInt(0, mkdir("dest2", 0755)); /* "dir" is a symlink to existing "real_dir" */ assertEqualInt(0, mkdir("dest2/real_dir", 0755)); +#ifndef _WIN32 assertEqualInt(0, symlink("real_dir", "dest2/dir")); /* "dir2" is a symlink to a non-existing "real_dir2" */ assertEqualInt(0, symlink("real_dir2", "dest2/dir2")); +#else + skipping("symlink does not work on this platform"); +#endif /* "dir3" is a symlink to an existing "non_dir3" */ assertEqualInt(0, mkfile("dest2/non_dir3", 0755, "abcdefgh", 8)); assertEqualInt(0, symlink("non_dir3", "dest2/dir3")); /* "file" is a symlink to existing "real_file" */ assertEqualInt(0, mkfile("dest2/real_file", 0755, "abcdefghi", 9)); assertEqualInt(0, symlink("real_file", "dest2/file")); +#ifndef _WIN32 /* "file2" is a symlink to non-existing "real_file2" */ assertEqualInt(0, symlink("real_file2", "dest2/file2")); - +#else + skipping("symlink does not work on this platform"); +#endif assertEqualInt(0, systemf("%s -xPf test.tar -C dest2", testprog)); /* dest2/dir symlink should be followed */ assertEqualInt(0, lstat("dest2/dir", &st)); failure("tar -xP removed symlink instead of following it"); +#ifndef _WIN32 if (assert(S_ISLNK(st.st_mode))) { /* Only verify what the symlink points to if it * really is a symlink. */ @@ -146,6 +161,9 @@ DEFINE_TEST(test_symlink_dir) failure("symlink should still point to the existing directory"); assertEqualInt(st.st_ino, st2.st_ino); } +#else + skipping("symlink does not work on this platform"); +#endif /* Contents of 'dir' should be restored */ assertEqualInt(0, lstat("dest2/dir/d", &st)); assert(S_ISDIR(st.st_mode));