Hi everyone,
When building parrot on my iBook, two tests that depend on PCRE failed
because I don't have PCRE installed and the code that determines if
PCRE is installed is faulty. Parrot::Test::run_command returns [SIGNAL
$exit_code] if the exit code of the commands are not divisible by 256,
or if one of commands that needs to be run is not found. Attached is a
patch for both t/library/pcre.t and t/examples/library.t, the only
places where Parrot::Test::run_command is used in the test suite. With
the patch, the tests are correctly skipped.
- David
--
"Where is human nature so weak as in the bookstore?"
-- Henry Ward Beecher
=== t/examples/library.t
==================================================================
--- t/examples/library.t (revision 32535)
+++ t/examples/library.t (local)
@@ -56,7 +56,10 @@
# Testing pcre.pir with a simple pattern, if we have PCRE
my $cmd = ($^O =~ /MSWin32/) ? "pcregrep --version" : "pcre-config --version";
-my $has_pcre = Parrot::Test::run_command($cmd, STDERR => File::Spec->devnull()
) == 0;
+
+# if the $cmd returns an exit code not divisible by 255, "[SIGNAL exit_code]"
+# is returned. Using eq instead of ==
+my $has_pcre = 0 eq (Parrot::Test::run_command( $cmd, STDERR => '/dev/null' ));
SKIP:
{
skip( 'no pcre-config', 1 ) unless $has_pcre;
=== t/library/pcre.t
==================================================================
--- t/library/pcre.t (revision 32535)
+++ t/library/pcre.t (local)
@@ -27,10 +27,11 @@
# if we keep pcre, we need a config test
my $cmd = ($^O =~ /MSWin32/) ? "pcregrep --version" : "pcre-config --version";
-my $has_pcre = 0 == Parrot::Test::run_command(
- $cmd, STDERR => File::Spec->devnull,
-);
+# if the $cmd returns an exit code not divisible by 255, "[SIGNAL exit_code]"
+# is returned. Using eq instead of ==
+my $has_pcre = 0 eq Parrot::Test::run_command( $cmd, STDERR => '/dev/null');
+
SKIP: {
skip("no pcre-config", Test::Builder->new()->expected_tests())
unless $has_pcre;