From d838ef201ae321d3de89c83de39bc3b96b3bae8f Mon Sep 17 00:00:00 2001 From: Tim Kientzle Date: Sun, 31 Jan 2016 13:22:47 -0800 Subject: [PATCH] Rework LZ4 option tests to work with various implementations of posix_spawnp --- cpio/test/test_option_lz4.c | 18 +++++++++++++++--- tar/test/test_option_lz4.c | 16 ++++++++++++++-- 2 files changed, 29 insertions(+), 5 deletions(-) diff --git a/cpio/test/test_option_lz4.c b/cpio/test/test_option_lz4.c index 75704467b..d430ac755 100644 --- a/cpio/test/test_option_lz4.c +++ b/cpio/test/test_option_lz4.c @@ -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; } diff --git a/tar/test/test_option_lz4.c b/tar/test/test_option_lz4.c index 972abaa6a..5dc945216 100644 --- a/tar/test/test_option_lz4.c +++ b/tar/test/test_option_lz4.c @@ -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; -- 2.47.2