Parent Directory | Revision Log | Patch
--- httpd/test/trunk/perl-framework/Apache-Test/lib/Apache/TestConfig.pm 2004/12/20 03:59:50 122804 +++ httpd/test/trunk/perl-framework/Apache-Test/lib/Apache/TestConfig.pm 2004/12/20 04:02:17 122805 @@ -176,6 +176,11 @@ sub modperl_2_inc_fixup { } sub modperl_build_config { + + # we don't want to get mp2 preconfigured data in order to be able + # to get the interactive tests running. + return undef if $ENV{APACHE_TEST_INTERACTIVE_CONFIG_TEST}; + eval { require Apache::Build; } or return undef; @@ -384,6 +389,9 @@ sub httpd_config { # so it never returns $self->custom_config_first_time($self->{vars}); } + else { + debug "Using httpd: $vars->{httpd}"; + } # if we have gotten that far we know at least about the location # of httpd and or apxs, so let's save it if we haven't saved any @@ -1856,6 +1864,44 @@ sub custom_config_path { return ''; } +# tries to nuke all occurences of custom config +# used by things outside the A-T test suite +sub custom_config_nuke { + my $cwd = fastcwd(); + + # 1) create a fake empty (blib/)?lib/Apache/TestConfigData.pm + # (don't delete it since it may mess up with MakeMaker) + my $path = catfile $cwd, "lib", Apache::TestConfig::CUSTOM_CONFIG_FILE; + # overwrite the empty stub + Apache::TestConfig::custom_config_write($path, '') if -e $path; + + $path = catfile $cwd, "blib", "lib", + Apache::TestConfig::CUSTOM_CONFIG_FILE; + if (-e $path) { + my $mode = (stat _)[2]; + my $mode_new = $mode | 0200; + chmod $mode_new, $path; + error "emptying $path"; + Apache::TestConfig::custom_config_write($path, ''); + chmod $mode, $path; + } + + # 2) go through @INC = ~/.apache-test and nuke any occurences of + # CUSTOM_CONFIG_FILE + my @inc = (); + + push @inc, catdir $ENV{HOME}, '.apache-test' if $ENV{HOME}; + + push @inc, @INC; + + for (@inc) { + my $victim = File::Spec->rel2abs(catfile $_, CUSTOM_CONFIG_FILE); + next unless -e $victim; + debug "unlinking $victim"; + unlink $victim; + } +} + sub custom_config_exists { # try to load custom config if it wasn't loaded yet (there are # many entry points to this API) @@ -2105,6 +2151,12 @@ sub custom_config_load { return; } + if ($ENV{APACHE_TEST_INTERACTIVE_CONFIG_TEST}) { + debug "APACHE_TEST_INTERACTIVE_CONFIG_TEST=1 => " . + "skipping load of custom config data"; + return; + } + return if $custom_config_loaded; if (my $custom_config_path = custom_config_path()) { @@ -2121,8 +2173,11 @@ sub custom_config_first_time { my $self = shift; my $conf_opts = shift; - unless (-t STDIN) { - error "STDIN is closed, can't run interactive config"; + # we can't prompt when STDIN is not attached to tty, unless we + # were told that's it OK via env var (in which case some program + # will feed the interactive prompts + unless (-t STDIN || $ENV{APACHE_TEST_INTERACTIVE_PROMPT_OK}) { + error "STDIN is not attached to tty, skip interactive config"; Apache::TestRun::skip_test_suite(); } @@ -2215,7 +2270,7 @@ or via the environment variable APACHE_T # we probably could reconfigure on the fly ($self->configure), but # the problem is various cached data which won't be refreshed. so # the simplest is just to restart the run from scratch - Apache::TestRun::rerun(); + Apache::TestRun::rerun($vars); } sub _custom_config_prompt_path { @@ -2423,6 +2478,16 @@ configuration phase (C<t/TEST -config>, automatically unshift the I<project/lib> directory into C<@INC>, via the autogenerated I<t/conf/modperl_inc.pl> file. +=head2 APACHE_TEST_INTERACTIVE_PROMPT_OK + +Normally interactive prompts aren't run when STDIN is not attached to +a tty. But sometimes there is a program that can answer the prompts +(e.g. when testing A-T itself). If this variable is true the +interactive config won't be skipped (if needed). + + + + =head1 AUTHOR =head1 SEE ALSO
infrastructure at apache.org | ViewVC Help |
Powered by ViewVC 1.1.26 |