aboutsummaryrefslogtreecommitdiff
path: root/contrib/libarchive/libarchive/test/test_read_format_7zip.c
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/libarchive/libarchive/test/test_read_format_7zip.c')
-rw-r--r--contrib/libarchive/libarchive/test/test_read_format_7zip.c111
1 files changed, 84 insertions, 27 deletions
diff --git a/contrib/libarchive/libarchive/test/test_read_format_7zip.c b/contrib/libarchive/libarchive/test/test_read_format_7zip.c
index 043ef9f4e532..62657a82165a 100644
--- a/contrib/libarchive/libarchive/test/test_read_format_7zip.c
+++ b/contrib/libarchive/libarchive/test/test_read_format_7zip.c
@@ -59,7 +59,7 @@ test_copy()
assertEqualIntA(a, ARCHIVE_EOF, archive_read_next_header(a, &ae));
/* Verify archive format. */
- assertEqualIntA(a, ARCHIVE_COMPRESSION_NONE, archive_compression(a));
+ assertEqualIntA(a, ARCHIVE_FILTER_NONE, archive_filter_code(a, 0));
assertEqualIntA(a, ARCHIVE_FORMAT_7ZIP, archive_format(a));
/* Close the archive. */
@@ -90,7 +90,7 @@ test_empty_archive()
assertEqualInt(0, archive_file_count(a));
/* Verify archive format. */
- assertEqualIntA(a, ARCHIVE_COMPRESSION_NONE, archive_compression(a));
+ assertEqualIntA(a, ARCHIVE_FILTER_NONE, archive_filter_code(a, 0));
assertEqualIntA(a, ARCHIVE_FORMAT_7ZIP, archive_format(a));
/* Close the archive. */
@@ -129,7 +129,7 @@ test_empty_file()
assertEqualIntA(a, ARCHIVE_EOF, archive_read_next_header(a, &ae));
/* Verify archive format. */
- assertEqualIntA(a, ARCHIVE_COMPRESSION_NONE, archive_compression(a));
+ assertEqualIntA(a, ARCHIVE_FILTER_NONE, archive_filter_code(a, 0));
assertEqualIntA(a, ARCHIVE_FORMAT_7ZIP, archive_format(a));
/* Close the archive. */
@@ -170,7 +170,7 @@ test_plain_header(const char *refname)
assertEqualIntA(a, ARCHIVE_EOF, archive_read_next_header(a, &ae));
/* Verify archive format. */
- assertEqualIntA(a, ARCHIVE_COMPRESSION_NONE, archive_compression(a));
+ assertEqualIntA(a, ARCHIVE_FILTER_NONE, archive_filter_code(a, 0));
assertEqualIntA(a, ARCHIVE_FORMAT_7ZIP, archive_format(a));
/* Close the archive. */
@@ -245,7 +245,7 @@ test_extract_all_files(const char *refname)
assertEqualIntA(a, ARCHIVE_EOF, archive_read_next_header(a, &ae));
/* Verify archive format. */
- assertEqualIntA(a, ARCHIVE_COMPRESSION_NONE, archive_compression(a));
+ assertEqualIntA(a, ARCHIVE_FILTER_NONE, archive_filter_code(a, 0));
assertEqualIntA(a, ARCHIVE_FORMAT_7ZIP, archive_format(a));
/* Close the archive. */
@@ -314,7 +314,7 @@ test_extract_last_file(const char *refname)
assertEqualIntA(a, ARCHIVE_EOF, archive_read_next_header(a, &ae));
/* Verify archive format. */
- assertEqualIntA(a, ARCHIVE_COMPRESSION_NONE, archive_compression(a));
+ assertEqualIntA(a, ARCHIVE_FILTER_NONE, archive_filter_code(a, 0));
assertEqualIntA(a, ARCHIVE_FORMAT_7ZIP, archive_format(a));
/* Close the archive. */
@@ -427,7 +427,7 @@ test_extract_all_files2(const char *refname)
assertEqualIntA(a, ARCHIVE_EOF, archive_read_next_header(a, &ae));
/* Verify archive format. */
- assertEqualIntA(a, ARCHIVE_COMPRESSION_NONE, archive_compression(a));
+ assertEqualIntA(a, ARCHIVE_FILTER_NONE, archive_filter_code(a, 0));
assertEqualIntA(a, ARCHIVE_FORMAT_7ZIP, archive_format(a));
/* Close the archive. */
@@ -481,7 +481,7 @@ test_delta_lzma(const char *refname)
assertEqualIntA(a, ARCHIVE_EOF, archive_read_next_header(a, &ae));
/* Verify archive format. */
- assertEqualIntA(a, ARCHIVE_COMPRESSION_NONE, archive_compression(a));
+ assertEqualIntA(a, ARCHIVE_FILTER_NONE, archive_filter_code(a, 0));
assertEqualIntA(a, ARCHIVE_FORMAT_7ZIP, archive_format(a));
/* Close the archive. */
@@ -535,7 +535,7 @@ test_bcj(const char *refname)
assertEqualIntA(a, ARCHIVE_EOF, archive_read_next_header(a, &ae));
/* Verify archive format. */
- assertEqualIntA(a, ARCHIVE_COMPRESSION_NONE, archive_compression(a));
+ assertEqualIntA(a, ARCHIVE_FILTER_NONE, archive_filter_code(a, 0));
assertEqualIntA(a, ARCHIVE_FORMAT_7ZIP, archive_format(a));
/* Close the archive. */
@@ -590,7 +590,7 @@ test_ppmd()
assertEqualIntA(a, ARCHIVE_EOF, archive_read_next_header(a, &ae));
/* Verify archive format. */
- assertEqualIntA(a, ARCHIVE_COMPRESSION_NONE, archive_compression(a));
+ assertEqualIntA(a, ARCHIVE_FILTER_NONE, archive_filter_code(a, 0));
assertEqualIntA(a, ARCHIVE_FORMAT_7ZIP, archive_format(a));
/* Close the archive. */
@@ -635,7 +635,7 @@ test_symname()
assertEqualIntA(a, ARCHIVE_EOF, archive_read_next_header(a, &ae));
/* Verify archive format. */
- assertEqualIntA(a, ARCHIVE_COMPRESSION_NONE, archive_compression(a));
+ assertEqualIntA(a, ARCHIVE_FILTER_NONE, archive_filter_code(a, 0));
assertEqualIntA(a, ARCHIVE_FORMAT_7ZIP, archive_format(a));
/* Close the archive. */
@@ -648,13 +648,24 @@ DEFINE_TEST(test_read_format_7zip)
{
struct archive *a;
- test_copy();
- test_empty_archive();
- test_empty_file();
- test_ppmd();
- test_bcj("test_read_format_7zip_bcj_copy.7z");
- test_bcj("test_read_format_7zip_bcj2_copy_1.7z");
- test_bcj("test_read_format_7zip_bcj2_copy_2.7z");
+ assert((a = archive_read_new()) != NULL);
+
+ /* Extracting with liblzma */
+ if (ARCHIVE_OK != archive_read_support_filter_xz(a)) {
+ skipping("7zip:lzma decoding is not supported on this platform");
+ } else {
+ test_symname();
+ test_extract_all_files("test_read_format_7zip_copy_2.7z");
+ test_extract_last_file("test_read_format_7zip_copy_2.7z");
+ test_extract_all_files2("test_read_format_7zip_lzma1_lzma2.7z");
+ test_bcj("test_read_format_7zip_bcj2_copy_lzma.7z");
+ }
+ assertEqualInt(ARCHIVE_OK, archive_read_free(a));
+}
+
+DEFINE_TEST(test_read_format_7zip_bzip2)
+{
+ struct archive *a;
assert((a = archive_read_new()) != NULL);
@@ -667,37 +678,83 @@ DEFINE_TEST(test_read_format_7zip)
test_bcj("test_read_format_7zip_bcj2_bzip2.7z");
}
+ assertEqualInt(ARCHIVE_OK, archive_read_free(a));
+}
+
+DEFINE_TEST(test_read_format_7zip_copy)
+{
+ test_copy();
+ test_bcj("test_read_format_7zip_bcj_copy.7z");
+ test_bcj("test_read_format_7zip_bcj2_copy_1.7z");
+ test_bcj("test_read_format_7zip_bcj2_copy_2.7z");
+}
+
+DEFINE_TEST(test_read_format_7zip_deflate)
+{
+ struct archive *a;
+
+ assert((a = archive_read_new()) != NULL);
+
/* Extracting with libz */
if (ARCHIVE_OK != archive_read_support_filter_gzip(a)) {
- skipping("7zip:deflate decoding is not supported on this platform");
+ skipping(
+ "7zip:deflate decoding is not supported on this platform");
} else {
test_plain_header("test_read_format_7zip_deflate.7z");
test_bcj("test_read_format_7zip_bcj_deflate.7z");
test_bcj("test_read_format_7zip_bcj2_deflate.7z");
}
+ assertEqualInt(ARCHIVE_OK, archive_read_free(a));
+}
+
+DEFINE_TEST(test_read_format_7zip_empty)
+{
+ test_empty_archive();
+ test_empty_file();
+}
+
+DEFINE_TEST(test_read_format_7zip_lzma1)
+{
+ struct archive *a;
+
+ assert((a = archive_read_new()) != NULL);
+
/* Extracting with liblzma */
if (ARCHIVE_OK != archive_read_support_filter_xz(a)) {
skipping("7zip:lzma decoding is not supported on this platform");
} else {
- test_symname();
test_plain_header("test_read_format_7zip_lzma1.7z");
- test_plain_header("test_read_format_7zip_lzma2.7z");
- test_extract_all_files("test_read_format_7zip_copy_2.7z");
test_extract_all_files("test_read_format_7zip_lzma1_2.7z");
- test_extract_last_file("test_read_format_7zip_copy_2.7z");
test_extract_last_file("test_read_format_7zip_lzma1_2.7z");
- test_extract_all_files2("test_read_format_7zip_lzma1_lzma2.7z");
test_bcj("test_read_format_7zip_bcj_lzma1.7z");
- test_bcj("test_read_format_7zip_bcj_lzma2.7z");
- test_bcj("test_read_format_7zip_bcj2_copy_lzma.7z");
test_bcj("test_read_format_7zip_bcj2_lzma1_1.7z");
test_bcj("test_read_format_7zip_bcj2_lzma1_2.7z");
+ test_delta_lzma("test_read_format_7zip_delta_lzma1.7z");
+ }
+ assertEqualInt(ARCHIVE_OK, archive_read_free(a));
+}
+
+DEFINE_TEST(test_read_format_7zip_lzma2)
+{
+ struct archive *a;
+
+ assert((a = archive_read_new()) != NULL);
+
+ /* Extracting with liblzma */
+ if (ARCHIVE_OK != archive_read_support_filter_xz(a)) {
+ skipping("7zip:lzma decoding is not supported on this platform");
+ } else {
+ test_plain_header("test_read_format_7zip_lzma2.7z");
+ test_bcj("test_read_format_7zip_bcj_lzma2.7z");
test_bcj("test_read_format_7zip_bcj2_lzma2_1.7z");
test_bcj("test_read_format_7zip_bcj2_lzma2_2.7z");
- test_delta_lzma("test_read_format_7zip_delta_lzma1.7z");
test_delta_lzma("test_read_format_7zip_delta_lzma2.7z");
}
assertEqualInt(ARCHIVE_OK, archive_read_free(a));
}
+DEFINE_TEST(test_read_format_7zip_ppmd)
+{
+ test_ppmd();
+}