]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
Merge pull request #2658 from stoeckmann/skip_tests
authorTim Kientzle <kientzle@acm.org>
Sun, 29 Jun 2025 02:14:17 +0000 (19:14 -0700)
committerMartin Matuska <martin@matuska.de>
Wed, 10 Sep 2025 08:18:05 +0000 (10:18 +0200)
Skip tests if respective support is missing

(cherry picked from commit 609d8122f1c5210c57bcf14ac35cd4622b8546b1)

25 files changed:
libarchive/archive_cryptor.c
libarchive/archive_cryptor_private.h
libarchive/archive_read_support_format_zip.c
libarchive/archive_write_set_format_zip.c
libarchive/test/test_archive_string_conversion.c
libarchive/test/test_read_filter_gzip_recursive.c
libarchive/test/test_read_format_7zip.c
libarchive/test/test_read_set_format.c
libarchive/test/test_write_filter_gzip.c
libarchive/test/test_write_filter_gzip_timestamp.c
unzip/test/test_C.c
unzip/test/test_L.c
unzip/test/test_P_encryption.c
unzip/test/test_basic.c
unzip/test/test_d.c
unzip/test/test_doubledash.c
unzip/test/test_glob.c
unzip/test/test_j.c
unzip/test/test_n.c
unzip/test/test_o.c
unzip/test/test_p.c
unzip/test/test_q.c
unzip/test/test_singlefile.c
unzip/test/test_t.c
unzip/test/test_x.c

index 1825af4dc5100c13b1341c6103dbb31cbd43c9aa..9f03f9ca6dd06bd7de683122e44334105b45385f 100644 (file)
@@ -151,7 +151,7 @@ pbkdf2_sha1(const char *pw, size_t pw_len, const uint8_t *salt,
        (void)rounds; /* UNUSED */
        (void)derived_key; /* UNUSED */
        (void)derived_key_len; /* UNUSED */
-       return -1; /* UNSUPPORTED */
+       return CRYPTOR_STUB_FUNCTION; /* UNSUPPORTED */
 }
 
 #endif
@@ -439,14 +439,14 @@ aes_ctr_init(archive_crypto_ctx *ctx, const uint8_t *key, size_t key_len)
        (void)ctx; /* UNUSED */
        (void)key; /* UNUSED */
        (void)key_len; /* UNUSED */
-       return -1;
+       return CRYPTOR_STUB_FUNCTION;
 }
 
 static int
 aes_ctr_encrypt_counter(archive_crypto_ctx *ctx)
 {
        (void)ctx; /* UNUSED */
-       return -1;
+       return CRYPTOR_STUB_FUNCTION;
 }
 
 static int
@@ -469,7 +469,7 @@ aes_ctr_update(archive_crypto_ctx *ctx, const uint8_t * const in,
        (void)out; /* UNUSED */
        (void)out_len; /* UNUSED */
        aes_ctr_encrypt_counter(ctx); /* UNUSED */ /* Fix unused function warning */
-       return -1;
+       return CRYPTOR_STUB_FUNCTION;
 }
 
 #else
index 45f7c61d2dfb2ad2ae3532653ceae4da21a50381..573a617e1f06c5bf9ae1e972c9bff7cc5f52ec0b 100644 (file)
@@ -178,6 +178,9 @@ typedef int archive_crypto_ctx;
 #define archive_encrypto_aes_ctr_release(ctx) \
   __archive_cryptor.encrypto_aes_ctr_release(ctx)
 
+/* Stub return value if no encryption support exists. */
+#define CRYPTOR_STUB_FUNCTION  -2
+
 /* Minimal interface to cryptographic functionality for internal use in
  * libarchive */
 struct archive_cryptor
index daf51933d687ac78cd5427a8ec8a6aeb3bb3e402..9abd55709e3fca645163150bb6b54a68db752655 100644 (file)
@@ -3015,8 +3015,8 @@ init_WinZip_AES_decryption(struct archive_read *a)
                    p, salt_len, 1000, derived_key, key_len * 2 + 2);
                if (r != 0) {
                        archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
-                           "Decryption is unsupported due to lack of "
-                           "crypto library");
+                           r == CRYPTOR_STUB_FUNCTION ? "Decryption is unsupported due "
+                               "to lack of crypto library" : "Failed to process passphrase");
                        return (ARCHIVE_FAILED);
                }
 
