dougm 00/12/19 22:34:20 Modified: . Changes lib/Apache test.pm Log: various Apache::test enhancements and fixes Revision Changes Path 1.550 +3 -0 modperl/Changes Index: Changes =================================================================== RCS file: /home/cvs/modperl/Changes,v retrieving revision 1.549 retrieving revision 1.550 diff -u -r1.549 -r1.550 --- Changes 2000/11/25 15:39:21 1.549 +++ Changes 2000/12/20 06:34:19 1.550 @@ -10,6 +10,9 @@ =item 1.24_02-dev +various Apache::test enhancements and fixes +[Ken Williams <[EMAIL PROTECTED]>, Dave Rolsky <[EMAIL PROTECTED]>] + Documenting the new PerlAddVar httpd.conf directive [Stas Bekman <[EMAIL PROTECTED]>] 1.21 +24 -8 modperl/lib/Apache/test.pm Index: test.pm =================================================================== RCS file: /home/cvs/modperl/lib/Apache/test.pm,v retrieving revision 1.20 retrieving revision 1.21 diff -u -r1.20 -r1.21 --- test.pm 2000/10/13 17:21:18 1.20 +++ test.pm 2000/12/20 06:34:20 1.21 @@ -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) { @@ -310,6 +320,10 @@ exit; } +sub have_httpd { + return -e 't/httpd'; +} + sub run { require Test::Harness; my $self = shift; @@ -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