perl-test-commits mailing list archives

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

"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';

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/
--- perl/Apache-Test/trunk/lib/Apache/ (original)
+++ perl/Apache-Test/trunk/lib/Apache/ Mon Oct  4 15:10:50 2010
@@ -716,9 +716,15 @@ sub run {
+    $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'};

View raw message