index 3630b9f2b3a3ce91bd56afe8ce5198fd20b88290..ee69a922c73f9121c3b9c6d85755f84f133f8ab4 100644 (file)
@@ -2434,13 +2434,19 @@ init_winzip_aes_encryption(struct archive_write *a)
                    "Can't generate random number for encryption");
                return (ARCHIVE_FATAL);
        }
-       archive_pbkdf2_sha1(passphrase, strlen(passphrase),
+       ret = archive_pbkdf2_sha1(passphrase, strlen(passphrase),
            salt, salt_len, 1000, derived_key, key_len * 2 + 2);
+       if (ret != 0) {
+               archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
+                   ret == CRYPTOR_STUB_FUNCTION ? "Encryption is unsupported due to "
+                       "lack of crypto library" : "Failed to process passphrase");
+               return (ARCHIVE_FAILED);
+       }
 
        ret = archive_encrypto_aes_ctr_init(&zip->cctx, derived_key, key_len);
        if (ret != 0) {
                archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
-                   "Decryption is unsupported due to lack of crypto library");
+                   "Failed to initialize AES CTR mode");
                return (ARCHIVE_FAILED);
        }
        ret = archive_hmac_sha1_init(&zip->hctx, derived_key + key_len,
index 12976f3e70ecb45c445b041a6d8c192531f44456..055bddc750688e6293936515e7d9ea990809b6d5 100644 (file)
@@ -991,6 +991,7 @@ DEFINE_TEST(test_archive_string_update_utf8_koi8)
        static const char koi8_string[] = "\xD0\xD2\xC9";
        static const wchar_t wcs_string[] = L"\U0000043f\U00000440\U00000438";
        struct archive_mstring mstr;
+       struct archive *a;
        int r;
 
        memset(&mstr, 0, sizeof(mstr));
@@ -999,6 +1000,15 @@ DEFINE_TEST(test_archive_string_update_utf8_koi8)
                skipping("KOI8-R locale not available on this system.");
                return;
        }
+       a = archive_write_new();
+       assertEqualInt(ARCHIVE_OK, archive_write_set_format_pax(a));
+       if (archive_write_set_options(a, "hdrcharset=UTF-8") != ARCHIVE_OK) {
+               skipping("This system cannot convert character-set"
+                   " from KOI8-R to UTF-8.");
+               archive_write_free(a);
+               return;
+       }
+       archive_write_free(a);
 
        r = archive_mstring_update_utf8(NULL, &mstr, utf8_string);
 
index 0042a0511d5af50d48a85455c4b14d8417918326..51b614b6c023bf9ececec62f62e0edd1d505c980 100644 (file)
@@ -29,8 +29,8 @@ DEFINE_TEST(test_read_filter_gzip_recursive)
        const char *name = "test_read_filter_gzip_recursive.gz";
        struct archive *a;
 
-       if (!canGzip()) {
-               skipping("gzip not available");
+       if (archive_zlib_version() == NULL) {
+               skipping("zlib not available");
                return;
        }
 
index ad10ef06bbc5bf42dd7cdbe61e4a2352564e14ce..3236fee2c9d34b16a27e671d3b1bfd6c4e24dc42 100644 (file)
@@ -1285,19 +1285,26 @@ DEFINE_TEST(test_read_format_7zip_sfx_pe)
        const char test_txt[] = "123";
        int size = sizeof(test_txt) - 1;
 
-       extract_reference_file(reffile);
        assert((a = archive_read_new()) != NULL);
-       assertA(0 == archive_read_support_filter_all(a));
-       assertA(0 == archive_read_support_format_all(a));
-       assertA(0 == archive_read_open_filename(a, reffile, bs));
 
-       assertA(0 == archive_read_next_header(a, &ae));
-       assertEqualString("test.txt.txt", archive_entry_pathname(ae));
+       if (ARCHIVE_OK != archive_read_support_filter_lzma(a)) {
+               skipping(
+                   "7zip:lzma decoding is not supported on this platform");
+       } else {
+               extract_reference_file(reffile);
+               assertA(0 == archive_read_support_filter_all(a));
+               assertA(0 == archive_read_support_format_all(a));
+               assertA(0 == archive_read_open_filename(a, reffile, bs));
 
-       assertA(size == archive_read_data(a, buff, size));
-       assertEqualMem(buff, test_txt, size);
+               assertA(0 == archive_read_next_header(a, &ae));
+               assertEqualString("test.txt.txt", archive_entry_pathname(ae));
+
+               assertA(size == archive_read_data(a, buff, size));
+               assertEqualMem(buff, test_txt, size);
+
+               assertEqualIntA(a, ARCHIVE_OK, archive_read_close(a));
+       }
 
-       assertEqualIntA(a, ARCHIVE_OK, archive_read_close(a));
        assertEqualInt(ARCHIVE_OK, archive_read_free(a));
 }
 
