You are viewing a plain text version of this content. The canonical link for it is here.
Posted to test-commits@perl.apache.org by to...@apache.org on 2010/10/04 17:10:50 UTC

svn commit: r1004278 - /perl/Apache-Test/trunk/lib/Apache/TestRun.pm

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;



Fwd: svn commit: r1004278 - /perl/Apache-Test/trunk/lib/Apache/TestRun.pm

Posted by Fred Moyer <fr...@redhotpenguin.com>.
Torsten you should add an accompanying changelog entry for these.


---------- Forwarded message ----------
From:  <to...@apache.org>
Date: Mon, Oct 4, 2010 at 8:10 AM
Subject: svn commit: r1004278 - /perl/Apache-Test/trunk/lib/Apache/TestRun.pm
To: test-commits@perl.apache.org


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;

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org