]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
More tweaks to mtree numeric range tests.
authorTim Kientzle <kientzle@gmail.com>
Sun, 11 Sep 2011 18:38:39 +0000 (14:38 -0400)
committerTim Kientzle <kientzle@gmail.com>
Sun, 11 Sep 2011 18:38:39 +0000 (14:38 -0400)
SVN-Revision: 3701

libarchive/test/test_read_format_mtree.c
libarchive/test/test_read_format_mtree.mtree.uu

index da525fb67e8cff6f7fcf07601580a339557e9a58..94265b20efd6a5652bf3ce0bde8f8b3ac6a83513 100644 (file)
@@ -33,7 +33,7 @@ test_read_format_mtree1(void)
        struct archive_entry *ae;
        struct archive *a;
        FILE *f;
-       // Compute min and max 64-bit signed twos-complement values
+       // Compute max 64-bit signed twos-complement value
        // without relying on overflow.  This assumes that long long
        // is at least 64 bits.
        const static long long max_int64 = ((((long long)1) << 62) - 1) + (((long long)1) << 62);
@@ -117,21 +117,25 @@ test_read_format_mtree1(void)
        assertEqualString(archive_entry_pathname(ae), "dir2/smallfile");
        assertEqualInt(archive_entry_size(ae), 1);
 
+       /* TODO: Mtree reader should probably return ARCHIVE_WARN for this. */
+       assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae));
+       assertEqualString(archive_entry_pathname(ae), "dir2/toosmallfile");
+       assertEqualInt(archive_entry_size(ae), -1);
+
        assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae));
        assertEqualString(archive_entry_pathname(ae), "dir2/bigfile");
        assertEqualInt(archive_entry_size(ae), max_int64);
 
-       /* Size of this file is actually max_int64 + 1, but that should
-        * overflow and be returned as max_int64. */
        assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae));
        assertEqualString(archive_entry_pathname(ae), "dir2/toobigfile");
+       /* Size in mtree is max_int64 + 1; should return max_int64. */
        assertEqualInt(archive_entry_size(ae), max_int64);
 
        assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae));
        assertEqualString(archive_entry_pathname(ae), "dir2/veryoldfile");
-       /* We can't know exact value here without knowing range of time_t. */
-       min_time = archive_entry_mtime(ae);
+       /* The value in the file is MIN_INT64_T, but time_t may be narrower. */
        /* Verify min_time is the smallest possible time_t. */
+       min_time = archive_entry_mtime(ae);
        assert(min_time <= 0);
        assert(min_time - 1 > 0);
 
@@ -142,7 +146,7 @@ test_read_format_mtree1(void)
        assertEqualInt(archive_entry_mtime(ae), min_time);
 
        assertEqualIntA(a, ARCHIVE_EOF, archive_read_next_header(a, &ae));
-       assertEqualInt(18, archive_file_count(a));
+       assertEqualInt(19, archive_file_count(a));
        assertEqualInt(ARCHIVE_OK, archive_read_close(a));
        assertEqualInt(ARCHIVE_OK, archive_read_free(a));
 }
index 993875fe70fbe2c5d05411f0524fc29a538d0963..a0dff18e442eff349653192ce928f7d6143814c0 100644 (file)
@@ -8,11 +8,11 @@ M"B!I;F1I<C(@='EP93UF:6QE"B!D:7(S8B!T>7!E/61I<@H@(&EN9&ER,V(@
 M='EP93UF:6QE"B`@+BX*("XN"FYO=&EN9&ER('1Y<&4]9FEL90ID:7(R+V9U
 M;&QI;F1I<C(@;6]D93TP-C0T"F1I<C(O96UP='EF:6QE('1Y<&4]9FEL92!S
 M:7IE/3!X,`ID:7(R+W-M86QL9FEL92!T>7!E/69I;&4@<VEZ93TP,#`P,#`P
-M,#`P,#`P,#`P,#`P,#`P,#`P,#`P,#$*9&ER,B]B:6=F:6QE('1Y<&4]9FEL
-M92!S:7IE/3DR,C,S-S(P,S8X-30W-S4X,#<*9&ER,B]T;V]B:6=F:6QE('1Y
-M<&4]9FEL92!S:7IE/3DR,C,S-S(P,S8X-30W-S4X,#@*9&ER,B]V97)Y;VQD
-M9FEL92!T>7!E/69I;&4@=&EM93TM.3(R,S,W,C`S-C@U-#<W-3@P.`ID:7(R
-M+W1O;V]L9&9I;&4@='EP93UF:6QE('1I;64]+3DR,C,S-S(P,S8X-30W-S4X
-$,#D*"@``
+M,#`P,#`P,#`P,#`P,#`P,#`P,#`P,#$*9&ER,B]T;V]S;6%L;&9I;&4@='EP
+M93UF:6QE('-I>F4]+3$*9&ER,B]B:6=F:6QE('1Y<&4]9FEL92!S:7IE/3DR
+M,C,S-S(P,S8X-30W-S4X,#<*9&ER,B]T;V]B:6=F:6QE('1Y<&4]9FEL92!S
+M:7IE/3DR,C,S-S(P,S8X-30W-S4X,#@*9&ER,B]V97)Y;VQD9FEL92!T>7!E
+M/69I;&4@=&EM93TM.3(R,S,W,C`S-C@U-#<W-3@P.`ID:7(R+W1O;V]L9&9I
+H;&4@='EP93UF:6QE('1I;64]+3DR,C,S-S(P,S8X-30W-S4X,#D*"@``
 `
 end