@@ -1316,19 +1323,26 @@ DEFINE_TEST(test_read_format_7zip_sfx_modified_pe)
        const char test_txt[] = "123";
        int size = sizeof(test_txt) - 1;
 
-       extract_reference_file(reffile);
        assert((a = archive_read_new()) != NULL);
-       assertA(0 == archive_read_support_filter_all(a));
-       assertA(0 == archive_read_support_format_all(a));
-       assertA(0 == archive_read_open_filename(a, reffile, bs));
 
-       assertA(0 == archive_read_next_header(a, &ae));
-       assertEqualString("test.txt.txt", archive_entry_pathname(ae));
+       if (ARCHIVE_OK != archive_read_support_filter_lzma(a)) {
+               skipping(
+                   "7zip:lzma decoding is not supported on this platform");
+       } else {
+               extract_reference_file(reffile);
+               assertA(0 == archive_read_support_filter_all(a));
+               assertA(0 == archive_read_support_format_all(a));
+               assertA(0 == archive_read_open_filename(a, reffile, bs));
+
+               assertA(0 == archive_read_next_header(a, &ae));
+               assertEqualString("test.txt.txt", archive_entry_pathname(ae));
+
+               assertA(size == archive_read_data(a, buff, size));
+               assertEqualMem(buff, test_txt, size);
 
-       assertA(size == archive_read_data(a, buff, size));
-       assertEqualMem(buff, test_txt, size);
+               assertEqualIntA(a, ARCHIVE_OK, archive_read_close(a));
+       }
 
-       assertEqualIntA(a, ARCHIVE_OK, archive_read_close(a));
        assertEqualInt(ARCHIVE_OK, archive_read_free(a));
 }
 
@@ -1346,20 +1360,27 @@ DEFINE_TEST(test_read_format_7zip_sfx_elf)
        const char test_txt[] = "123";
        int size = sizeof(test_txt) - 1;
 
-       extract_reference_file(reffile);
        assert((a = archive_read_new()) != NULL);
-       assertA(0 == archive_read_support_filter_all(a));
-       assertA(0 == archive_read_support_format_all(a));
-       assertA(0 == archive_read_open_filename(a, reffile, bs));
 
-       assertA(0 == archive_read_next_header(a, &ae));
-       assertEqualString("test.txt.txt", archive_entry_pathname(ae));
+       if (ARCHIVE_OK != archive_read_support_filter_lzma(a)) {
+               skipping(
+                   "7zip:lzma decoding is not supported on this platform");
+       } else {
+               extract_reference_file(reffile);
+               assertA(0 == archive_read_support_filter_all(a));
+               assertA(0 == archive_read_support_format_all(a));
+               assertA(0 == archive_read_open_filename(a, reffile, bs));
+
+               assertA(0 == archive_read_next_header(a, &ae));
+               assertEqualString("test.txt.txt", archive_entry_pathname(ae));
 
-       assertA(size == archive_read_data(a, buff, size));
-       assertEqualMem(buff, test_txt, size);
+               assertA(size == archive_read_data(a, buff, size));
+               assertEqualMem(buff, test_txt, size);
 
-       assertEqualIntA(a, ARCHIVE_OK, archive_read_close(a));
-  assertEqualInt(ARCHIVE_OK, archive_read_free(a));
+               assertEqualIntA(a, ARCHIVE_OK, archive_read_close(a));
+       }
+
+       assertEqualInt(ARCHIVE_OK, archive_read_free(a));
 }
 
 DEFINE_TEST(test_read_format_7zip_extract_second)
