You are viewing a plain text version of this content. The canonical link for it is here.
Posted to test-dev@httpd.apache.org by Stas Bekman <st...@stason.org> on 2001/12/10 11:37:35 UTC
[patch] Apache::TestConfig::config_as_str
I was intergrating t/SMOKE.PL with httpd-test perlframework, and realized
that mod_perl is not required. Since we really want people to supply the
build info in the smoke tests so we can reproduce the problems, we need to
have the same method as ModPerl::Config::config_as_str in
Apache::TestConfig. So is the following OK? It doesn't depend on modperl.
Index: Apache-Test/lib/Apache/TestConfig.pm
===================================================================
RCS file: /home/cvs/httpd-test/perl-framework/Apache-Test/lib/Apache/TestConfig.pm,v
retrieving revision 1.92
diff -u -r1.92 TestConfig.pm
--- Apache-Test/lib/Apache/TestConfig.pm 2001/12/10 05:31:39 1.92
+++ Apache-Test/lib/Apache/TestConfig.pm 2001/12/10 10:13:59
@@ -1186,6 +1186,29 @@
close $fh or die "failed to write $file: $!";
}
+sub config_as_str {
+ my $cfg = '';
+ my $command = '';
+
+ # httpd opts
+ my $test_config = Apache::TestConfig->new;
+ if (my $httpd = $test_config->{vars}->{httpd}) {
+ $command = "$httpd -V";
+ $cfg .= "\n*** $command\n";
+ $cfg .= qx{$command};
+ } else {
+ $cfg .= "\n\n*** The httpd binary was not found\n";
+ }
+
+ # perl opts
+ my $perl = $^X;
+ $command = "$perl -V";
+ $cfg .= "\n\n*** $command\n";
+ $cfg .= qx{$command};
+
+ return $cfg;
+}
+
1;
=head1 NAME
and then I can change the TestSmoke.pm to do:
Index: Apache-Test/lib/Apache/TestSmoke.pm
===================================================================
RCS file: /home/cvs/httpd-test/perl-framework/Apache-Test/lib/Apache/TestSmoke.pm,v
retrieving revision 1.2
diff -u -r1.2 TestSmoke.pm
--- Apache-Test/lib/Apache/TestSmoke.pm 2001/12/10 06:32:57 1.2
+++ Apache-Test/lib/Apache/TestSmoke.pm 2001/12/10 10:16:34
@@ -4,7 +4,6 @@
use warnings FATAL => 'all';
use Apache::TestTrace;
-use ModPerl::Config ();
use Getopt::Long qw(GetOptions);
use Digest::MD5 ();
@@ -351,9 +350,8 @@
my $successes = $self->{total_reduction_successes};
my $reduction_stats = sprintf "%d/%d (%d%% success)",
$attempts, $successes, $successes / $attempts * 100;
+ my $cfg_as_str = $self->build_config_as_str;
- my $env = ModPerl::Config::config_as_str();
-
print $fh <<EOM;
$sep
Totals:
@@ -365,10 +363,29 @@
--- Ended at: $end_time ---
$sep
The smoke testing was run on the system with the following parameters:
-$env
+$cfg_as_str
EOM
close $fh;
}
+}
+
+sub build_config_as_str {
+ my($self) = @_;
+ my $cfg_as_str = '';
+
+ # retrieve the env build configuration info
+ eval {require ModPerl::Config;};
+ if ($@) {
+ # httpd/perl
+ require Apache::TestConfig;
+ $cfg_as_str = Apache::TestConfig::config_as_str();
+ }
+ else {
+ # mod_perl/httpd/perl build opts
+ $cfg_as_str = ModPerl::Config::config_as_str();
+ }
+
+ return $cfg_as_str;
}
sub kill_proc {
_____________________________________________________________________
Stas Bekman JAm_pH -- Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide http://perl.apache.org/guide
mailto:stas@stason.org http://ticketmaster.com http://apacheweek.com
http://singlesheaven.com http://perl.apache.org http://perlmonth.com/