Author: stas Date: Tue Dec 7 07:11:57 2004 New Revision: 110108 URL: http://svn.apache.org/viewcvs?view=rev&rev=110108 Log: fix the config thaw() functionality (when top_dir wasn't in @INC the saved config won't be loaded and tests will blow)
Modified: httpd/test/trunk/perl-framework/Apache-Test/Changes httpd/test/trunk/perl-framework/Apache-Test/lib/Apache/TestConfig.pm Modified: httpd/test/trunk/perl-framework/Apache-Test/Changes Url: http://svn.apache.org/viewcvs/httpd/test/trunk/perl-framework/Apache-Test/Changes?view=diff&rev=110108&p1=httpd/test/trunk/perl-framework/Apache-Test/Changes&r1=110107&p2=httpd/test/trunk/perl-framework/Apache-Test/Changes&r2=110108 ============================================================================== --- httpd/test/trunk/perl-framework/Apache-Test/Changes (original) +++ httpd/test/trunk/perl-framework/Apache-Test/Changes Tue Dec 7 07:11:57 2004 @@ -8,6 +8,9 @@ =item 1.17-dev +fix the config thaw() functionality (when top_dir wasn't in @INC the +saved config won't be loaded and tests will blow) [Stas] + new wrapper Apache::TestRequest::module2url to simplify handling of vhosts in the client. ["Christopher H. Laco" <apache-test chrislaco.com>] Modified: httpd/test/trunk/perl-framework/Apache-Test/lib/Apache/TestConfig.pm Url: http://svn.apache.org/viewcvs/httpd/test/trunk/perl-framework/Apache-Test/lib/Apache/TestConfig.pm?view=diff&rev=110108&p1=httpd/test/trunk/perl-framework/Apache-Test/lib/Apache/TestConfig.pm&r1=110107&p2=httpd/test/trunk/perl-framework/Apache-Test/lib/Apache/TestConfig.pm&r2=110108 ============================================================================== --- httpd/test/trunk/perl-framework/Apache-Test/lib/Apache/TestConfig.pm (original) +++ httpd/test/trunk/perl-framework/Apache-Test/lib/Apache/TestConfig.pm Tue Dec 7 07:11:57 2004 @@ -206,8 +206,18 @@ $args->{$key} = $val; } - my $thaw = {}; + my $top_dir = fastcwd; + $top_dir = pop_dir($top_dir, 't'); + # untaint as we are going to use it a lot later on in -T sensitive + # operations (.e.g @INC) + $top_dir = $1 if $top_dir =~ /(.*)/; + + # make sure that t/conf/apache_test_config.pm is found + # (unfortunately sometimes we get thrown into / by Apache so we + # can't just rely on $top_dir + lib->import($top_dir); + my $thaw = {}; #thaw current config for (qw(conf t/conf)) { last if eval { @@ -218,7 +228,7 @@ #something else, which we can't be sure how to load bless $thaw, 'Apache::TestConfig'; }; - }; + } if ($args->{thaw} and ref($thaw) ne 'HASH') { #dont generate any new config @@ -262,11 +272,7 @@ $self->{$_} = delete $args->{$_}; } - $vars->{top_dir} ||= fastcwd; - $vars->{top_dir} = pop_dir($vars->{top_dir}, 't'); - # untaint as we are going to use it a lot later on in -T sensitive - # operations (.e.g @INC) - $vars->{top_dir} = $1 if $vars->{top_dir} =~ /(.*)/; + $vars->{top_dir} ||= $top_dir; $self->add_inc;