@@ -1597,9 +1618,9 @@ DEFINE_TEST(test_read_format_7zip_lzma2_powerpc)
 
        assert((a = archive_read_new()) != NULL);
 
-       if (ARCHIVE_OK != archive_read_support_filter_gzip(a)) {
+       if (ARCHIVE_OK != archive_read_support_filter_lzma(a)) {
                skipping(
-                   "7zip:deflate decoding is not supported on this platform");
+                   "7zip:lzma decoding is not supported on this platform");
        } else {
                test_powerpc_filter("test_read_format_7zip_lzma2_powerpc.7z");
        }
index ad212b5cb71ef33b74ca71fa29e9a65896650d7d..615dd8ae8022b5bdc9edc2034853b05c5521aec3 100644 (file)
@@ -138,7 +138,10 @@ DEFINE_TEST(test_read_append_filter)
     assertEqualInt(ARCHIVE_OK, archive_read_free(a));
     return;
   }
-  assertEqualIntA(a, ARCHIVE_OK, r);
+  if (r == ARCHIVE_WARN && canGzip())
+    assertEqualString(archive_error_string(a), "Using external gzip program");
+  else
+    assertEqualIntA(a, ARCHIVE_OK, r);
   assertEqualInt(ARCHIVE_OK,
       archive_read_open_memory(a, archive, sizeof(archive)));
   assertEqualInt(ARCHIVE_OK, archive_read_next_header(a, &ae));
index 8fbdbed09744c6a68709888f6ab824fa3f521925..a6681d7618b12d8d15c952a916a5723a31bb8568 100644 (file)
@@ -166,9 +166,15 @@ DEFINE_TEST(test_write_filter_gzip)
        assertEqualInt(rbuff[0], 0x1f);
        assertEqualInt(rbuff[1], 0x8b);
        assertEqualInt(rbuff[2], 0x08);
-       assertEqualInt(rbuff[3], 0x08);
-       assertEqualInt(rbuff[8], 2); /* RFC 1952 flag for compression level 9 */
-       assertEqualString((const char*)rbuff+10, "testorgfilename");
+       /* RFC 1952 flag for compression level 9 */
+       assertEqualInt(rbuff[8], 2);
+       /* External gzip program might not save filename */
+       if (!use_prog || rbuff[3] == 0x08) {
+               assertEqualInt(rbuff[3], 0x08);
+               assertEqualString((const char*)rbuff+10, "testorgfilename");
+       } else {
+               assertEqualInt(rbuff[3], 0x00);
+       }
 
        /* Curiously, this test fails; the test data above compresses
         * better at default compression than at level 9. */
index a148f818dceca16bce932c323e6445df8df007d5..d0496b025b646c20f86ddffdc79f31bd20df0567 100644 (file)
@@ -81,8 +81,11 @@ DEFINE_TEST(test_write_filter_gzip_timestamp)
        archive_entry_free(ae);
        assertEqualIntA(a, ARCHIVE_OK, archive_write_close(a));
        assertEqualInt(ARCHIVE_OK, archive_write_free(a));
-       failure("Timestamp should be recorded");
-       assert(memcmp(buff + 4, "\x00\x00\x00\x00", 4) != 0);
+       /* External gzip program might not save timestamp */
+       if (!use_prog) {
+               failure("Timestamp should be recorded");
+               assert(memcmp(buff + 4, "\x00\x00\x00\x00", 4) != 0);
+       }
 
        /* Test2: set "gzip:!timestamp" option. */
        assert((a = archive_write_new()) != NULL);
index 66835c8406f37cadda4dc45c8a0328af99e35d15..d386bd61e85d0e17fcdbbf29475c2e484d162789 100644 (file)
@@ -9,6 +9,7 @@
 /* Test C arg - match case-insensitive */
 DEFINE_TEST(test_C)
 {
+#ifdef HAVE_LIBZ
        const char *reffile = "test_basic.zip";
        int r;
 
@@ -19,4 +20,7 @@ DEFINE_TEST(test_C)
        assertEmptyFile("test.err");
 
        assertTextFileContents("contents CAPS\n", "test_basic/CAPS");
+#else
+       skipping("zlib not available");
+#endif
 }
