libarchive/test/test_read_format_7zip_encryption.7z.uu \
libarchive/test/test_read_format_7zip_encryption_header.7z.uu \
libarchive/test/test_read_format_7zip_encryption_partially.7z.uu \
+ libarchive/test/test_read_format_7zip_extract_second.7z.uu \
libarchive/test/test_read_format_7zip_lzma1.7z.uu \
libarchive/test/test_read_format_7zip_lzma1_2.7z.uu \
libarchive/test/test_read_format_7zip_lzma1_lzma2.7z.uu \
assertEqualString("system", archive_entry_fflags_text(ae));
+ assertEqualInt(ARCHIVE_OK, archive_read_free(a));
+}
+
+DEFINE_TEST(test_read_format_7zip_extract_second)
+{
+ struct archive *a;
+ char buffer[256];
+
+ assert((a = archive_read_new()) != NULL);
+
+ if (ARCHIVE_OK != archive_read_support_filter_lzma(a)) {
+ skipping(
+ "7zip:lzma decoding is not supported on this platform");
+ assertEqualInt(ARCHIVE_OK, archive_read_free(a));
+ return;
+ }
+
+ assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_all(a));
+
+ /*
+ * The test archive has two files: first.txt which is a 65,536 file (the
+ * size of the uncompressed buffer), and second.txt which has contents
+ * we will validate. This test ensures we can skip first.txt and still
+ * be able to read the contents of second.txt
+ */
+ const char *refname = "test_read_format_7zip_extract_second.7z";
+ extract_reference_file(refname);
+
+ assertEqualIntA(a, ARCHIVE_OK,
+ archive_read_open_filename(a, refname, 10240));
+
+ struct archive_entry *ae;
+
+ assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae));
+ assertEqualString("first.txt", archive_entry_pathname(ae));
+
+ assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae));
+ assertEqualString("second.txt", archive_entry_pathname(ae));
+
+ assertEqualInt(23, archive_read_data(a, buffer, sizeof(buffer)));
+ assertEqualMem("This is from second.txt", buffer, 23);
+
assertEqualInt(ARCHIVE_OK, archive_read_free(a));
}
--- /dev/null
+begin 644 test_read_format_7zip_extract_second.7z\r
+M-WJ\KR<<``-N%=VX!@$````````B`````````*R\U.<`&`Q"DFIGO`[1,RO\\r
+MN,RA7-QU1L&_]O_/$0MMLIEBUR3'BDX@M2C-5'VG./-4,5@W3Q@*__^7_,[H\r
+MEO`DB'[ZI>@H2_E>/W.2G$$.P01-X!YN5";SS[3#7Z4Q1G/EF.0'^D*[S8&8\r
+M[FV9DYX7,SA%^.Q\'?__P!@`````@3,'K@_4WV/Q0A7VLXG$X?GH4=5W^`UM\r
+M$N_EX$)LE*?K$W5?WLP:X0T[Q%V^?A!0E\VZRBB,)(MO`C`LO[O!3(1YL)<:\r
+MJ."`';WU;>GP5',%Z=6?*/H9*Z)&\*!2^<F\P&>,RV`R30UOBH8+5.;;2IKF\r
+M0W://&'?"L?0L2!)`*]F30B0&/_'<4``%P9Z`0F`C``'"P$``2,#`0$%70``\r
+-@``,@*@*`6]FB2D`````\r
+`\r
+end\r