]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
Verify -n option (modifier to -t) and verify some
authorTim Kientzle <kientzle@gmail.com>
Sun, 5 Apr 2009 05:11:20 +0000 (01:11 -0400)
committerTim Kientzle <kientzle@gmail.com>
Sun, 5 Apr 2009 05:11:20 +0000 (01:11 -0400)
that some nonsense arguments are properly rejected.

SVN-Revision: 924

Makefile.am
cpio/test/test_option_t.c
cpio/test/test_option_tnv.stdout.uu [new file with mode: 0644]

index 3a1bd05580ed982ef671b90b93e1f5d51b57d733..f5815f817ac312526c35c2aef95c85f949bd3313 100644 (file)
@@ -556,4 +556,5 @@ bsdcpio_test_EXTRA_DIST=                    \
        cpio/test/test_option_t.cpio.uu         \
        cpio/test/test_option_t.stdout.uu       \
        cpio/test/test_option_tv.stdout.uu      \
+       cpio/test/test_option_tnv.stdout.uu     \
        cpio/test/CMakeLists.txt
index 1328dfe09d36fa8843104e704d7687997fcff3b3..f08ff4e8f5e644e6d739d4b7e2a15fac16a6fd8b 100644 (file)
@@ -33,7 +33,16 @@ DEFINE_TEST(test_option_t)
 
        /* List reference archive, make sure the TOC is correct. */
        extract_reference_file("test_option_t.cpio");
-       r = systemf("%s -it < test_option_t.cpio >t.out 2>t.err", testprog);
+       r = systemf("%s -it < test_option_t.cpio >it.out 2>it.err", testprog);
+       assertEqualInt(r, 0);
+       assertTextFileContents("1 block\n", "it.err");
+       extract_reference_file("test_option_t.stdout");
+       p = slurpfile(NULL, "test_option_t.stdout");
+       assertTextFileContents(p, "it.out");
+       free(p);
+
+       /* We accept plain "-t" as a synonym for "-it" */
+       r = systemf("%s -t < test_option_t.cpio >t.out 2>t.err", testprog);
        assertEqualInt(r, 0);
        assertTextFileContents("1 block\n", "t.err");
        extract_reference_file("test_option_t.stdout");
@@ -51,4 +60,13 @@ DEFINE_TEST(test_option_t)
         * are different and cpio now looks up numeric UIDs on
         * the local system. */
        /* assertEqualFile("tv.out", "test_option_tv.stdout"); */
+
+       /* List reference archive verbosely, make sure the TOC is correct. */
+       r = systemf("%s -itnv < test_option_t.cpio >itnv.out 2>itnv.err",
+                   testprog);
+       assertEqualInt(r, 0);
+       assertTextFileContents("1 block\n", "itnv.err");
+       extract_reference_file("test_option_tnv.stdout");
+       /* This does work because numeric IDs come from archive. */
+       assertEqualFile("itnv.out", "test_option_tnv.stdout");
 }
diff --git a/cpio/test/test_option_tnv.stdout.uu b/cpio/test/test_option_tnv.stdout.uu
new file mode 100644 (file)
index 0000000..110f9f1
--- /dev/null
@@ -0,0 +1,5 @@
+begin 644 test_option_tnv.stdout
+M+7)W+7(M+7(M+2`@(#$@,3`P,"`@("`@,3`P,"`@("`@("`@("`@(#`@1&5C
+/(#,Q("`Q.38Y(&9I;&4*
+`
+end