dougm 01/04/02 21:23:47
Modified: Apache-Test MANIFEST
Apache-Test/lib/Apache TestConfig.pm TestRun.pm
Apache-Test/t TEST
t TEST.PL
Added: Apache-Test/lib/Apache TestRunPerl.pm
Log:
rather that force users to subclass Apache::TestRun to turn off configure_modperl(),
add an Apache::TestRunPerl subclass of Apache::TestRun that adds the mod_perlish
configuration
Revision Changes Path
1.2 +1 -0 modperl-2.0/Apache-Test/MANIFEST
Index: MANIFEST
===================================================================
RCS file: /home/cvs/modperl-2.0/Apache-Test/MANIFEST,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- MANIFEST 2001/04/02 09:01:44 1.1
+++ MANIFEST 2001/04/03 04:23:43 1.2
@@ -5,6 +5,7 @@
lib/Apache/Test.pm
lib/Apache/TestRequest.pm
lib/Apache/TestRun.pm
+lib/Apache/TestRunPerl.pm
lib/Apache/TestServer.pm
lib/Apache/TestHandler.pm
lib/Apache/TestMM.pm
1.5 +7 -2 modperl-2.0/Apache-Test/lib/Apache/TestConfig.pm
Index: TestConfig.pm
===================================================================
RCS file: /home/cvs/modperl-2.0/Apache-Test/lib/Apache/TestConfig.pm,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- TestConfig.pm 2001/04/03 00:26:58 1.4
+++ TestConfig.pm 2001/04/03 04:23:44 1.5
@@ -214,7 +214,7 @@
else {
$args .= " $hash";
}
- $args .= "</$directive>";
+ $args .= "</$directive>\n";
}
elsif (ref($directive) eq 'ARRAY') {
$args = join "\n", @$directive;
@@ -247,7 +247,12 @@
my($self, $where, $out) = @_;
for (@{ $self->{"${where}_hooks"} }) {
- $self->$_();
+ if ((ref($_) and ref($_) eq 'CODE') or $self->can($_)) {
+ $self->$_();
+ }
+ else {
+ print "WARNING: cannot run configure hook: `$_'\n";
+ }
}
for (@{ $self->{$where} }) {
1.2 +1 -16 modperl-2.0/Apache-Test/lib/Apache/TestRun.pm
Index: TestRun.pm
===================================================================
RCS file: /home/cvs/modperl-2.0/Apache-Test/lib/Apache/TestRun.pm,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- TestRun.pm 2001/04/02 08:59:55 1.1
+++ TestRun.pm 2001/04/03 04:23:44 1.2
@@ -197,24 +197,9 @@
$test_config->postamble_register($postamble);
}
-sub configure_modperl {
- my $self = shift;
-
- my $test_config = $self->{test_config};
-
- $test_config->preamble_register(qw(configure_libmodperl));
-
- $test_config->postamble_register(qw(configure_inc
- configure_pm_tests
- configure_startup_pl));
-}
-
sub configure {
my $self = shift;
- return unless $self->{conf_opts}->{save}; #cache generated config
-
- $self->configure_modperl;
$self->configure_opts;
my $test_config = $self->{test_config};
@@ -301,7 +286,7 @@
$self->try_exit_opts;
- $self->configure;
+ $self->configure if $self->{conf_opts}->{save}; #cache generated config
$self->default_run_opts;
1.1 modperl-2.0/Apache-Test/lib/Apache/TestRunPerl.pm
Index: TestRunPerl.pm
===================================================================
package Apache::TestRunPerl;
use strict;
use warnings FATAL => 'all';
use Apache::TestRun ();
#subclass of Apache::TestRun that configures mod_perlish things
our @ISA = qw(Apache::TestRun);
sub configure_modperl {
my $self = shift;
my $test_config = $self->{test_config};
$test_config->preamble_register(qw(configure_libmodperl));
$test_config->postamble_register(qw(configure_inc
configure_pm_tests
configure_startup_pl));
}
sub configure {
my $self = shift;
$self->configure_modperl;
$self->SUPER::configure;
}
1;
1.2 +0 -2 modperl-2.0/Apache-Test/t/TEST
Index: TEST
===================================================================
RCS file: /home/cvs/modperl-2.0/Apache-Test/t/TEST,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- TEST 2001/04/02 09:01:24 1.1
+++ TEST 2001/04/03 04:23:45 1.2
@@ -11,6 +11,4 @@
our @ISA = qw(Apache::TestRun);
-sub configure_modperl {} #dont configure mod_perl for these tests
-
MyTest->new->run(@ARGV);
1.2 +2 -2 modperl-2.0/t/TEST.PL
Index: TEST.PL
===================================================================
RCS file: /home/cvs/modperl-2.0/t/TEST.PL,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- TEST.PL 2001/04/02 09:11:18 1.1
+++ TEST.PL 2001/04/03 04:23:46 1.2
@@ -5,6 +5,6 @@
use lib map { "$_/Apache-Test/lib" } qw(. ..);
-use Apache::TestRun ();
+use Apache::TestRunPerl ();
-Apache::TestRun->new->run(@ARGV);
+Apache::TestRunPerl->new->run(@ARGV);