]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
Various testsuite fixes for cygwin-1.7.
authorCharles Wilson <cwilso11@gmail.com>
Tue, 7 Jul 2009 19:32:31 +0000 (15:32 -0400)
committerCharles Wilson <cwilso11@gmail.com>
Tue, 7 Jul 2009 19:32:31 +0000 (15:32 -0400)
* libarchive/test/test_read_format_mtree.c: Fix typo in test.
* tar/test/test_patterns.c: Ensure tests work without root privilege.
* cpio/test/test_option_f.c: Ditto.
* cpio/test/test_option_m.c: Ditto.
* cpio/test/test_gcpio_compat.c: Ditto.

SVN-Revision: 1219

cpio/test/test_gcpio_compat.c
cpio/test/test_option_f.c
cpio/test/test_option_m.c
libarchive/test/test_read_format_mtree.c
tar/test/test_patterns.c

index caa0cd8bf8db47ada2be80d9af62b85becb850ec..f9604b98a99cffb032b1e553a51a576b2ac83e78 100644 (file)
@@ -134,11 +134,11 @@ DEFINE_TEST(test_gcpio_compat)
        oldumask = umask(0);
 
        /* Dearchive sample files with a variety of options. */
-       unpack_test("test_gcpio_compat_ref.bin", "", "1 block\n");
-       unpack_test("test_gcpio_compat_ref.crc", "", "2 blocks\n");
-       unpack_test("test_gcpio_compat_ref.newc", "", "2 blocks\n");
+       unpack_test("test_gcpio_compat_ref.bin", "--no-preserve-owner", "1 block\n");
+       unpack_test("test_gcpio_compat_ref.crc", "--no-preserve-owner", "2 blocks\n");
+       unpack_test("test_gcpio_compat_ref.newc", "--no-preserve-owner", "2 blocks\n");
        /* gcpio-2.9 only reads 6 blocks here */
-       unpack_test("test_gcpio_compat_ref.ustar", "", "7 blocks\n");
+       unpack_test("test_gcpio_compat_ref.ustar", "--no-preserve-owner", "7 blocks\n");
 
        umask(oldumask);
 }
index 54e07ac6da9c722ec33b3934812521c983a54e71..9d6b24c81baa96d6d361cb9e1f90b8d9a37b993e 100644 (file)
@@ -44,7 +44,7 @@ unpack(const char *dirname, const char *option)
 DEFINE_TEST(test_option_f)
 {
        /* Calibrate:  No -f option, so everything should be extracted. */
-       unpack("t0", "");
+       unpack("t0", "--no-preserve-owner");
        assertEqualInt(0, access("t0/a123", F_OK));
        assertEqualInt(0, access("t0/a234", F_OK));
        assertEqualInt(0, access("t0/b123", F_OK));
@@ -53,9 +53,9 @@ DEFINE_TEST(test_option_f)
        /* Don't extract 'a*' files. */
 #if defined(_WIN32) && !defined(__CYGWIN__)
        /* Single quotes isn't used by command.exe. */
-       unpack("t1", "-f a*");
+       unpack("t1", "--no-preserve-owner -f a*");
 #else
-       unpack("t1", "-f 'a*'");
+       unpack("t1", "--no-preserve-owner -f 'a*'");
 #endif
        assert(0 != access("t1/a123", F_OK));
        assert(0 != access("t1/a234", F_OK));
@@ -65,9 +65,9 @@ DEFINE_TEST(test_option_f)
        /* Don't extract 'b*' files. */
 #if defined(_WIN32) && !defined(__CYGWIN__)
        /* Single quotes isn't used by command.exe. */
-       unpack("t2", "-f b*");
+       unpack("t2", "--no-preserve-owner -f b*");
 #else
-       unpack("t2", "-f 'b*'");
+       unpack("t2", "--no-preserve-owner -f 'b*'");
 #endif
        assertEqualInt(0, access("t2/a123", F_OK));
        assertEqualInt(0, access("t2/a234", F_OK));
index 7f8e9019d82e8f1f5c86c751cde5ea983150a209..fc02d2ec9051513be415b36a3db23aa7ffd4d405 100644 (file)
@@ -41,7 +41,7 @@ DEFINE_TEST(test_option_m)
        assertEqualInt(0, mkdir("without-m", 0755));
        assertEqualInt(0, chdir("without-m"));
        extract_reference_file("test_option_m.cpio");
-       r = systemf("%s -i < test_option_m.cpio >out 2>err", testprog);
+       r = systemf("%s --no-preserve-owner -i < test_option_m.cpio >out 2>err", testprog);
        now = time(NULL);
        assertEqualInt(r, 0);
        assertEmptyFile("out");
@@ -56,7 +56,7 @@ DEFINE_TEST(test_option_m)
        assertEqualInt(0, mkdir("with-m", 0755));
        assertEqualInt(0, chdir("with-m"));
        extract_reference_file("test_option_m.cpio");
-       r = systemf("%s -im < test_option_m.cpio >out 2>err", testprog);
+       r = systemf("%s --no-preserve-owner -im < test_option_m.cpio >out 2>err", testprog);
        now = time(NULL);
        assertEqualInt(r, 0);
        assertEmptyFile("out");
index 56589ea216fb77f7faf961519ae14320d942d693..330cde62914e3b9a04eeae262d5b89a612d439f6 100644 (file)
@@ -32,7 +32,7 @@ static unsigned char archive[] = {
        "dir type=dir\n"
        " file\\040with\\040space type=file uid=18\n"
        " ..\n"
-       "file\\04with\\040space type=file\n"
+       "file\\040with\\040space type=file\n"
        "dir2 type=dir\n"
        " dir3a type=dir\n"
        "  indir3a type=file\n"
@@ -96,7 +96,7 @@ DEFINE_TEST(test_read_format_mtree)
        assertEqualString(archive_entry_pathname(ae), "dir/file with space");
 
        assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae));
