]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
unzip: Pass test if encryption support is missing
authorTobias Stoeckmann <tobias@stoeckmann.org>
Mon, 2 Jun 2025 19:38:11 +0000 (21:38 +0200)
committerTobias Stoeckmann <tobias@stoeckmann.org>
Tue, 3 Jun 2025 15:27:48 +0000 (17:27 +0200)
If no encryption support exists, the -P option will always fail.
"Skip" the test by making sure that there really is no encryption
support according to libarchive functions.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
unzip/test/test_P_encryption.c

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");
+       }
 }