stas 2004/01/30 16:54:33
Modified: perl-framework/t/modules dav.t dir.t autoindex.t expires.t
headers.t include.t setenvif.t vhost_alias.t
Log:
make the tests relocatable (not to rely on cwd)
Revision Changes Path
1.7 +6 -5 httpd-test/perl-framework/t/modules/dav.t
Index: dav.t
===================================================================
RCS file: /home/cvs/httpd-test/perl-framework/t/modules/dav.t,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -u -r1.6 -r1.7
--- dav.t 22 Apr 2003 00:33:23 -0000 1.6
+++ dav.t 31 Jan 2004 00:54:32 -0000 1.7
@@ -16,6 +16,7 @@
my $dav = HTTP::DAV->new;
my $server = "$vars->{servername}:$vars->{port}";
+my $htdocs = Apache::Test::vars('documentroot');
my $response;
my $dir = "modules/dav";
my $uri = "/$dir/dav.html";
@@ -33,10 +34,10 @@
CONTENT
## make sure its clean before we begin ##
-unlink "htdocs$uri" if -e "htdocs$uri";
-mkdir "htdocs/$dir", oct('755') unless -e "htdocs/$dir";
+unlink "$htdocs$uri" if -e "$htdocs$uri";
+mkdir "$htdocs/$dir", oct('755') unless -e "$htdocs/$dir";
-Apache::TestUtil::t_chown("htdocs/$dir");
+Apache::TestUtil::t_chown("$htdocs/$dir");
## set up resource and lock it ##
my $resource = $dav->new_resource( -uri => "http://$server$uri");
@@ -155,5 +156,5 @@
ok $actual == 404;
## clean up ##
-rmdir "htdocs/$dir/.DAV" or print "warning: could not remove .DAV dir: $!";
-rmdir "htdocs/$dir" or print "warning: could not remove dav dir: $!";
+rmdir "$htdocs/$dir/.DAV" or print "warning: could not remove .DAV dir: $!";
+rmdir "$htdocs/$dir" or print "warning: could not remove dav dir: $!";
1.6 +2 -1 httpd-test/perl-framework/t/modules/dir.t
Index: dir.t
===================================================================
RCS file: /home/cvs/httpd-test/perl-framework/t/modules/dir.t,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -u -r1.5 -r1.6
--- dir.t 15 Jun 2002 18:57:22 -0000 1.5
+++ dir.t 31 Jan 2004 00:54:32 -0000 1.6
@@ -10,7 +10,8 @@
my @index = qw(1 2 3 4 5 6 7 8 9 0);
my @bad_index = qw(foo goo moo bleh);
-my $htaccess = "htdocs/modules/dir/htaccess/.htaccess";
+my $htdocs = Apache::Test::vars('documentroot');
+my $htaccess = "$htdocs/modules/dir/htaccess/.htaccess";
my $url = "/modules/dir/htaccess/";
my ($actual, $expected);
1.10 +4 -3 httpd-test/perl-framework/t/modules/autoindex.t
Index: autoindex.t
===================================================================
RCS file: /home/cvs/httpd-test/perl-framework/t/modules/autoindex.t,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -u -r1.9 -r1.10
--- autoindex.t 12 Jan 2004 16:04:50 -0000 1.9
+++ autoindex.t 31 Jan 2004 00:54:32 -0000 1.10
@@ -13,9 +13,10 @@
## with IndexOrderDefault directive and FancyIndexing.
## more to come...
+my $htdocs = Apache::Test::vars('documentroot');
my $ai_dir = "/modules/autoindex";
my $uri_prefix = "$ai_dir/htaccess";
-my $dir = "htdocs$uri_prefix";
+my $dir = "$htdocs$uri_prefix";
my $htaccess = "$dir/.htaccess";
my $readme = 'autoindex test README';
my $s = 'HITHERE';
@@ -78,7 +79,7 @@
plan tests => 84, ['autoindex'];
## set up environment ##
-$cfg->gendir("htdocs/$ai_dir");
+$cfg->gendir("$htdocs/$ai_dir");
$cfg->gendir("$dir");
test_content('create');
@@ -379,7 +380,7 @@
## clean up ##
test_content('destroy');
rmdir $dir or print "warning: cant rmdir $dir: $!\n";
-rmdir "htdocs/$ai_dir";
+rmdir "$htdocs/$ai_dir";
sub write_htaccess {
open (HT, ">$htaccess") or die "cant open $htaccess: $!";
1.9 +2 -1 httpd-test/perl-framework/t/modules/expires.t
Index: expires.t
===================================================================
RCS file: /home/cvs/httpd-test/perl-framework/t/modules/expires.t,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -u -r1.8 -r1.9
--- expires.t 21 Oct 2001 16:07:53 -0000 1.8
+++ expires.t 31 Jan 2004 00:54:32 -0000 1.9
@@ -21,7 +21,8 @@
## calculate "modification plus 10 years 6 months 2 weeks 3 days 12 hours 30
minutes 19 seconds"
my $expires_default = calculate_seconds(10,6,2,3,12,30,19);
-my $htaccess = "htdocs/modules/expires/htaccess/.htaccess";
+my $htdocs = Apache::Test::vars('documentroot');
+my $htaccess = "$htdocs/modules/expires/htaccess/.htaccess";
my @page = qw(index.html text.txt image.gif foo.jpg);
my @types = qw(text/plain image/gif image/jpeg);
my @directive = qw(ExpiresDefault ExpiresByType);
1.3 +2 -1 httpd-test/perl-framework/t/modules/headers.t
Index: headers.t
===================================================================
RCS file: /home/cvs/httpd-test/perl-framework/t/modules/headers.t,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -u -r1.2 -r1.3
--- headers.t 18 Sep 2001 15:41:03 -0000 1.2
+++ headers.t 31 Jan 2004 00:54:32 -0000 1.3
@@ -8,7 +8,8 @@
## mod_headers tests
##
-my $htaccess = "htdocs/modules/headers/htaccess/.htaccess";
+my $htdocs = Apache::Test::vars('documentroot');
+my $htaccess = "$htdocs/modules/headers/htaccess/.htaccess";
my @header_types = ('set', 'append', 'add', 'unset');
plan tests =>
1.48 +11 -12 httpd-test/perl-framework/t/modules/include.t
Index: include.t
===================================================================
RCS file: /home/cvs/httpd-test/perl-framework/t/modules/include.t,v
retrieving revision 1.47
retrieving revision 1.48
diff -u -u -r1.47 -r1.48
--- include.t 14 Jan 2004 15:14:29 -0000 1.47
+++ include.t 31 Jan 2004 00:54:32 -0000 1.48
@@ -19,8 +19,7 @@
my $have_apache_2 = have_apache 2;
my $have_apache_21 = have_min_apache_version "2.1.0";
my $have_apache_20 = $have_apache_2 && ! $have_apache_21;
-my $vars = Apache::Test::vars();
-my $docroot = $vars->{documentroot};
+my $htdocs = Apache::Test::vars('documentroot');
# these match the SSI files with their expected results.
# the expectations are set by the current 2.1 mod_include
@@ -239,7 +238,7 @@
# marked as TODO in 1.3 - hoping for a format backport
{
- my $file = catfile($docroot, splitpath($dir), "size.shtml");
+ my $file = catfile($htdocs, splitpath($dir), "size.shtml");
my $size = (stat $file)[7];
# round perl's stat size for <!--#config sizefmt="abbrev"-->
@@ -269,7 +268,7 @@
skip "POSIX module not found", 1;
}
else {
- my $file = catfile($docroot, splitpath($dir), "file.shtml");
+ my $file = catfile($htdocs, splitpath($dir), "file.shtml");
my $mtime = (stat $file)[9];
my @time = localtime($mtime);
@@ -340,7 +339,7 @@
# test xbithack off
$doc = "xbithack/off/test.html";
foreach ("0444", "0544", "0554") {
- chmod oct($_), "htdocs/$dir$doc";
+ chmod oct($_), "$htdocs/$dir$doc";
ok t_cmp("<BODY> <!--#include virtual=\"../../inc-two.shtml\"-->
</BODY>",
super_chomp(GET_BODY "$dir$doc"),
"XBitHack off [$_]"
@@ -349,14 +348,14 @@
# test xbithack on
$doc = "xbithack/on/test.html";
- chmod 0444, "htdocs$dir$doc";
+ chmod 0444, "$htdocs$dir$doc";
ok t_cmp("<BODY> <!--#include virtual=\"../../inc-two.shtml\"-->
</BODY>",
super_chomp(GET_BODY "$dir$doc"),
"XBitHack on [0444]"
);
foreach ("0544", "0554") {
- chmod oct($_), "htdocs/$dir$doc";
+ chmod oct($_), "$htdocs/$dir$doc";
ok t_cmp("No Last-modified date ; <BODY> inc-two.shtml body
</BODY>",
check_xbithack(GET "$dir$doc"),
"XBitHack on [$_]"
@@ -365,12 +364,12 @@
# test xbithack full
$doc = "xbithack/full/test.html";
- chmod 0444, "htdocs/$dir$doc";
+ chmod 0444, "$htdocs/$dir$doc";
ok t_cmp("<BODY> <!--#include virtual=\"../../inc-two.shtml\"-->
</BODY>",
super_chomp(GET_BODY "$dir$doc"),
"XBitHack full [0444]"
);
- chmod 0544, "htdocs/$dir$doc";
+ chmod 0544, "$htdocs/$dir$doc";
ok t_cmp("No Last-modified date ; <BODY> inc-two.shtml body </BODY>",
check_xbithack(GET "$dir$doc"),
"XBitHack full [0544]"
@@ -378,7 +377,7 @@
my $lm;
- chmod 0554, "htdocs/$dir$doc";
+ chmod 0554, "$htdocs/$dir$doc";
ok t_cmp("Has Last-modified date ; <BODY> inc-two.shtml body </BODY>",
check_xbithack(GET("$dir$doc"), \$lm),
"XBitHack full [0554]"
@@ -393,7 +392,7 @@
"XBitHack full [0554] / If-Modified-Since"
);
- chmod 0544, "htdocs/$dir$doc";
+ chmod 0544, "$htdocs/$dir$doc";
ok t_cmp(200, GET("$dir$doc", 'If-Modified-Since' => $lm)->code,
"XBitHack full [0544] / If-Modified-Since"
);
@@ -414,7 +413,7 @@
"##################################3/8</tr> ".
"##################################4/8</tr> ".
"##################################5/8</tr> ".
- "##################################6/8$docroot</tr> ".
+ "##################################6/8$htdocs</tr> ".
"##################################7/8</tr> ".
"##################################8/8</tr> ".
"@@@@@@@@ @@@@@@@@@@@@@@@@@@@@@@@@";
1.6 +3 -2 httpd-test/perl-framework/t/modules/setenvif.t
Index: setenvif.t
===================================================================
RCS file: /home/cvs/httpd-test/perl-framework/t/modules/setenvif.t,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -u -r1.5 -r1.6
--- setenvif.t 20 Oct 2001 01:51:22 -0000 1.5
+++ setenvif.t 31 Jan 2004 00:54:32 -0000 1.6
@@ -5,6 +5,7 @@
use Apache::TestRequest;
my $vars = Apache::Test::vars();
+my $htdocs = Apache::Test::vars('documentroot');
##
## mod_setenvif tests
@@ -45,14 +46,14 @@
my $good_ua = '^libwww-perl/.*';
my $bad_ua = 'foo-browser/0.1';
-my $htaccess = 'htdocs/modules/setenvif/htaccess/.htaccess';
+my $htaccess = "$htdocs/modules/setenvif/htaccess/.htaccess";
plan tests => @var * 7 + (keys %var_att) * 6 * @var,
have_module qw(setenvif include);
sub write_htaccess {
my $string = shift;
- open (HT, ">$htaccess") or die "cant open $htaccess: $!";
+ open (HT, ">$htaccess") or die "can't open $htaccess: $!";
print HT $string;
close(HT);
}
1.12 +2 -1 httpd-test/perl-framework/t/modules/vhost_alias.t
Index: vhost_alias.t
===================================================================
RCS file: /home/cvs/httpd-test/perl-framework/t/modules/vhost_alias.t,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -u -r1.11 -r1.12
--- vhost_alias.t 22 Apr 2003 00:33:23 -0000 1.11
+++ vhost_alias.t 31 Jan 2004 00:54:32 -0000 1.12
@@ -5,10 +5,11 @@
use Apache::TestUtil;
use Apache::TestRequest;
+my $htdocs = Apache::Test::vars('documentroot');
my $url = '/index.html';
my $cgi_name = "test-cgi";
my $cgi_string = "test cgi for";
-my $root = "htdocs/modules/vhost_alias";
+my $root = "$htdocs/modules/vhost_alias";
my $ext;
my @vh = qw(www.vha-test.com big.server.name.from.heck.org ab.com w-t-f.net);