On Wed, 16 Jan 2002, Rodent of Unusual Size wrote:
> Stas Bekman wrote:
> >
> > But which bit is safe to OR with? 0x10 or 0x1000 as you've suggested?
>
> I would say 0x?000 -- values in the 0x01-0xff range get set from signals
> and errno, n'est-çe pas?
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. But if you set
any bits on the higher bits, it seems that shell masks these off. So I'm
not sure if you ever get to see them.
Assuming that modperl/readline test fails (without setting $? from the
test, so the default 1 is applied) and I run:
% t/TEST -v modperl/readline || echo "Failed $?"
I get:
Failed 1
and no high bits here. This is with the patch below. Please play with this
patch and tell me whether it does what you want, and if not how we should
change it.
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 - 1.85
+++ Apache-Test/lib/Apache/TestRun.pm 17 Jan 2002 03:34:05 -
@@ -258,11 +258,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 0x1000 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 ) | 0x1000 ;
};
$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/