cvs commit: modperl/t TEST.win32
randyk 2003/07/12 16:11:56 Modified:tTEST.win32 Log: remove some blank lines Revision ChangesPath 1.5 +18 -56modperl/t/TEST.win32 Index: TEST.win32 === RCS file: /home/cvs/modperl/t/TEST.win32,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- TEST.win3231 Dec 2000 19:34:16 - 1.4 +++ TEST.win3212 Jul 2003 23:11:56 - 1.5 @@ -1,27 +1,18 @@ #AUTHOR: Peter Tillemans <[EMAIL PROTECTED]> use Cwd; - use File::Copy; - use File::Find; - use Win32::Process; - use Win32; - use Config; - use File::Basename 'dirname'; # - # Config part - # $apache = "apache"; - SEARCH: { for my $drive ('c'..'g') { for my $p ("program files\\apache", "apache") { @@ -35,7 +26,6 @@ ExtUtils::MakeMaker->import('prompt'); $fullapache = prompt("Where is your apache.exe located ?", $fullapache); } - die "Can't find apache.exe!" unless -e $fullapache; my $ap_path = dirname $fullapache; @@ -45,38 +35,30 @@ print "Running tests with:\n"; print " perl=$fullperl\n apache=$fullapache\n"; - $port = 8529; sub ErrorReport { - -print Win32::FormatMessage( Win32::GetLastError() ); - +print Win32::FormatMessage( Win32::GetLastError() ); } - # - # prepare config files - # chdir "t/conf"; - copy("httpd.conf-win32", "httpd.conf");# PTI: unless -f httpd.conf; - chdir "../net"; #copy("config.pl.win32", "config.pl");# PTI: unless -f config.pl; - chdir "../.."; +# #source or binary distribution +# for (qw(src/modules/win32/Release src/modules/win32/Debug - win32/modules)) -{ + win32/modules)) { my $dll = "$_/mod_perl.so"; next unless -e $dll; copy $dll, "t/modules/mod_perl.so"; @@ -84,15 +66,13 @@ } # - # create some bogus files and a place to dump the logfiles - # mkdir("/tmp","755") unless -d "/tmp"; for my $d (qw(logs conf)) { - mkdir("t/$d","755") unless -d "t/$d"; +mkdir("t/$d","755") unless -d "t/$d"; } for my $f (qw(srm.conf access.conf mime.types)) { @@ -107,65 +87,47 @@ $pwd = cwd(); -# this is to make sure apache knows which files to take : apparently apache uner Win32 +# this is to make sure apache knows which files to take +# : apparently apache uner Win32 -# change directories to the installation directory so "./t" references do not work +# change directories to the installation directory so "./t" +# references do not work system "$fullperl -p -i.bak -e \"s#\\./t#$pwd/t#\" t/conf/httpd.conf"; # - # start ourselves a server to pound on - # Win32::Process::Create($HttpdObj, - -$fullapache, - -"$apache -X -d $pwd/t", - -0, - -NORMAL_PRIORITY_CLASS, - -".") || die ErrorReport(); - - + $fullapache, + "$apache -X -d $pwd/t", + 0, + NORMAL_PRIORITY_CLASS, + ".") || die ErrorReport(); print "httpd listening on port $port\n"; - print "will write error_log to: t/logs/mod_perl_error_log\n"; - print "letting apache warm up...\n"; - sleep 2; - print "done\n"; - # - # Ok, start pounding - # system "$fullperl t/TEST @ARGV"; - - +# # stop server again - +# $HttpdObj->Kill(-1); - +# # remove traces +# print "letting apache cool down...\n"; - sleep 2; - find(\&cleanup, '/tmp/'); - - sub cleanup {/^(mod_perl|CGItemp)/ && unlink($_)}
cvs commit: modperl/t TEST.win32
randyk 2003/07/12 16:17:33 Modified:tTEST.win32 Log: In finding Apache.exe, don't look on removeable drives, and verify that an Apache.exe found is version 1.3. Revision ChangesPath 1.6 +66 -17modperl/t/TEST.win32 Index: TEST.win32 === RCS file: /home/cvs/modperl/t/TEST.win32,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- TEST.win3212 Jul 2003 23:11:56 - 1.5 +++ TEST.win3212 Jul 2003 23:17:33 - 1.6 @@ -7,35 +7,25 @@ use Win32; use Config; use File::Basename 'dirname'; +require File::Spec; +use ExtUtils::MakeMaker; # # Config part # -$apache = "apache"; -SEARCH: { -for my $drive ('c'..'g') { - for my $p ("program files\\apache", "apache") { - last SEARCH if -e ($fullapache = "$drive:\\$p\\apache.exe"); - } -} -} - -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 $apache = 'apache'; +my $fullapache = find_apache(); my $ap_path = dirname $fullapache; $ENV{PATH} = join ";", $ap_path, $ENV{PATH}; -$fullperl = $Config{perlpath}; +my $fullperl = $Config{perlpath}; print "Running tests with:\n"; print " perl=$fullperl\n apache=$fullapache\n"; -$port = 8529; + +my $port = 8529; sub ErrorReport { print Win32::FormatMessage( Win32::GetLastError() ); @@ -131,3 +121,62 @@ sleep 2; find(\&cleanup, '/tmp/'); sub cleanup {/^(mod_perl|CGItemp)/ && unlink($_)} + +sub find_apache { + my $apache; + my $exe = 'Apache.exe'; + SEARCH: { +my $candidate; +for (File::Spec->path) { + $candidate = File::Spec->catfile($_, $exe); + if (-e $candidate and check_win32_apache($candidate)) { +$apache = $candidate; +last SEARCH; + } +} +my @drives = drives(); +last SEARCH unless (@drives > 0); +for my $drive (@drives) { + for ('Apache', 'Program Files/Apache', + 'Program Files/Apache Group/Apache') { +$candidate = File::Spec->catfile($drive, $_, $exe); +if (-e $candidate and check_win32_apache($candidate)) { + $apache = $candidate; + last SEARCH; +} + } +} + } + unless (-e $apache) { +$apache = prompt("Please supply the full path to Apache.exe:", + $apache); +if (-d $apache) { + $apache = File::Spec->catfile($apache, $exe); +} + } + die "Can't find $exe!" +unless (-e $apache and check_win32_apache($apache)); + + $apache = Win32::GetShortPathName($apache); + $apache =~ s!\\!/!g; + return $apache; +} + +sub check_win32_apache { + my $apache = shift; + my $vers = qx{"$apache" -v}; + return ($vers =~ m!Apache/1.3!) ? 1 : 0; +} + +sub drives { + my @drives = (); + eval{require Win32API::File;}; + return map {"$_:\\"} ('C' .. 'Z') if $@; + my @r = Win32API::File::getLogicalDrives(); + return unless @r > 0; + for (@r) { +my $t = Win32API::File::GetDriveType($_); +push @drives, $_ if ($t == 3 or $t == 4); + } + return @drives > 0 ? @drives : undef; +}
cvs commit: modperl/t TEST.win32
randyk 2003/07/12 16:22:59 Modified:tTEST.win32 Log: Put in some additional error checking when editing conf files. Revision ChangesPath 1.7 +16 -11modperl/t/TEST.win32 Index: TEST.win32 === RCS file: /home/cvs/modperl/t/TEST.win32,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- TEST.win3212 Jul 2003 23:17:33 - 1.6 +++ TEST.win3212 Jul 2003 23:22:59 - 1.7 @@ -35,12 +35,11 @@ # prepare config files # -chdir "t/conf"; -copy("httpd.conf-win32", "httpd.conf");# PTI: unless -f httpd.conf; -chdir "../net"; - -#copy("config.pl.win32", "config.pl");# PTI: unless -f config.pl; -chdir "../.."; +my $conf = 't/conf/httpd.conf'; +my $win32_conf = $conf . '-win32'; +my $bak = $conf . '.bak'; +copy($win32_conf, $conf) + or die "Copy of $win32_conf to $conf failed: $!"; # #source or binary distribution @@ -71,19 +70,25 @@ } # change the paths so everybody agrees on which files to use - # - $pwd = cwd(); - - # this is to make sure apache knows which files to take # : apparently apache uner Win32 # change directories to the installation directory so "./t" # references do not work -system "$fullperl -p -i.bak -e \"s#\\./t#$pwd/t#\" t/conf/httpd.conf"; +unless (-e $bak) { +copy($conf, $bak) or die "Copying $conf to $bak failed: $!"; +} +open(BAK, $bak) or die "Open of $bak for reading failed: $!"; +open(CONF, ">$conf") or die "Open of $conf for writing failed: $!"; +while () { +s#\./t#$pwd/t#; +print CONF $_; +} +close BAK; +close CONF; # # start ourselves a server to pound on
cvs commit: modperl/t TEST.win32
randyk 2003/07/12 16:25:50 Modified:tTEST.win32 Log: Some cleanup in starting and stopping server, and also unlink pid file. Revision ChangesPath 1.8 +11 -8 modperl/t/TEST.win32 Index: TEST.win32 === RCS file: /home/cvs/modperl/t/TEST.win32,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- TEST.win3212 Jul 2003 23:22:59 - 1.7 +++ TEST.win3212 Jul 2003 23:25:50 - 1.8 @@ -94,29 +94,30 @@ # start ourselves a server to pound on # +my $HttpdObj; Win32::Process::Create($HttpdObj, $fullapache, - "$apache -X -d $pwd/t", + "$apache -X -d $pwd/t -f $pwd/t/conf/httpd.conf", 0, NORMAL_PRIORITY_CLASS, ".") || die ErrorReport(); -print "httpd listening on port $port\n"; -print "will write error_log to: t/logs/mod_perl_error_log\n"; -print "letting apache warm up...\n"; +print << "END"; +httpd listening on port $port +will write error_log to: t/logs/mod_perl_error_log +letting apache warm up... +END + sleep 2; print "done\n"; # # Ok, start pounding # - system "$fullperl t/TEST @ARGV"; -# # stop server again -# -$HttpdObj->Kill(-1); +$HttpdObj->Kill(0); # # remove traces @@ -126,6 +127,8 @@ sleep 2; find(\&cleanup, '/tmp/'); sub cleanup {/^(mod_perl|CGItemp)/ && unlink($_)} +unlink $bak; +unlink "$pwd/t/logs/mod_perl_httpd.pid"; sub find_apache { my $apache;
cvs commit: modperl/t TEST.win32
randyk 2003/07/12 16:29:44 Modified:tTEST.win32 Log: make script run under strict, and some indentation fixes Revision ChangesPath 1.9 +52 -51modperl/t/TEST.win32 Index: TEST.win32 === RCS file: /home/cvs/modperl/t/TEST.win32,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- TEST.win3212 Jul 2003 23:25:50 - 1.8 +++ TEST.win3212 Jul 2003 23:29:44 - 1.9 @@ -1,5 +1,6 @@ #AUTHOR: Peter Tillemans <[EMAIL PROTECTED]> +use strict; use Cwd; use File::Copy; use File::Find; @@ -39,7 +40,7 @@ my $win32_conf = $conf . '-win32'; my $bak = $conf . '.bak'; copy($win32_conf, $conf) - or die "Copy of $win32_conf to $conf failed: $!"; +or die "Copy of $win32_conf to $conf failed: $!"; # #source or binary distribution @@ -59,11 +60,9 @@ # mkdir("/tmp","755") unless -d "/tmp"; - for my $d (qw(logs conf)) { mkdir("t/$d","755") unless -d "t/$d"; } - for my $f (qw(srm.conf access.conf mime.types)) { local *FH; open FH, ">t/conf/$f"; close FH; @@ -71,7 +70,7 @@ # change the paths so everybody agrees on which files to use # -$pwd = cwd(); +my $pwd = cwd(); # this is to make sure apache knows which files to take # : apparently apache uner Win32 @@ -116,7 +115,9 @@ # system "$fullperl t/TEST @ARGV"; +# # stop server again +# $HttpdObj->Kill(0); # @@ -131,60 +132,60 @@ unlink "$pwd/t/logs/mod_perl_httpd.pid"; sub find_apache { - my $apache; - my $exe = 'Apache.exe'; - SEARCH: { -my $candidate; -for (File::Spec->path) { - $candidate = File::Spec->catfile($_, $exe); - if (-e $candidate and check_win32_apache($candidate)) { -$apache = $candidate; -last SEARCH; - } -} -my @drives = drives(); -last SEARCH unless (@drives > 0); -for my $drive (@drives) { - for ('Apache', 'Program Files/Apache', - 'Program Files/Apache Group/Apache') { -$candidate = File::Spec->catfile($drive, $_, $exe); -if (-e $candidate and check_win32_apache($candidate)) { - $apache = $candidate; - last SEARCH; +my $apache; +my $exe = 'Apache.exe'; + SEARCH: { +my $candidate; +for (File::Spec->path) { +$candidate = File::Spec->catfile($_, $exe); +if (-e $candidate and check_win32_apache($candidate)) { +$apache = $candidate; +last SEARCH; +} +} +my @drives = drives(); +last SEARCH unless (@drives > 0); +for my $drive (@drives) { +for ('Apache', 'Program Files/Apache', + 'Program Files/Apache Group/Apache') { +$candidate = File::Spec->catfile($drive, $_, $exe); +if (-e $candidate and check_win32_apache($candidate)) { +$apache = $candidate; +last SEARCH; +} +} } - } } - } - unless (-e $apache) { -$apache = prompt("Please supply the full path to Apache.exe:", - $apache); -if (-d $apache) { - $apache = File::Spec->catfile($apache, $exe); +unless (-e $apache) { +$apache = prompt("Please supply the full path to Apache.exe:", + $apache); +if (-d $apache) { +$apache = File::Spec->catfile($apache, $exe); +} } - } - die "Can't find $exe!" -unless (-e $apache and check_win32_apache($apache)); - - $apache = Win32::GetShortPathName($apache); - $apache =~ s!\\!/!g; - return $apache; +die "Can't find $exe!" +unless (-e $apache and check_win32_apache($apache)); + +$apache = Win32::GetShortPathName($apache); +$apache =~ s!\\!/!g; +return $apache; } sub check_win32_apache { - my $apache = shift; - my $vers = qx{"$apache" -v}; - return ($vers =~ m!Apache/1.3!) ? 1 : 0; +my $apache = shift; +my $vers = qx{"$apache" -v}; +return ($vers =~ m!Apache/1.3!) ? 1 : 0; } sub drives { - my @drives = (); - eval{require Win32API::File;}; - return map {"$_:\\"} ('C' .. 'Z') if $@; - my @r = Win32API::File::getLogicalDrives(); - return unless @r > 0; - for (@r) { -my $t = Win32API::File::GetDriveType($_); -push @drives, $_ if ($t == 3 or $t == 4); - } - return @drives > 0 ? @drives : undef; +my @drives = (); +eval{require Win32API::File;}; +return map {"$_:\\"} ('C' .. 'Z') if $@; +my @r = Win32API::File::getLogicalDrives(); +return unless @r > 0; +for (@r) { +my $t = Win32A
cvs commit: modperl/t TEST.win32
randyk 2003/07/12 16:35:30 Modified:tTEST.win32 Log: minor cleanup Revision ChangesPath 1.10 +5 -7 modperl/t/TEST.win32 Index: TEST.win32 === RCS file: /home/cvs/modperl/t/TEST.win32,v retrieving revision 1.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- TEST.win3212 Jul 2003 23:29:44 - 1.9 +++ TEST.win3212 Jul 2003 23:35:30 - 1.10 @@ -69,14 +69,12 @@ } # change the paths so everybody agrees on which files to use -# -my $pwd = cwd(); -# this is to make sure apache knows which files to take -# : apparently apache uner Win32 - -# change directories to the installation directory so "./t" -# references do not work +# this is to make sure apache knows which files to take : +# apparently apache uner Win32 +# change directories to the installation directory so "./t" +# references do not work +my $pwd = cwd(); unless (-e $bak) { copy($conf, $bak) or die "Copying $conf to $bak failed: $!"; }