summaryrefslogtreecommitdiffstats
path: root/lib/libarchive/test/test_read_format_gtar_gz.c
diff options
context:
space:
mode:
authorkientzle <kientzle@FreeBSD.org>2009-03-07 03:30:35 +0000
committerkientzle <kientzle@FreeBSD.org>2009-03-07 03:30:35 +0000
commit1fb91ed696ad16495fbca8611a7832a70911c333 (patch)
treed5059a444cacb39328ab0d1b11ea50326a262f9e /lib/libarchive/test/test_read_format_gtar_gz.c
parent6cf3aa0ad277135ba4eaae2d67de3d2f5375786f (diff)
downloadFreeBSD-src-1fb91ed696ad16495fbca8611a7832a70911c333.zip
FreeBSD-src-1fb91ed696ad16495fbca8611a7832a70911c333.tar.gz
Merge r335,653,676 from libarchive.googlecode.com: Instead of
conditioning tests on HAVE_ZLIB, etc, just ask libarchive for the service and handle the failure coming back from libarchive. This gives us better test coverage of common client usage where clients simply try to use libarchive services and handle the errors coming back instead of trying to second-guess which libarchive services are compiled in.
Diffstat (limited to 'lib/libarchive/test/test_read_format_gtar_gz.c')
-rw-r--r--lib/libarchive/test/test_read_format_gtar_gz.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/lib/libarchive/test/test_read_format_gtar_gz.c b/lib/libarchive/test/test_read_format_gtar_gz.c
index afced28..6d3b66d 100644
--- a/lib/libarchive/test/test_read_format_gtar_gz.c
+++ b/lib/libarchive/test/test_read_format_gtar_gz.c
@@ -34,25 +34,31 @@ static unsigned char archive[] = {
DEFINE_TEST(test_read_format_gtar_gz)
{
-#if HAVE_ZLIB_H
struct archive_entry *ae;
struct archive *a;
+ int r;
+
assert((a = archive_read_new()) != NULL);
assert(0 == archive_read_support_compression_all(a));
assert(0 == archive_read_support_format_all(a));
assert(0 == archive_read_open_memory(a, archive, sizeof(archive)));
- assert(0 == archive_read_next_header(a, &ae));
+ r = archive_read_next_header(a, &ae);
+ if (UnsupportedCompress(r, a)) {
+ skipping("Skipping GZIP compression check: "
+ "This version of libarchive was compiled "
+ "without gzip support");
+ goto finish;
+ }
+ assert(0 == r);
assert(archive_compression(a) == ARCHIVE_COMPRESSION_GZIP);
assert(archive_format(a) == ARCHIVE_FORMAT_TAR_GNUTAR);
assert(0 == archive_read_close(a));
+finish:
#if ARCHIVE_VERSION_NUMBER < 2000000
archive_read_finish(a);
#else
assert(0 == archive_read_finish(a));
#endif
-#else
- skipping("Need zlib");
-#endif
}
OpenPOWER on IntegriCloud