]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
Remove some pointless code.
authorTim Kientzle <kientzle@gmail.com>
Sat, 16 Jan 2010 07:12:55 +0000 (02:12 -0500)
committerTim Kientzle <kientzle@gmail.com>
Sat, 16 Jan 2010 07:12:55 +0000 (02:12 -0500)
SVN-Revision: 1822

libarchive/test/test_write_format_cpio.c

index b6e791bd144e725ca8e56bf4f44008bea808076f..7bf2a41a528ae9977608ca1ac1644a92a70a98e0 100644 (file)
@@ -112,6 +112,8 @@ test_format(int     (*set_format)(struct archive *))
 
        /*
         * Damage the second entry to test the search-ahead recovery.
+        * TODO: Move the damage-recovery checking to a separate test;
+        * it doesn't really belong in this write test.
         */
        {
                int i;
@@ -151,28 +153,14 @@ test_format(int   (*set_format)(struct archive *))
        assert(0 == memcmp(filedata, "12345678", 8));
 
        /*
-        * Read the second file back.
+        * The second file can't be read because we damaged its header.
         */
-       if (!damaged) {
-               assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae));
-               assertEqualInt(1, archive_entry_mtime(ae));
-               /* Not the same as above: cpio doesn't store hi-res times. */
-               assert(0 == archive_entry_mtime_nsec(ae));
-               assert(0 == archive_entry_atime(ae));
-               assert(0 == archive_entry_ctime(ae));
-               assertEqualString("file2", archive_entry_pathname(ae));
-               assert((S_IFREG | 0755) == archive_entry_mode(ae));
-               assertEqualInt(4, archive_entry_size(ae));
-               assertEqualIntA(a, 4, archive_read_data(a, filedata, 10));
-               assert(0 == memcmp(filedata, "1234", 4));
-       }
 
        /*
         * Read the dir entry back.
+        * ARCHIVE_WARN here because the damaged entry was skipped.
         */
-       assertEqualIntA(a,
-           damaged ? ARCHIVE_WARN : ARCHIVE_OK,
-           archive_read_next_header(a, &ae));
+       assertEqualIntA(a, ARCHIVE_WARN, archive_read_next_header(a, &ae));
        assertEqualInt(11, archive_entry_mtime(ae));
        assert(0 == archive_entry_mtime_nsec(ae));
        assert(0 == archive_entry_atime(ae));