You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Ken Williams <ke...@forum.swarthmore.edu> on 2000/12/02 09:44:05 UTC
Apache::test patch
Meta-question: should I be sending patches to modperl-cvs, or modperl?
This patch does three things.
First, it allows the user to skip live-server testing by answering '!'
when asked to find an httpd binary.
Second, we now sense whether the given binary was compiled with mod_so.
If so, by default we look for LoadModule/AddModule directives in
httpd.conf, and if not we don't.
Third, extraneous quotes are trimmed from ServerRoot directives (Dave
Rolsky submitted this fix earlier).
===================================================================
--- lib/Apache/test.pm 2000/10/13 17:21:18 1.20
+++ lib/Apache/test.pm 2000/12/02 08:19:07
@@ -1,14 +1,15 @@
package Apache::test;
use strict;
-use vars qw(@EXPORT $USE_THREAD $USE_SFIO $PERL_DIR);
+use vars qw(@EXPORT $USE_THREAD $USE_SFIO $PERL_DIR @EXPORT_OK);
use Exporter ();
use Config;
use FileHandle ();
*import = \&Exporter::import;
-@EXPORT = qw(test fetch simple_fetch have_module skip_test
+@EXPORT = qw(test fetch simple_fetch have_module skip_test
$USE_THREAD $USE_SFIO $PERL_DIR WIN32 grab run_test);
+@EXPORT_OK = qw(have_httpd);
BEGIN {
if(not $ENV{MOD_PERL}) {
@@ -86,14 +87,15 @@
sub _ask {
# Just a function for asking the user questions
- my ($prompt, $default, $mustfind) = @_;
+ my ($prompt, $default, $mustfind, $canskip) = @_;
+ my $skip = defined $canskip ? " ('$canskip' to skip)" : '';
my $response;
do {
- print "$prompt [$default]: ";
+ print "$prompt [$default]$skip: ";
chomp($response = <STDIN>);
$response ||= $default;
- } until (!$mustfind || (-e $response || !print("$response not found\n")));
+ } until (!$mustfind || ($response eq $canskip) || (-e $response || !print("$response not found\n")));
return $response;
}
@@ -108,10 +110,16 @@
my $httpd = $ENV{'APACHE'} || which('apache') || which('httpd') || '/usr/lib/httpd/httpd';
- $httpd = _ask("\n", $httpd, 1);
+ $httpd = _ask("\n", $httpd, 1, '!');
+ if ($httpd eq '!') {
+ print "Skipping.\n";
+ return;
+ }
system "$Config{lns} $httpd t/httpd";
- if (lc _ask("Search existing config file for dynamic module dependencies?", 'n') eq 'y') {
+ # Default: search for dynamic dependencies if mod_so is present, don't bother otherwise.
+ my $default = (`t/httpd -l` =~ /mod_so\.c/ ? 'y' : 'n');
+ if (lc _ask("Search existing config file for dynamic module dependencies?", $default) eq 'y') {
my %compiled;
for (`t/httpd -V`) {
if (/([\w]+)="(.*)"/) {
@@ -148,6 +156,8 @@
my @modules = grep /^\s*(Add|Load)Module/, @lines;
my ($server_root) = (map /^\s*ServerRoot\s*(\S+)/, @lines);
+ $server_root =~ s/^"//;
+ $server_root =~ s/"$//;
# Rewrite all modules to load from an absolute path.
foreach (@modules) {
@@ -308,6 +318,10 @@
sub skip_test {
print "1..0\n";
exit;
+}
+
+sub have_httpd {
+ return -e 't/httpd';
}
sub run {
@@ -514,7 +528,9 @@
*MY::test = sub { Apache::test->MM_test(%params) };
# In t/*.t script (or test.pl)
- (Some methods of Doug's that I haven't reviewed or documented yet)
+ use Apache::test qw(skip_test have_httpd);
+ skip_test unless have_httpd;
+ (Some more methods of Doug's that I haven't reviewed or documented yet)
=head1 DESCRIPTION
===================================================================
------------------- -------------------
Ken Williams Last Bastion of Euclidity
ken@forum.swarthmore.edu The Math Forum
Re: Apache::test patch
Posted by Doug MacEachern <do...@covalent.net>.
On Sat, 2 Dec 2000, Ken Williams wrote:
> Meta-question: should I be sending patches to modperl-cvs, or modperl?
here or to dev@perl.apache.org
> This patch does three things.
applied, thanks!