aboutsummaryrefslogtreecommitdiffstats
path: root/libarchive/test/test_read_format_zip.c
diff options
context:
space:
mode:
Diffstat (limited to 'libarchive/test/test_read_format_zip.c')
-rw-r--r--libarchive/test/test_read_format_zip.c50
1 files changed, 50 insertions, 0 deletions
diff --git a/libarchive/test/test_read_format_zip.c b/libarchive/test/test_read_format_zip.c
index 04f7e98ccfcd..04dfecb015f8 100644
--- a/libarchive/test/test_read_format_zip.c
+++ b/libarchive/test/test_read_format_zip.c
@@ -916,3 +916,53 @@ DEFINE_TEST(test_read_format_zip_lzma_alone_leak)
* suite under Valgrind or ASan, the test runner won't return with
* exit code 0 in case if a memory leak. */
}
+
+DEFINE_TEST(test_read_format_zip_lzma_stream_end)
+{
+ const char *refname = "test_read_format_zip_lzma_stream_end.zipx";
+ struct archive *a;
+ struct archive_entry *ae;
+
+ assert((a = archive_read_new()) != NULL);
+ if (ARCHIVE_OK != archive_read_support_filter_lzma(a)) {
+ skipping("lzma reading not fully supported on this platform");
+ assertEqualInt(ARCHIVE_OK, archive_read_free(a));
+ return;
+ }
+ extract_reference_file(refname);
+
+ assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_zip(a));
+ assertEqualIntA(a, ARCHIVE_OK, archive_read_open_filename(a, refname, 37));
+ assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae));
+ assertEqualString("ZIP 6.3 (lzma)", archive_format_name(a));
+ assertEqualString("vimrc", archive_entry_pathname(ae));
+ assertEqualIntA(a, 0, extract_one(a, ae, 0xBA8E3BAA));
+ assertEqualIntA(a, ARCHIVE_EOF, archive_read_next_header(a, &ae));
+ assertEqualIntA(a, ARCHIVE_OK, archive_read_close(a));
+ assertEqualIntA(a, ARCHIVE_OK, archive_read_free(a));
+}
+
+DEFINE_TEST(test_read_format_zip_lzma_stream_end_blockread)
+{
+ const char *refname = "test_read_format_zip_lzma_stream_end.zipx";
+ struct archive *a;
+ struct archive_entry *ae;
+
+ assert((a = archive_read_new()) != NULL);
+ if (ARCHIVE_OK != archive_read_support_filter_lzma(a)) {
+ skipping("lzma reading not fully supported on this platform");
+ assertEqualInt(ARCHIVE_OK, archive_read_free(a));
+ return;
+ }
+ extract_reference_file(refname);
+
+ assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_zip(a));
+ assertEqualIntA(a, ARCHIVE_OK, archive_read_open_filename(a, refname, 37));
+ assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae));
+ assertEqualString("ZIP 6.3 (lzma)", archive_format_name(a));
+ assertEqualString("vimrc", archive_entry_pathname(ae));
+ assertEqualIntA(a, 0, extract_one_using_blocks(a, 13, 0xBA8E3BAA));
+ assertEqualIntA(a, ARCHIVE_EOF, archive_read_next_header(a, &ae));
+ assertEqualIntA(a, ARCHIVE_OK, archive_read_close(a));
+ assertEqualIntA(a, ARCHIVE_OK, archive_read_free(a));
+}