stas 2004/01/17 22:53:53
Modified: perl-framework/Apache-Test/lib/Apache TestConfigParse.pm perl-framework/Apache-Test Changes Log: handle "Include conf/*conf" cases when inheriting httpd.conf in a cleaner way, don't complain that "*conf" doesn't exist, since it's a glob pattern. Instead check try to resolve the base directory. Revision Changes Path 1.42 +19 -6 httpd-test/perl-framework/Apache-Test/lib/Apache/TestConfigParse.pm Index: TestConfigParse.pm =================================================================== RCS file: /home/cvs/httpd-test/perl-framework/Apache-Test/lib/Apache/TestConfigParse.pm,v retrieving revision 1.41 retrieving revision 1.42 diff -u -u -r1.41 -r1.42 --- TestConfigParse.pm 9 Dec 2003 14:53:58 -0000 1.41 +++ TestConfigParse.pm 18 Jan 2004 06:53:53 -0000 1.42 @@ -9,7 +9,7 @@ use Apache::TestTrace; use File::Spec::Functions qw(rel2abs splitdir file_name_is_absolute); -use File::Basename qw(basename); +use File::Basename qw(dirname basename); sub strip_quotes { local $_ = shift || $_; @@ -43,7 +43,8 @@ $self->$where($directive => $val); } -#resolve relative files like Apache->server_root_relative +# resolve relative files like Apache->server_root_relative +# this function doesn't test whether the resolved file exists sub server_file_rel2abs { my($self, $file, $base) = @_; @@ -87,14 +88,26 @@ # return early, skipping file test below return $file; } - } - if (-e $result) { - debug "$file successfully resolved to existing file $result"; + my $dir = dirname $result; + # $file might not exist (e.g. if it's a glob pattern like + # "conf/*.conf" but what we care about here is to check whether + # the base dir was successfully resolved. we don't check whether + # the file exists at all. it's the responsibility of the caller to + # do this check + if (defined $dir && -e $dir && -d _) { + if (-e $result) { + debug "$file successfully resolved to existing file $result"; + } + else { + debug "base dir of '$file' successfully resolved to $dir"; + } + } else { - warning "file $result does not exist"; + $dir ||= ''; + warning "dir '$dir' does not exist (while resolving '$file')"; # old behavior was to return the resolved but non-existent # file. preserve that behavior and return $result anyway. 1.80 +4 -0 httpd-test/perl-framework/Apache-Test/Changes Index: Changes =================================================================== RCS file: /home/cvs/httpd-test/perl-framework/Apache-Test/Changes,v retrieving revision 1.79 retrieving revision 1.80 diff -u -u -r1.79 -r1.80 --- Changes 18 Jan 2004 03:17:16 -0000 1.79 +++ Changes 18 Jan 2004 06:53:53 -0000 1.80 @@ -8,6 +8,10 @@ =item 1.08_dev +handle "Include conf/*conf" cases when inheriting httpd.conf in a +cleaner way, don't complain that "*conf" doesn't exist, since it's a +glob pattern. Instead check try to resolve the base directory. [Stas] + import the Apache::TestMM clean target in Makefile.PL so 'make clean' will call t/TEST -clean [Stas]