summaryrefslogtreecommitdiffstats
path: root/lib/libarchive/test/test_read_format_tbz.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_tbz.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_tbz.c')
-rw-r--r--lib/libarchive/test/test_read_format_tbz.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/lib/libarchive/test/test_read_format_tbz.c b/lib/libarchive/test/test_read_format_tbz.c
index 3b44592..3d0e474 100644
--- a/lib/libarchive/test/test_read_format_tbz.c
+++ b/lib/libarchive/test/test_read_format_tbz.c
@@ -35,25 +35,31 @@ static unsigned char archive[] = {
DEFINE_TEST(test_read_format_tbz)
{
-#if HAVE_BZLIB_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 BZIP2 compression check: "
+ "This version of libarchive was compiled "
+ "without bzip2 support");
+ goto finish;
+ }
+ assert(0 == r);
assert(archive_compression(a) == ARCHIVE_COMPRESSION_BZIP2);
assert(archive_format(a) == ARCHIVE_FORMAT_TAR_USTAR);
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 bzlib");
-#endif
}
OpenPOWER on IntegriCloud