You are viewing a plain text version of this content. The canonical link for it is here.
Posted to test-dev@httpd.apache.org by Gary Benson <gb...@redhat.com> on 2001/08/29 16:01:21 UTC
Core dump scan breaks exit() status
Hi all,
The core dump scanning bit in TestRun::install_sighandlers overwrites the
exit status, making t/TEST always return 0. This isn't too great if you
are calling it from a script ;-)
I'm not interested in fixing it -- I've got a bunch of c-modules to port
;-) -- but here's my take on the problem:
The change was made in revision 1.28 of TestRun.pm, if you want to have a
look at it yourself. I have no idea how to fix this in a nice way, short
of moving it into a wrapper that runs t/TEST, remembers the exit status,
then checks for coredumps afterwards and then exits accordingly.
Have fun,
Gary
[ Gary Benson, Red Hat Europe ][ gbenson@redhat.com ][ GnuPG 60E8793A ]
Re: Core dump scan breaks exit() status
Posted by Stas Bekman <st...@stason.org>.
> > > I see, try this patch (untested):
> >
> > I didn't realize that END {} is a block already :) here is a simpler patch
> > (still untested):
> >
> > 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.41
> > diff -u -r1.41 TestRun.pm
> > --- Apache-Test/lib/Apache/TestRun.pm 2001/08/27 05:55:17 1.41
> > +++ Apache-Test/lib/Apache/TestRun.pm 2001/08/29 15:49:48
> > @@ -221,6 +221,7 @@
> > #always run, a subclass might not want that
> >
> > eval "END {
> > + local $?; # preserve the exit status
> > eval {
> > Apache::TestRun->new(test_config =>
> > Apache::TestConfig->thaw)->scan;
>
> Stas, thanks, that worked a treat. May I request that you commit it?
committed.
_____________________________________________________________________
Stas Bekman JAm_pH -- Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide http://perl.apache.org/guide
mailto:stas@stason.org http://localhost/ http://eXtropia.com/
http://singlesheaven.com http://perl.apache.org http://perlmonth.com/
Re: Core dump scan breaks exit() status
Posted by Gary Benson <gb...@redhat.com>.
On Wed, 29 Aug 2001, Stas Bekman wrote:
> On Wed, 29 Aug 2001, Stas Bekman wrote:
>
> > > > > The change was made in revision 1.28 of TestRun.pm, if you want to have a
> > > > > look at it yourself. I have no idea how to fix this in a nice way, short
> > > > > of moving it into a wrapper that runs t/TEST, remembers the exit status,
> > > > > then checks for coredumps afterwards and then exits accordingly.
> > > >
> > > > I guess you are talking about the END block:
> > > >
> > > > eval "END {
> > > > eval {
> > > > Apache::TestRun->new(test_config =>
> > > > Apache::TestConfig->thaw)->scan;
> > > > };
> > > > }";
> > > >
> > > > but what exit status was it returning before? I don't think we have any
> > > > definition of the exit status definitions according to the tests success
> > > > or failure. Or do we?
> > >
> > > At the moment (or at least before that END block was there) it returns 1
> > > if something breaks.
> >
> > I see, try this patch (untested):
>
> I didn't realize that END {} is a block already :) here is a simpler patch
> (still untested):
>
> 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.41
> diff -u -r1.41 TestRun.pm
> --- Apache-Test/lib/Apache/TestRun.pm 2001/08/27 05:55:17 1.41
> +++ Apache-Test/lib/Apache/TestRun.pm 2001/08/29 15:49:48
> @@ -221,6 +221,7 @@
> #always run, a subclass might not want that
>
> eval "END {
> + local $?; # preserve the exit status
> eval {
> Apache::TestRun->new(test_config =>
> Apache::TestConfig->thaw)->scan;
Stas, thanks, that worked a treat. May I request that you commit it?
Gary
[ Gary Benson, Red Hat Europe ][ gbenson@redhat.com ][ GnuPG 60E8793A ]
Re: Core dump scan breaks exit() status
Posted by Stas Bekman <st...@stason.org>.
On Wed, 29 Aug 2001, Stas Bekman wrote:
> > > > The change was made in revision 1.28 of TestRun.pm, if you want to have a
> > > > look at it yourself. I have no idea how to fix this in a nice way, short
> > > > of moving it into a wrapper that runs t/TEST, remembers the exit status,
> > > > then checks for coredumps afterwards and then exits accordingly.
> > >
> > > I guess you are talking about the END block:
> > >
> > > eval "END {
> > > eval {
> > > Apache::TestRun->new(test_config =>
> > > Apache::TestConfig->thaw)->scan;
> > > };
> > > }";
> > >
> > > but what exit status was it returning before? I don't think we have any
> > > definition of the exit status definitions according to the tests success
> > > or failure. Or do we?
> >
> > At the moment (or at least before that END block was there) it returns 1
> > if something breaks.
>
> I see, try this patch (untested):
I didn't realize that END {} is a block already :) here is a simpler patch
(still untested):
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.41
diff -u -r1.41 TestRun.pm
--- Apache-Test/lib/Apache/TestRun.pm 2001/08/27 05:55:17 1.41
+++ Apache-Test/lib/Apache/TestRun.pm 2001/08/29 15:49:48
@@ -221,6 +221,7 @@
#always run, a subclass might not want that
eval "END {
+ local $?; # preserve the exit status
eval {
Apache::TestRun->new(test_config =>
Apache::TestConfig->thaw)->scan;
_____________________________________________________________________
Stas Bekman JAm_pH -- Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide http://perl.apache.org/guide
mailto:stas@stason.org http://apachetoday.com http://eXtropia.com/
http://singlesheaven.com http://perl.apache.org http://perlmonth.com/
Re: Core dump scan breaks exit() status
Posted by Stas Bekman <st...@stason.org>.
> > > The change was made in revision 1.28 of TestRun.pm, if you want to have a
> > > look at it yourself. I have no idea how to fix this in a nice way, short
> > > of moving it into a wrapper that runs t/TEST, remembers the exit status,
> > > then checks for coredumps afterwards and then exits accordingly.
> >
> > I guess you are talking about the END block:
> >
> > eval "END {
> > eval {
> > Apache::TestRun->new(test_config =>
> > Apache::TestConfig->thaw)->scan;
> > };
> > }";
> >
> > but what exit status was it returning before? I don't think we have any
> > definition of the exit status definitions according to the tests success
> > or failure. Or do we?
>
> At the moment (or at least before that END block was there) it returns 1
> if something breaks.
I see, try this patch (untested):
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.41
diff -u -r1.41 TestRun.pm
--- Apache-Test/lib/Apache/TestRun.pm 2001/08/27 05:55:17 1.41
+++ Apache-Test/lib/Apache/TestRun.pm 2001/08/29 15:28:02
@@ -221,10 +221,13 @@
#always run, a subclass might not want that
eval "END {
- eval {
- Apache::TestRun->new(test_config =>
- Apache::TestConfig->thaw)->scan;
- };
+ {
+ local $?; # preserve the exit status
+ eval {
+ Apache::TestRun->new(test_config =>
+ Apache::TestConfig->thaw)->scan;
+ };
+ }
}";
}
_____________________________________________________________________
Stas Bekman JAm_pH -- Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide http://perl.apache.org/guide
mailto:stas@stason.org http://apachetoday.com http://eXtropia.com/
http://singlesheaven.com http://perl.apache.org http://perlmonth.com/
Re: Core dump scan breaks exit() status
Posted by Gary Benson <gb...@redhat.com>.
On Wed, 29 Aug 2001, Stas Bekman wrote:
> On Wed, 29 Aug 2001, Gary Benson wrote:
>
> >
> > Hi all,
> >
> > The core dump scanning bit in TestRun::install_sighandlers overwrites the
> > exit status, making t/TEST always return 0. This isn't too great if you
> > are calling it from a script ;-)
> >
> > I'm not interested in fixing it -- I've got a bunch of c-modules to port
> > ;-) -- but here's my take on the problem:
> >
> > The change was made in revision 1.28 of TestRun.pm, if you want to have a
> > look at it yourself. I have no idea how to fix this in a nice way, short
> > of moving it into a wrapper that runs t/TEST, remembers the exit status,
> > then checks for coredumps afterwards and then exits accordingly.
>
> I guess you are talking about the END block:
>
> eval "END {
> eval {
> Apache::TestRun->new(test_config =>
> Apache::TestConfig->thaw)->scan;
> };
> }";
>
> but what exit status was it returning before? I don't think we have any
> definition of the exit status definitions according to the tests success
> or failure. Or do we?
At the moment (or at least before that END block was there) it returns 1
if something breaks.
Re: Core dump scan breaks exit() status
Posted by Stas Bekman <st...@stason.org>.
On Wed, 29 Aug 2001, Gary Benson wrote:
>
> Hi all,
>
> The core dump scanning bit in TestRun::install_sighandlers overwrites the
> exit status, making t/TEST always return 0. This isn't too great if you
> are calling it from a script ;-)
>
> I'm not interested in fixing it -- I've got a bunch of c-modules to port
> ;-) -- but here's my take on the problem:
>
> The change was made in revision 1.28 of TestRun.pm, if you want to have a
> look at it yourself. I have no idea how to fix this in a nice way, short
> of moving it into a wrapper that runs t/TEST, remembers the exit status,
> then checks for coredumps afterwards and then exits accordingly.
I guess you are talking about the END block:
eval "END {
eval {
Apache::TestRun->new(test_config =>
Apache::TestConfig->thaw)->scan;
};
}";
but what exit status was it returning before? I don't think we have any
definition of the exit status definitions according to the tests success
or failure. Or do we?
_____________________________________________________________________
Stas Bekman JAm_pH -- Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide http://perl.apache.org/guide
mailto:stas@stason.org http://apachetoday.com http://eXtropia.com/
http://singlesheaven.com http://perl.apache.org http://perlmonth.com/