From: Michihiro NAKAJIMA Date: Thu, 19 Mar 2009 19:24:31 +0000 (-0400) Subject: Eliminate failing some tests at bsdcpio_test when the platform X-Git-Tag: v2.7.0~123 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=6f5a919a82120767407af00a414653dda9bce4b7;p=thirdparty%2Flibarchive.git Eliminate failing some tests at bsdcpio_test when the platform doesn't have a compression library such as gzip nor bzip2. SVN-Revision: 811 --- diff --git a/cpio/cpio.c b/cpio/cpio.c index df63630f6..7b4244daa 100644 --- a/cpio/cpio.c +++ b/cpio/cpio.c @@ -274,13 +274,23 @@ main(int argc, char *argv[]) break; #endif case 'y': /* tar convention */ +#if HAVE_LIBBZ2 cpio->compress = opt; +#else + cpio_warnc(0, "bzip2 compression not supported by " + "this version of bsdcpio"); +#endif break; case 'Z': /* tar convention */ cpio->compress = opt; break; case 'z': /* tar convention */ +#if HAVE_LIBZ cpio->compress = opt; +#else + cpio_warnc(0, "gzip compression not supported by " + "this version of bsdcpio"); +#endif break; default: usage(); diff --git a/cpio/test/test_option_y.c b/cpio/test/test_option_y.c index 407b52610..92280be2d 100644 --- a/cpio/test/test_option_y.c +++ b/cpio/test/test_option_y.c @@ -43,10 +43,17 @@ DEFINE_TEST(test_option_y) testprog); failure("-y (bzip) option seems to be broken"); if (assertEqualInt(r, 0)) { - 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); + p = slurpfile(&s, "archive.err"); + p[s] = '\0'; + if (strstr(p, "bzip2 compression not supported") != 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); + } } } diff --git a/cpio/test/test_option_z.c b/cpio/test/test_option_z.c index 15337a4ca..20579120e 100644 --- a/cpio/test/test_option_z.c +++ b/cpio/test/test_option_z.c @@ -44,9 +44,16 @@ DEFINE_TEST(test_option_z) failure("-z option seems to be broken"); assertEqualInt(r, 0); if (r == 0) { - /* Check that the archive file has a gzip signature. */ - p = slurpfile(&s, "archive.out"); - assert(s > 2); - assertEqualMem(p, "\x1f\x8b\x08\x00", 4); + p = slurpfile(&s, "archive.err"); + p[s] = '\0'; + if (strstr(p, "gzip compression not supported") != 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); + } } }