]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
Convert some cpio/test symlink/hardlink handling to new platform-independent test...
authorTim Kientzle <kientzle@gmail.com>
Sun, 2 Aug 2009 21:53:44 +0000 (17:53 -0400)
committerTim Kientzle <kientzle@gmail.com>
Sun, 2 Aug 2009 21:53:44 +0000 (17:53 -0400)
SVN-Revision: 1318

cpio/test/test_basic.c
cpio/test/test_format_newc.c
cpio/test/test_option_L_upper.c
cpio/test/test_option_c.c

index 13bddfaea4892f55853799237d421a23fce23a38..e16160a056fdb408c525e5e1ea6673c1403acf29 100644 (file)
@@ -200,11 +200,11 @@ DEFINE_TEST(test_basic)
        write(filelist, "file\n", 5);
 
        /* hardlink to above file. */
-       assertEqualInt(0, link("file", "linkfile"));
+       assertMakeHardlink("linkfile", "file");
        write(filelist, "linkfile\n", 9);
 
        /* Symlink to above file. */
-       assertEqualInt(0, symlink("file", "symlink"));
+       assertMakeSymlink("symlink", "file");
        write(filelist, "symlink\n", 8);
 
        /* Another file with different permissions. */
index 0533364bd06417213d891467faaeb9d9849c6567..8d89112feb726de040a214531973a71ffa9b6986 100644 (file)
@@ -91,10 +91,10 @@ DEFINE_TEST(test_format_newc)
        assertEqualInt(9, write(list, "hardlink\n", 9));
 
        /* Another hardlink, but this one won't be archived. */
-       assertEqualInt(0, link("file1", "hardlink2"));
+       assertMakeHardlink("hardlink2", "file1");
 
        /* "symlink" */
-       assertEqualInt(0, symlink("file1", "symlink"));
+       assertMakeSymlink("symlink", "file1");
        assertEqualInt(8, write(list, "symlink\n", 8));
 
        /* "dir" */
index db5f642c7264a7858442e6fd4ec14a095ded8daf..ebd0b030ce524e7fae08ab1a42d317e3ae7966ea 100644 (file)
@@ -47,17 +47,17 @@ DEFINE_TEST(test_option_L_upper)
        write(filelist, "file\n", 5);
 
        /* Symlink to above file. */
-       assertEqualInt(0, symlink("file", "symlink"));
+       assertMakeSymlink("symlink", "file");
        write(filelist, "symlink\n", 8);
 
        close(filelist);
 
        r = systemf(CAT " filelist | %s -pd copy >copy.out 2>copy.err", testprog);
        assertEqualInt(r, 0);
-       assertEqualInt(0, lstat("copy/symlink", &st));
+
 #if !defined(_WIN32) || defined(__CYGWIN__)
        failure("Regular -p without -L should preserve symlinks.");
-       assert(S_ISLNK(st.st_mode));
+       assertIsSymlink("copy/symlink", NULL);
 #endif
 
        r = systemf(CAT " filelist | %s -pd -L copy-L >copy-L.out 2>copy-L.err", testprog);
@@ -82,9 +82,9 @@ DEFINE_TEST(test_option_L_upper)
 #endif
        failure("Error invoking %s -i", testprog);
        assertEqualInt(r, 0);
-       assertEqualInt(0, lstat("unpack/symlink", &st));
+
 #if !defined(_WIN32) || defined(__CYGWIN__)
-       assert(S_ISLNK(st.st_mode));
+       assertIsSymlink("unpack/symlink", NULL);
 #endif
 
        r = systemf(CAT " filelist | %s -oL >archive-L.out 2>archive-L.err", testprog);
index 23eabff79fe38bf0a108c1eaf9b3986ee744fd3a..3edec3021939e48badcb3271eaa66d1ba40625d8 100644 (file)
@@ -77,7 +77,7 @@ DEFINE_TEST(test_option_c)
        assertEqualInt(5, write(filelist, "file\n", 5));
 
        /* "symlink" */
-       assertEqualInt(0, symlink("file", "symlink"));
+       assertMakeSymlink("symlink", "file");
        assertEqualInt(8, write(filelist, "symlink\n", 8));
 
        /* "dir" */