index 5b004d5d5707f9fdf6ab2eedb62295f77fab760c..85b43f592542be6ca879d594964166547fa1ce94 100644 (file)
@@ -9,6 +9,7 @@
 /* Test L arg - make names lowercase */
 DEFINE_TEST(test_L)
 {
+#ifdef HAVE_LIBZ
        const char *reffile = "test_basic.zip";
        int r;
 
@@ -22,4 +23,7 @@ DEFINE_TEST(test_L)
        assertTextFileContents("contents b\n", "test_basic/b");
        assertTextFileContents("contents c\n", "test_basic/c");
        assertTextFileContents("contents CAPS\n", "test_basic/caps");
+#else
+       skipping("zlib not available");
+#endif
 }
index e2cf3cda0ebd58e13793462d48c42ce27ac4b0b4..ed08a068811bf1579b39d446fb5c496316c96a14 100644 (file)
@@ -14,9 +14,13 @@ DEFINE_TEST(test_P_encryption)
 
        extract_reference_file(reffile);
        r = systemf("%s -P password %s >test.out 2>test.err", testprog, reffile);
-       assertEqualInt(0, r);
-       assertNonEmptyFile("test.out");
-       assertEmptyFile("test.err");
+       if (r == 256) {
+               assertTextFileContents("unzip: Decryption is unsupported due to lack of crypto library\n", "test.err");
+       } else {
+               assertEqualInt(0, r);
+               assertNonEmptyFile("test.out");
+               assertEmptyFile("test.err");
 
-       assertTextFileContents("plaintext\n", "encrypted/file.txt");
+               assertTextFileContents("plaintext\n", "encrypted/file.txt");
+       }
 }
index 1f37dcd416a39405be472519a4351109aae105de..3a884aa30e5d2a93f730fe1d6b403443a50fbf8c 100644 (file)
@@ -9,6 +9,7 @@
 /* This test just does a basic zip decompression */
 DEFINE_TEST(test_basic)
 {
+#ifdef HAVE_LIBZ
        const char *reffile = "test_basic.zip";
        int r;
 
@@ -22,4 +23,7 @@ DEFINE_TEST(test_basic)
        assertTextFileContents("contents b\n", "test_basic/b");
        assertTextFileContents("contents c\n", "test_basic/c");
        assertTextFileContents("contents CAPS\n", "test_basic/CAPS");
+#else
+       skipping("zlib not available");
+#endif
 }
index ea67246207f2e67ba86193f39f41fa06720c70fb..cd7c3dfd97ad04911246c96d7663451074f84c10 100644 (file)
@@ -9,6 +9,7 @@
 /* Test d arg - extract to target dir - before zipfile argument */
 DEFINE_TEST(test_d_before_zipfile)
 {
+#ifdef HAVE_LIBZ
        const char *reffile = "test_basic.zip";
        int r;
 
@@ -22,11 +23,15 @@ DEFINE_TEST(test_d_before_zipfile)
        assertTextFileContents("contents b\n", "foobar/test_basic/b");
        assertTextFileContents("contents c\n", "foobar/test_basic/c");
        assertTextFileContents("contents CAPS\n", "foobar/test_basic/CAPS");
+#else
+       skipping("zlib not available");
+#endif
 }
 
 /* Test d arg - extract to target dir - after zipfile argument */
 DEFINE_TEST(test_d_after_zipfile)
 {
+#ifdef HAVE_LIBZ
        const char *reffile = "test_basic.zip";
        int r;
 
@@ -40,4 +45,7 @@ DEFINE_TEST(test_d_after_zipfile)
        assertTextFileContents("contents b\n", "foobar/test_basic/b");
        assertTextFileContents("contents c\n", "foobar/test_basic/c");
        assertTextFileContents("contents CAPS\n", "foobar/test_basic/CAPS");
+#else
+       skipping("zlib not available");
+#endif
 }
