]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
Rework LZ4 option tests to work with various implementations of posix_spawnp
authorTim Kientzle <kientzle@acm.org>
Sun, 31 Jan 2016 21:22:47 +0000 (13:22 -0800)
committerTim Kientzle <kientzle@acm.org>
Sun, 31 Jan 2016 21:22:47 +0000 (13:22 -0800)
cpio/test/test_option_lz4.c
tar/test/test_option_lz4.c

index 75704467bb26cb472ae94a7902d09c24d3b67317..d430ac755f4f96803e91c87498ed151f525ebb19 100644 (file)
@@ -45,9 +45,21 @@ DEFINE_TEST(test_option_lz4)
                            "without lz4 support");
                        return;
                }
-               if (strstr(p, "Can't launch") != NULL
-                   && !canLz4()) {
-                       skipping("This version of bsdtar uses an external lz4 program "
+               /* POSIX permits different handling of the spawnp
+                * system call used to launch the subsidiary
+                * program: */
+               /* Some systems fail immediately to spawn the new process. */
+               if (strstr(p, "Can't launch") != NULL && !canLz4()) {
+                       skipping("This version of bsdcpio uses an external lz4 program "
+                           "but no such program is available on this system.");
+                       return;
+               }
+               /* Some systems successfully spawn the new process,
+                * but fail to exec a program within that process.
+                * This results in failure at the first attempt to
+                * write. */
+               if (strstr(p, "Can't write") != NULL && !canLz4()) {
+                       skipping("This version of bsdcpio uses an external lz4 program "
                            "but no such program is available on this system.");
                        return;
                }
index 972abaa6a32bc0d74235e5e165087314144b68ad..5dc945216300b63c81b245914ed24c16e9acb59b 100644 (file)
@@ -45,8 +45,20 @@ DEFINE_TEST(test_option_lz4)
                            "without lz4 support");
                        return;
                }
-               if (strstr(p, "Can't launch") != NULL
-                   && !canLz4()) {
+               /* POSIX permits different handling of the spawnp
+                * system call used to launch the subsidiary
+                * program: */
+               /* Some systems fail immediately to spawn the new process. */
+               if (strstr(p, "Can't launch") != NULL && !canLz4()) {
+                       skipping("This version of bsdtar uses an external lz4 program "
+                           "but no such program is available on this system.");
+                       return;
+               }
+               /* Some systems successfully spawn the new process,
+                * but fail to exec a program within that process.
+                * This results in failure at the first attempt to
+                * write. */
+               if (strstr(p, "Can't write") != NULL && !canLz4()) {
                        skipping("This version of bsdtar uses an external lz4 program "
                            "but no such program is available on this system.");
                        return;