From: Tim Kientzle Date: Sat, 16 Jan 2010 07:12:55 +0000 (-0500) Subject: Remove some pointless code. X-Git-Tag: v2.8.0~17 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=a8d7a0687f5d9ad8ce959bce5a48ad150270c4f4;p=thirdparty%2Flibarchive.git Remove some pointless code. SVN-Revision: 1822 --- diff --git a/libarchive/test/test_write_format_cpio.c b/libarchive/test/test_write_format_cpio.c index b6e791bd1..7bf2a41a5 100644 --- a/libarchive/test/test_write_format_cpio.c +++ b/libarchive/test/test_write_format_cpio.c @@ -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));