Author: stas
Date: Sun Dec 19 19:59:50 2004
New Revision: 122804

URL: http://svn.apache.org/viewcvs?view=rev&rev=122804
Log:
avoid entering endless loops when interactive config is used, by
restarting the test suite with an explicit selected arguments for
-httpd (and optionally -apxs)

Modified:
   httpd/test/trunk/perl-framework/Apache-Test/Changes
   httpd/test/trunk/perl-framework/Apache-Test/lib/Apache/TestRun.pm

Modified: httpd/test/trunk/perl-framework/Apache-Test/Changes
Url: 
http://svn.apache.org/viewcvs/httpd/test/trunk/perl-framework/Apache-Test/Changes?view=diff&rev=122804&p1=httpd/test/trunk/perl-framework/Apache-Test/Changes&r1=122803&p2=httpd/test/trunk/perl-framework/Apache-Test/Changes&r2=122804
==============================================================================
--- httpd/test/trunk/perl-framework/Apache-Test/Changes (original)
+++ httpd/test/trunk/perl-framework/Apache-Test/Changes Sun Dec 19 19:59:50 2004
@@ -8,6 +8,10 @@
   
 =item 1.18-dev
 
+avoid entering endless loops when interactive config is used, by
+restarting the test suite with an explicit selected arguments for
+-httpd (and optionally -apxs) [Stas]
+
 META.yml is now locally maintained. we need to tell PAUSE indexer not
 to try to index HTTP::Request::Common and warnings packages, which
 happen to be used by A-T [Stas]

Modified: httpd/test/trunk/perl-framework/Apache-Test/lib/Apache/TestRun.pm
Url: 
http://svn.apache.org/viewcvs/httpd/test/trunk/perl-framework/Apache-Test/lib/Apache/TestRun.pm?view=diff&rev=122804&p1=httpd/test/trunk/perl-framework/Apache-Test/lib/Apache/TestRun.pm&r1=122803&p2=httpd/test/trunk/perl-framework/Apache-Test/lib/Apache/TestRun.pm&r2=122804
==============================================================================
--- httpd/test/trunk/perl-framework/Apache-Test/lib/Apache/TestRun.pm   
(original)
+++ httpd/test/trunk/perl-framework/Apache-Test/lib/Apache/TestRun.pm   Sun Dec 
19 19:59:50 2004
@@ -42,6 +42,7 @@
 
 my $orig_command;
 my $orig_cwd;
+my $orig_conf_opts;
 
 my %core_files  = ();
 my %original_t_perms = ();
@@ -231,6 +232,7 @@
     my $req_wanted_args = Apache::TestRequest::wanted_args();
     my @argv = ();
     my %req_args = ();
+
     while (@ARGV) {
         my $val = shift @ARGV;
         if ($val =~ /^--?(.+)/) { # must have a leading - or --
@@ -249,6 +251,9 @@
         push @argv, $val;
     }
 
+    # save the orig args (make a deep copy)
+    $orig_conf_opts = { %conf_opts };
+
     # fixup the filepath options on win32 (spaces, short names, etc.)
     if (Apache::TestConfig::WIN32) {
         for my $key (keys %conf_opts) {
@@ -746,11 +751,32 @@
 }
 
 sub rerun {
+    my $vars = shift;
+
+    # in %$vars
+    # - httpd will be always set
+    # - apxs is optional
+
     $orig_cwd ||= Cwd::cwd();
     chdir $orig_cwd;
-    warning "rerunning '$orig_command' with new config opts";
+    my $new_opts = " -httpd $vars->{httpd}";
+    $new_opts .= " -apxs $vars->{apxs}" if $vars->{apxs};
+
+    my $new_command = $orig_command;
+
+    # strip any old bogus -httpd/-apxs
+    $new_command =~ s/--?httpd\s+$orig_conf_opts->{httpd}//
+        if $orig_conf_opts->{httpd};
+    $new_command =~ s/--?httpd\s+$orig_conf_opts->{httpd}//
+        if $orig_conf_opts->{httpd} and $vars->{apxs};
+
+    # add new opts
+    $new_command .= $new_opts;
+
+    warning "running with new config opts: $new_command";
+
     # use 'or die' to avoid warnings due to possible overrides of die
-    exec $orig_command or die "exec $orig_command has failed";
+    exec $new_command or die "exec $new_command has failed";
 }
 
 

Reply via email to