libarchive/unzip/test/test_basic.c
Tobias Stoeckmann ac66e0bc42 Skip zlib tests if support is missing
If zlib is not supported, do not run tests to avoid false positives.

Also adjust tests to support latest gzip versions (1.10+) which store
less information for improved reproducibility. The gzip binary is
used as a fallback if zlib is not available.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
2025-06-03 17:27:48 +02:00

30 lines
739 B
C

/*
* SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2023 Adrian Vovk
* All rights reserved.
*/
#include "test.h"
/* This test just does a basic zip decompression */
DEFINE_TEST(test_basic)
{
#ifdef HAVE_LIBZ
const char *reffile = "test_basic.zip";
int r;
extract_reference_file(reffile);
r = systemf("%s %s >test.out 2>test.err", testprog, reffile);
assertEqualInt(0, r);
assertNonEmptyFile("test.out");
assertEmptyFile("test.err");
assertTextFileContents("contents a\n", "test_basic/a");
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
}