diff options
author | mm <mm@FreeBSD.org> | 2011-07-17 21:42:22 +0000 |
---|---|---|
committer | mm <mm@FreeBSD.org> | 2011-07-17 21:42:22 +0000 |
commit | 84c56da91a08ce9f1a669fa732a156e36b3ad358 (patch) | |
tree | e2aa60b473bd88d42e965988a7bd13041fd17954 /usr.bin/cpio/test/test_option_z.c | |
parent | 867c8ddd4db0c581c7d6f04f5317cdc34c07dd5c (diff) | |
download | FreeBSD-src-84c56da91a08ce9f1a669fa732a156e36b3ad358.zip FreeBSD-src-84c56da91a08ce9f1a669fa732a156e36b3ad358.tar.gz |
Update bsdcpio to 2.8.4
Use common code from lib/libarchive/libarchive_fe
Approved by: kientzle
MFC after: 2 weeks
Diffstat (limited to 'usr.bin/cpio/test/test_option_z.c')
-rw-r--r-- | usr.bin/cpio/test/test_option_z.c | 29 |
1 files changed, 13 insertions, 16 deletions
diff --git a/usr.bin/cpio/test/test_option_z.c b/usr.bin/cpio/test/test_option_z.c index 2057912..91d37ac 100644 --- a/usr.bin/cpio/test/test_option_z.c +++ b/usr.bin/cpio/test/test_option_z.c @@ -28,32 +28,29 @@ __FBSDID("$FreeBSD$"); DEFINE_TEST(test_option_z) { char *p; - int fd; int r; size_t s; /* Create a file. */ - fd = open("f", O_CREAT | O_WRONLY, 0644); - assert(fd >= 0); - assertEqualInt(1, write(fd, "a", 1)); - close(fd); + assertMakeFile("f", 0644, "a"); /* Archive it with gzip compression. */ r = systemf("echo f | %s -oz >archive.out 2>archive.err", testprog); - failure("-z option seems to be broken"); - assertEqualInt(r, 0); - if (r == 0) { - p = slurpfile(&s, "archive.err"); - p[s] = '\0'; - if (strstr(p, "gzip compression not supported") != NULL) { + p = slurpfile(&s, "archive.err"); + p[s] = '\0'; + if (r != 0) { + if (strstr(p, "compression not available") != NULL) { skipping("This version of bsdcpio was compiled " "without gzip support"); - } else { - /* Check that the archive file has a gzip signature. */ - p = slurpfile(&s, "archive.out"); - assert(s > 2); - assertEqualMem(p, "\x1f\x8b\x08\x00", 4); + return; } + failure("-z option is broken"); + assertEqualInt(r, 0); + return; } + /* Check that the archive file has a gzip signature. */ + p = slurpfile(&s, "archive.out"); + assert(s > 4); + assertEqualMem(p, "\x1f\x8b\x08\x00", 4); } |