aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/libarchive/libarchive/test/test_read_set_format.c
diff options
context:
space:
mode:
authorMartin Matuska <mm@FreeBSD.org>2016-10-31 21:57:43 +0000
committerMartin Matuska <mm@FreeBSD.org>2016-10-31 21:57:43 +0000
commit431b48abcb66b60a5411bc295896c3d63eb05aa9 (patch)
tree3c759cbcc16f259f2113c5a838d25215689f7f23 /contrib/libarchive/libarchive/test/test_read_set_format.c
parent52948f29c218ce524a372a92b8e8fcf93f531f03 (diff)
downloadsrc-431b48abcb66b60a5411bc295896c3d63eb05aa9.tar.gz
src-431b48abcb66b60a5411bc295896c3d63eb05aa9.zip
MFC r307861:
Update libarchive to 3.2.2 Most of the post-3.2.1 fixes have already been merged. This update contains just the version bump and some fixes to the test framework.
Notes
Notes: svn path=/stable/10/; revision=308152
Diffstat (limited to 'contrib/libarchive/libarchive/test/test_read_set_format.c')
-rw-r--r--contrib/libarchive/libarchive/test/test_read_set_format.c29
1 files changed, 19 insertions, 10 deletions
diff --git a/contrib/libarchive/libarchive/test/test_read_set_format.c b/contrib/libarchive/libarchive/test/test_read_set_format.c
index d333269c2ee9..fb5e0047443a 100644
--- a/contrib/libarchive/libarchive/test/test_read_set_format.c
+++ b/contrib/libarchive/libarchive/test/test_read_set_format.c
@@ -133,11 +133,12 @@ DEFINE_TEST(test_read_append_filter)
assert((a = archive_read_new()) != NULL);
assertA(0 == archive_read_set_format(a, ARCHIVE_FORMAT_TAR));
r = archive_read_append_filter(a, ARCHIVE_FILTER_GZIP);
- if (r == ARCHIVE_WARN && !canGzip()) {
- skipping("gzip reading not fully supported on this platform");
+ if (r != ARCHIVE_OK && archive_zlib_version() == NULL && !canGzip()) {
+ skipping("gzip tests require zlib or working gzip command");
assertEqualInt(ARCHIVE_OK, archive_read_free(a));
return;
}
+ 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));
@@ -200,8 +201,11 @@ DEFINE_TEST(test_read_append_filter_wrong_program)
{
struct archive_entry *ae;
struct archive *a;
+#if !defined(_WIN32) || defined(__CYGWIN__)
+ FILE * fp;
int fd;
fpos_t pos;
+#endif
/*
* If we have "bunzip2 -q", try using that.
@@ -211,11 +215,13 @@ DEFINE_TEST(test_read_append_filter_wrong_program)
return;
}
+#if !defined(_WIN32) || defined(__CYGWIN__)
/* bunzip2 will write to stderr, redirect it to a file */
fflush(stderr);
fgetpos(stderr, &pos);
fd = dup(fileno(stderr));
- freopen("stderr1", "w", stderr);
+ fp = freopen("stderr1", "w", stderr);
+#endif
assert((a = archive_read_new()) != NULL);
assertA(0 == archive_read_set_format(a, ARCHIVE_FORMAT_TAR));
@@ -227,12 +233,15 @@ DEFINE_TEST(test_read_append_filter_wrong_program)
assertEqualIntA(a, ARCHIVE_WARN, archive_read_close(a));
assertEqualInt(ARCHIVE_OK, archive_read_free(a));
- /* restore stderr */
- fflush(stderr);
- dup2(fd, fileno(stderr));
- close(fd);
- clearerr(stderr);
- fsetpos(stderr, &pos);
-
+#if !defined(_WIN32) || defined(__CYGWIN__)
+ /* restore stderr and verify results */
+ if (fp != NULL) {
+ fflush(stderr);
+ dup2(fd, fileno(stderr));
+ close(fd);
+ clearerr(stderr);
+ fsetpos(stderr, &pos);
+ }
assertTextFileContents("bunzip2: (stdin) is not a bzip2 file.\n", "stderr1");
+#endif
}