#AUTHOR: Peter Tillemans # adapated for libapreq by Randy Kobes use strict; use Cwd; use Win32::Process; use Config; use File::Basename 'dirname'; # Config part my $apache = 'apache'; my $fullapache; SEARCH: { for my $drive ('C'..'G') { for my $p ('Apache', 'Program Files/Apache', 'Program Files/Apache Group/Apache') { if (-e "$drive:/$p/Apache.exe") { $fullapache = "$drive:/$p/Apache.exe"; last SEARCH; } } } } unless (-e $fullapache) { require ExtUtils::MakeMaker; ExtUtils::MakeMaker->import('prompt'); $fullapache = prompt("Where is your apache.exe located?", $fullapache); } die "Can't find apache.exe!" unless -e $fullapache; my $vers = qx{"$fullapache" -v}; die qq{"$fullapache" does not appear to be version 1.3} unless $vers =~ m!Apache/1.3!; my $ap_path = dirname $fullapache; $ENV{PATH} = join ";", $ap_path, $ENV{PATH}; my $fullperl = $Config{perlpath}; print "Running tests with:\n"; print " perl=$fullperl\n apache=$fullapache\n"; my $port = 8228; $ENV{PORT} = $port; sub ErrorReport { print Win32::FormatMessage( Win32::GetLastError() ); } my $pwd = cwd(); # get tests opendir(DIR, 't') or die "Cannot opendir 't': $!"; my @tests = map {"t/$_"} grep {/\.t/} readdir DIR; closedir DIR; # start ourselves a server to pound on # my $HttpdObj; unshift(@INC, "$pwd/blib/lib", "$pwd/blib/arch"); Win32::Process::Create($HttpdObj, $fullapache, "$apache -X -d $pwd/t -f $pwd/t/httpd.conf", 0, NORMAL_PRIORITY_CLASS, ".") || die ErrorReport(); print "httpd listening on port $port\n"; print "will write error_log to: t/error_log\n"; print "letting apache warm up...\n"; sleep 2; print "done\n"; # # Ok, start pounding # #system "$fullperl t/TEST @ARGV"; use Test::Harness; runtests @tests; # stop server again $HttpdObj->Kill(-1); print "letting apache cool down...\n"; sleep 2;