index 4467213dbb8913c2f5c8953ad0feb6ca1dfada80..db0445ec3c24795c3e3213240330ca39486eccd9 100644 (file)
@@ -9,6 +9,7 @@
 /* Test double dash arg - swallow "--" and use next argument as file name  */
 DEFINE_TEST(test_doubledash)
 {
+#ifdef HAVE_LIBZ
        const char *reffile = "test_basic.zip";
        int r;
 
@@ -22,4 +23,7 @@ DEFINE_TEST(test_doubledash)
        assertTextFileContents("contents b\n", "test_basic/b");
        assertTextFileContents("contents c\n", "test_basic/c");
        assertTextFileContents("contents CAPS\n", "test_basic/CAPS");
+#else
+       skipping("zlib not available");
+#endif
 }
index b53aa16fd85c0cb4f4a1173da3223e2dd09dd45d..589ff1c55ef33136b3be98f6ca61cd84a2a34771 100644 (file)
@@ -9,6 +9,7 @@
 /* Test that the glob works */
 DEFINE_TEST(test_glob)
 {
+#ifdef HAVE_LIBZ
        const char *reffile = "test_basic.zip";
        int r;
 
@@ -22,4 +23,7 @@ DEFINE_TEST(test_glob)
        assertTextFileContents("contents b\n", "test_basic/b");
        assertFileNotExists("test_basic/c");
        assertFileNotExists("test_basic/CAPS");
+#else
+       skipping("zlib not available");
+#endif
 }
index b87229f42e2520e3888d23dee36e657a9b34c09e..1fba8ca207ec5c379e6980f68b12d07939bbef47 100644 (file)
@@ -9,6 +9,7 @@
 /* Test j arg - don't make directories */
 DEFINE_TEST(test_j)
 {
+#ifdef HAVE_LIBZ
        const char *reffile = "test_basic.zip";
        int r;
 
@@ -22,4 +23,7 @@ DEFINE_TEST(test_j)
        assertTextFileContents("contents b\n", "b");
        assertTextFileContents("contents c\n", "c");
        assertTextFileContents("contents CAPS\n", "CAPS");
+#else
+       skipping("zlib not available");
+#endif
 }
index bb75c5d7696dc09a3e3e826bbf48b52df062423f..a13623ce23dffa5929a9a79ce1c1eb39e55bf5b6 100644 (file)
@@ -9,6 +9,7 @@
 /* Test n arg - don't overwrite existing files */
 DEFINE_TEST(test_n)
 {
+#ifdef HAVE_LIBZ
        const char *reffile = "test_basic.zip";
        int r;
 
@@ -26,4 +27,7 @@ DEFINE_TEST(test_n)
        assertTextFileContents("orig b\n", "test_basic/b");
        assertTextFileContents("contents c\n", "test_basic/c");
        assertTextFileContents("contents CAPS\n", "test_basic/CAPS");
+#else
+       skipping("zlib not available");
+#endif
 }
index 64f9467744406f66b3e7c4fead32756a475f718a..8c48348c41a47d14320e321854d214f1eef38e4f 100644 (file)
@@ -9,6 +9,7 @@
 /* Test o arg - overwrite existing files */
 DEFINE_TEST(test_o)
 {
+#ifdef HAVE_LIBZ
        const char *reffile = "test_basic.zip";
        int r;
 
@@ -25,4 +26,7 @@ DEFINE_TEST(test_o)
        assertTextFileContents("contents b\n", "test_basic/b");
        assertTextFileContents("contents c\n", "test_basic/c");
        assertTextFileContents("contents CAPS\n", "test_basic/CAPS");
+#else
+       skipping("zlib not available");
+#endif
 }
index 8bfffbe5dc390c9799e5b0a74586eab27e9926e5..13a7765463ec2e0a7bee657941df61f09d74bc1d 100644 (file)
@@ -9,6 +9,7 @@
 /* Test p arg - Print to stdout */
 DEFINE_TEST(test_p)
 {
+#ifdef HAVE_LIBZ
        const char *reffile = "test_basic.zip";
        int r;
 
@@ -17,4 +18,7 @@ DEFINE_TEST(test_p)
        assertEqualInt(0, r);
        assertTextFileContents("contents a\ncontents b\ncontents c\ncontents CAPS\n", "test.out");
        assertEmptyFile("test.err");
+#else
+       skipping("zlib not available");
+#endif
 }
