file_init_register(zip);
file_init_register_empty(zip);
- /* Set default compression type and level. */
+ /* Set default compression type and its level. */
+#if HAVE_LZMA_H
zip->opt_compression = _7Z_LZMA1;
+#elif defined(HAVE_BZLIB_H) && defined(BZ_CONFIG_ERROR)
+ zip->opt_compression = _7Z_BZIP2;
+#elif defined(HAVE_ZLIB_H)
+ zip->opt_compression = _7Z_DEFLATE;
+#else
+ zip->opt_compression = _7Z_COPY;
+#endif
zip->opt_compression_level = 6;
a->format_data = zip;
/* Create a new archive in memory. */
assert((a = archive_write_new()) != NULL);
assertEqualIntA(a, ARCHIVE_OK, archive_write_set_format_7zip(a));
- if (ARCHIVE_OK != archive_write_set_format_option(a, "7zip",
+ if (compression_type != NULL &&
+ ARCHIVE_OK != archive_write_set_format_option(a, "7zip",
"compression", compression_type)) {
skipping("%s writing not fully supported on this platform",
compression_type);
DEFINE_TEST(test_write_format_7zip)
{
+ /* Test that making a 7-Zip archive file by default compression
+ * in whatever compressions are supported on the running platform. */
+ test_basic(NULL);
/* Test that making a 7-Zip archive file without compression. */
test_basic("copy");
/* Test that making a 7-Zip archive file with deflate compression. */