From 9e981b50995831e22a03eec5e8f5c1048f88f984 Mon Sep 17 00:00:00 2001 From: Charles Wilson Date: Tue, 7 Jul 2009 15:32:31 -0400 Subject: [PATCH] Various testsuite fixes for cygwin-1.7. * 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 | 8 ++++---- cpio/test/test_option_f.c | 10 +++++----- cpio/test/test_option_m.c | 4 ++-- libarchive/test/test_read_format_mtree.c | 4 ++-- tar/test/test_patterns.c | 12 ++++++------ 5 files changed, 19 insertions(+), 19 deletions(-) diff --git a/cpio/test/test_gcpio_compat.c b/cpio/test/test_gcpio_compat.c index caa0cd8bf..f9604b98a 100644 --- a/cpio/test/test_gcpio_compat.c +++ b/cpio/test/test_gcpio_compat.c @@ -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); } diff --git a/cpio/test/test_option_f.c b/cpio/test/test_option_f.c index 54e07ac6d..9d6b24c81 100644 --- a/cpio/test/test_option_f.c +++ b/cpio/test/test_option_f.c @@ -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)); diff --git a/cpio/test/test_option_m.c b/cpio/test/test_option_m.c index 7f8e9019d..fc02d2ec9 100644 --- a/cpio/test/test_option_m.c +++ b/cpio/test/test_option_m.c @@ -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"); diff --git a/libarchive/test/test_read_format_mtree.c b/libarchive/test/test_read_format_mtree.c index 56589ea21..330cde629 100644 --- a/libarchive/test/test_read_format_mtree.c +++ b/libarchive/test/test_read_format_mtree.c @@ -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"); diff --git a/tar/test/test_patterns.c b/tar/test/test_patterns.c index 3f1bd9f43..24664fd52 100644 --- a/tar/test/test_patterns.c +++ b/tar/test/test_patterns.c @@ -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"); -- 2.47.3