httpd-test-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stas Bekman <s...@stason.org>
Subject [patch] Re: Apache-Test breakage
Date Thu, 18 Oct 2001 05:31:53 GMT
Doug MacEachern wrote:


>>I think the break in the middle of config is important to fix, right?
> 
> yes.  the problem right now is if die() is thrown, files have been
> generated but the Apache::TestConfig object is not committed to
> t/conf/apache_test_config.pm.  so t/TEST -clean does not know about those
> generated files.  either a DESTROY or __DIE__ handler could probably be
> used to solve the problem.

__DIE__ is a mess to use and DESTROY cannot be easily used unless 
Apache::TestConfig is subclassed. I think the following is quite clean 
solution. I've tested it with breaking the configure by requiring all 
.pm files (if you remember the breakage I had while developing 
APACHE_TEST_CONFIGURE functionality)

So it works when you run ./t/TEST, but when you run 'make test', for 
some reason Makefile doesn't abort on exit from test_clean target, no 
matter if I put exit -1, 0 or 1, and proceeds with run_tests target. 
Does that have anything to do with the installed __DIE__ sighandler?

I suggest to review the code and get rid of the __DIE__ sighandler all 
together and instead wrap the relevant pieces of code in eval block. Are 
there any exception handling modules bundled in the core?

In any case I think this patch can be committed without relation to the 
__DIE__ issue.

-- 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.59
diff -u -r1.59 TestRun.pm
--- Apache-Test/lib/Apache/TestRun.pm	2001/10/17 02:56:24	1.59
+++ Apache-Test/lib/Apache/TestRun.pm	2001/10/18 05:14:11
@@ -483,7 +483,16 @@
          $self->opt_clean(1);
      }

-    $self->configure;
+    # if configure() fails for some reason before it has flushed the
+    # config to a file, save it so -clean will be able to clean
+    eval { $self->configure; };
+    if ($@) {
+        error "configure() has failed:\n$@";
+        warning "forcing Apache::TestConfig object save";
+        $self->{test_config}->save;
+        warning "run 't/TEST -clean' to clean up before continuing";
+        exit;
+    }

      if ($self->{opts}->{configure}) {
          warning "reconfiguration done";



_____________________________________________________________________
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://ticketmaster.com http://apacheweek.com
http://singlesheaven.com http://perl.apache.org http://perlmonth.com/


Mime
View raw message