summaryrefslogtreecommitdiffstats
path: root/usr.bin/cpio/test/test_option_y.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr.bin/cpio/test/test_option_y.c')
-rw-r--r--usr.bin/cpio/test/test_option_y.c30
1 files changed, 14 insertions, 16 deletions
diff --git a/usr.bin/cpio/test/test_option_y.c b/usr.bin/cpio/test/test_option_y.c
index 5cefaed..8e81ee7 100644
--- a/usr.bin/cpio/test/test_option_y.c
+++ b/usr.bin/cpio/test/test_option_y.c
@@ -28,32 +28,30 @@ __FBSDID("$FreeBSD$");
DEFINE_TEST(test_option_y)
{
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 bzip2 compression. */
r = systemf("echo f | %s -oy >archive.out 2>archive.err",
testprog);
- failure("-y (bzip) option seems to be broken");
- if (assertEqualInt(r, 0)) {
- p = slurpfile(&s, "archive.err");
- p[s] = '\0';
- if (strstr(p, "bzip2 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 bzip2 support");
- } else {
- assertTextFileContents("1 block\n", "archive.err");
- /* Check that the archive file has a bzip2 signature. */
- p = slurpfile(&s, "archive.out");
- assert(s > 2);
- assertEqualMem(p, "BZh9", 4);
+ return;
}
+ failure("-y option is broken");
+ assertEqualInt(r, 0);
+ return;
}
+ assertTextFileContents("1 block\n", "archive.err");
+ /* Check that the archive file has a bzip2 signature. */
+ p = slurpfile(&s, "archive.out");
+ assert(s > 2);
+ assertEqualMem(p, "BZh9", 4);
}
OpenPOWER on IntegriCloud