index 13222a48399229d27640fbfb2b7f4eb1c228fe97..0579e8028d76803d725473fd0050f873b53a346c 100644 (file)
@@ -9,6 +9,7 @@
 /* Test q arg - Quiet */
 DEFINE_TEST(test_q)
 {
+#ifdef HAVE_LIBZ
        const char *reffile = "test_basic.zip";
        int r;
 
@@ -22,4 +23,7 @@ DEFINE_TEST(test_q)
        assertTextFileContents("contents b\n", "test_basic/b");
        assertTextFileContents("contents c\n", "test_basic/c");
        assertTextFileContents("contents CAPS\n", "test_basic/CAPS");
+#else
+       skipping("zlib not available");
+#endif
 }
index a72811f046d96b730fe11955079b49cb7f8163ba..a5a35ecacc4d6c7d5a17fa3c64a4089dc03595b7 100644 (file)
@@ -9,6 +9,7 @@
 /* Ensure single-file zips work */
 DEFINE_TEST(test_singlefile)
 {
+#ifdef HAVE_LIBZ
        const char *reffile = "test_singlefile.zip";
        int r;
 
@@ -19,4 +20,7 @@ DEFINE_TEST(test_singlefile)
        assertEmptyFile("test.err");
 
        assertTextFileContents("hello\n", "file.txt");
+#else
+       skipping("zlib not available");
+#endif
 }
index 55a516fc636f5936335b2f017e3061c814ebdee3..7565830915c3ce83069fe6b1d1bcd1261d89cc07 100644 (file)
@@ -9,6 +9,7 @@
 /* Test t arg - Test zip contents */
 DEFINE_TEST(test_t)
 {
+#ifdef HAVE_LIBZ
        const char *reffile = "test_basic.zip";
        int r;
 
@@ -17,4 +18,7 @@ DEFINE_TEST(test_t)
        assertEqualInt(0, r);
        assertNonEmptyFile("test.out");
        assertEmptyFile("test.err");
+#else
+       skipping("zlib not available");
+#endif
 }
index 959beb1950dfafdb29bd615d761eee60a6b6335a..43a2085dc5b24b80c4defda592feafcd99b78351 100644 (file)
@@ -9,6 +9,7 @@
 /* Test x arg with single exclude path */
 DEFINE_TEST(test_x_single)
 {
+#ifdef HAVE_LIBZ
        const char *reffile = "test_basic.zip";
        int r;
 
@@ -22,11 +23,15 @@ DEFINE_TEST(test_x_single)
        assertTextFileContents("contents b\n", "test_basic/b");
        assertFileNotExists("test_basic/c");
        assertTextFileContents("contents CAPS\n", "test_basic/CAPS");
+#else
+       skipping("zlib not available");
+#endif
 }
 
 /* Test x arg with multiple exclude paths */
 DEFINE_TEST(test_x_multiple)
 {
+#ifdef HAVE_LIBZ
        const char *reffile = "test_basic.zip";
        int r;
 
@@ -40,11 +45,15 @@ DEFINE_TEST(test_x_multiple)
        assertFileNotExists("test_basic/b");
        assertFileNotExists("test_basic/c");
        assertTextFileContents("contents CAPS\n", "test_basic/CAPS");
+#else
+       skipping("zlib not available");
+#endif
 }
 
 /* Test x arg with multiple exclude paths and a d arg afterwards */
 DEFINE_TEST(test_x_multiple_with_d)
 {
+#ifdef HAVE_LIBZ
        const char *reffile = "test_basic.zip";
        int r;
 
@@ -58,4 +67,7 @@ DEFINE_TEST(test_x_multiple_with_d)
        assertFileNotExists("foobar/test_basic/b");
        assertFileNotExists("foobar/test_basic/c");
        assertTextFileContents("contents CAPS\n", "foobar/test_basic/CAPS");
+#else
+       skipping("zlib not available");
+#endif
 }