perl-test-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tors...@apache.org
Subject svn commit: r1004278 - /perl/Apache-Test/trunk/lib/Apache/TestRun.pm
Date Mon, 04 Oct 2010 15:10:50 GMT
Author: torsten
Date: Mon Oct  4 15:10:50 2010
New Revision: 1004278

URL: http://svn.apache.org/viewvc?rev=1004278&view=rev
Log:
"t/TEST -start-httpd" can be used to start the httpd. Later on one can use
"t/TEST -run-tests t/*.t" to perform the actual test run. Unfortunately, this 
2nd call overwrites the configuration. Normally, this should not be a problem 
because the same configuration should be generated. But it the server already 
runs and has port-based VHosts enabled those ports are already in use. So, the 
new config contains other ports. In my case '-start-httpd' has created a 
config that used ports 8529, 8530 and 8531. Then the '-run-tests' recreates 
the config but now it contains the ports 8529, 8532 and 8533. In my tests I 
then use for example

  Apache::TestRequest::module 'ssl';
  $sslhostport=Apache::TestRequest::hostport;

That reads the new/wrong config and the tests fail.

The patch mainly shifts the time when the config is saved a few steps further
in the program. split_test_args and die_on_invalid_args finish processing of
the command line and die if something is wrong. This is a good thing to do
before anything is saved (IMO).

default_run_opts then makes sure that at least one of -start-httpd,
-stop-httpd or -run-tests is specified. If nothing is given all 3 are set.

After that the new code checks if either -start-httpd or -configure is given. 
Only in these cases the config is written. Strictly speaking, the -configure 
check is not necessary because if only -configure is set -start-httpd is set 
by default_run_opts.

Modified:
    perl/Apache-Test/trunk/lib/Apache/TestRun.pm

Modified: perl/Apache-Test/trunk/lib/Apache/TestRun.pm
URL: http://svn.apache.org/viewvc/perl/Apache-Test/trunk/lib/Apache/TestRun.pm?rev=1004278&r1=1004277&r2=1004278&view=diff
==============================================================================
--- perl/Apache-Test/trunk/lib/Apache/TestRun.pm (original)
+++ perl/Apache-Test/trunk/lib/Apache/TestRun.pm Mon Oct  4 15:10:50 2010
@@ -716,9 +716,15 @@ sub run {
         $self->opt_clean(1);
     }
 
+    $self->split_test_args;
+
+    $self->die_on_invalid_args;
+
+    $self->default_run_opts;
+
     # if configure() fails for some reason before it has flushed the
     # config to a file, save it so -clean will be able to clean
-    unless ($self->{opts}->{clean}) {
+    if ($self->{opts}->{'start-httpd'} || $self->{opts}->{'configure'}) {
         eval { $self->configure };
         if ($@) {
             error "configure() has failed:\n$@";
@@ -734,12 +740,6 @@ sub run {
         exit_perl 1;
     }
 
-    $self->default_run_opts;
-
-    $self->split_test_args;
-
-    $self->die_on_invalid_args;
-
     $self->start unless $self->{opts}->{'no-httpd'};
 
     $self->run_tests;



Mime
View raw message