Rodent of Unusual Size wrote:
Stas Bekman wrote:
I've played with the returned status, so here is what I saw.
If you want to tell shell that the program has failed, you must return a status with at least one bit in the 0x01-0xff range set.
Yar, looking at 'man bash' and empirical results, it looks as though the exit value of a command is always ANDed with 0xff. And (for bash at least) an unhandled signal exit will result in an exit code of (0x80 + signum). For Linux, the maximum signal number is 63, so exit values in the range of 0x81-0xbf are reserved for signals.
So why don't we use an exit value of 200 to indicate a harness failure, and anything else comes from the tests themselves? This should also keep us clear of any untrapped die() calls, if I'm understanding the mechanism correctly.
OK, be it 0xC8 . Try this patch then:
Index: Apache-Test/lib/Apache/TestRun.pm
===================================================================
RCS file: /home/cvs/httpd-test/perl-framework/Apache-Test/lib/Apache/TestRun.pm,v
retrieving revision 1.85
diff -u -r1.85 TestRun.pm
--- Apache-Test/lib/Apache/TestRun.pm 16 Jan 2002 17:05:20 -0000 1.85
+++ Apache-Test/lib/Apache/TestRun.pm 22 Jan 2002 01:59:40 -0000
@@ -17,6 +17,10 @@
use Config;
use constant STARTUP_TIMEOUT => 300; # secs (good for extreme debug cases) + +# do 'exit_status && 200' to tell test failures from harness failures +use constant TEST_FAILED_MASK => 0xC8; + use subs qw(exit_shell exit_perl);
my %core_files = (); @@ -258,11 +262,17 @@
my($server, $opts) = ($self->{server}, $self->{opts});
+ # this handler gets usually invoked when one or more tests fail + # in Test::Harness::runtests() $SIG{__DIE__} = sub { return unless $_[0] =~ /^Failed/i; #dont catch Test::ok failures $server->stop(1) if $opts->{'start-httpd'}; $server->failed_msg("error running tests"); - exit_perl 0; + + # logically OR 0xff to the status, so we can distinguish + # harness failure from tests failure. it's possible that the + # failing test won't set a proper $? + exit_shell ($?||1) | TEST_FAILED_MASK; };
$SIG{INT} = sub {
_____________________________________________________________________ Stas Bekman JAm_pH -- Just Another mod_perl Hacker http://stason.org/ mod_perl Guide http://perl.apache.org/guide mailto:[EMAIL PROTECTED] http://ticketmaster.com http://apacheweek.com http://singlesheaven.com http://perl.apache.org http://perlmonth.com/