]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
Eliminate failing some tests at bsdcpio_test when the platform
authorMichihiro NAKAJIMA <ggcueroad@gmail.com>
Thu, 19 Mar 2009 19:24:31 +0000 (15:24 -0400)
committerMichihiro NAKAJIMA <ggcueroad@gmail.com>
Thu, 19 Mar 2009 19:24:31 +0000 (15:24 -0400)
doesn't have a compression library such as gzip nor bzip2.

SVN-Revision: 811

cpio/cpio.c
cpio/test/test_option_y.c
cpio/test/test_option_z.c

index df63630f6b349c004c692abac2548cd3f9fa1eb8..7b4244daa1431c3e2325afbf6d66bf5722d76664 100644 (file)
@@ -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();
index 407b526105d7e4159c31207b0e6088215e491490..92280be2dfad3fc687eb0cf75d78ebe114f4226b 100644 (file)
@@ -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);
+               }
        }
 }
index 15337a4ca15bd5b8d5cdece91f092b7d5c86e09b..20579120e785b5c64166b7aa62bfad2fbf049225 100644 (file)
@@ -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);
+               }
        }
 }