-       assertEqualString(archive_entry_pathname(ae), "file\\04with space");
+       assertEqualString(archive_entry_pathname(ae), "file with space");
 
        assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae));
        assertEqualString(archive_entry_pathname(ae), "dir2");
index 3f1bd9f439d79b637d3f944502065b03ec875e9d..24664fd52aaae616cbb65babdecdc57a6509a804 100644 (file)
@@ -49,7 +49,7 @@ DEFINE_TEST(test_patterns)
        close(fd);
        r = systemf("%s cfv tar1.tgz foo > tar1a.out 2> tar1a.err", testprog);
        assertEqualInt(r, 0);
-       r = systemf("%s xfv tar1.tgz foo bar > tar1b.out 2> tar1b.err", testprog);
+       r = systemf("%s xv --no-same-owner -f tar1.tgz foo bar > tar1b.out 2> tar1b.err", testprog);
        failure("tar should return non-zero because a file was given on the command line that's not in the archive");
        assert(r != 0);
 
@@ -75,7 +75,7 @@ DEFINE_TEST(test_patterns)
        extract_reference_file(reffile3);
 
        /* Test 3a:  Pattern tmp/foo/bar should not match /tmp/foo/bar */
-       r = systemf("%s xf %s tmp/foo/bar > tar3a.out 2> tar3a.err",
+       r = systemf("%s x --no-same-owner -f %s tmp/foo/bar > tar3a.out 2> tar3a.err",
            testprog, reffile3);
        assert(r != 0);
        assertEmptyFile("tar3a.out");
@@ -83,21 +83,21 @@ DEFINE_TEST(test_patterns)
        /* Test 3b:  Pattern /tmp/foo/baz should not match tmp/foo/baz */
        assertNonEmptyFile("tar3a.err");
        /* Again, with the '/' */
-       r = systemf("%s xf %s /tmp/foo/baz > tar3b.out 2> tar3b.err",
+       r = systemf("%s x --no-same-owner -f %s /tmp/foo/baz > tar3b.out 2> tar3b.err",
            testprog, reffile3);
        assert(r != 0);
        assertEmptyFile("tar3b.out");
        assertNonEmptyFile("tar3b.err");
 
        /* Test 3c: ./tmp/foo/bar should not match /tmp/foo/bar */
-       r = systemf("%s xf %s ./tmp/foo/bar > tar3c.out 2> tar3c.err",
+       r = systemf("%s x --no-same-owner -f %s ./tmp/foo/bar > tar3c.out 2> tar3c.err",
            testprog, reffile3);
        assert(r != 0);
        assertEmptyFile("tar3c.out");
        assertNonEmptyFile("tar3c.err");
 
        /* Test 3d: ./tmp/foo/baz should match tmp/foo/baz */
-       r = systemf("%s xf %s ./tmp/foo/baz > tar3d.out 2> tar3d.err",
+       r = systemf("%s x --no-same-owner -f %s ./tmp/foo/baz > tar3d.out 2> tar3d.err",
            testprog, reffile3);
        assertEqualInt(r, 0);
        assertEmptyFile("tar3d.out");
@@ -110,7 +110,7 @@ DEFINE_TEST(test_patterns)
         */
        extract_reference_file(reffile4);
 
-       r = systemf("%s xf %s -C tmp > tar4.out 2> tar4.err",
+       r = systemf("%s x --no-same-owner -f %s -C tmp > tar4.out 2> tar4.err",
            testprog, reffile4);
        assert(r != 0);
        assertEmptyFile("tar4.out");