Return-Path: Delivered-To: apmail-perl-dev-archive@www.apache.org Received: (qmail 76983 invoked from network); 14 Oct 2010 21:38:40 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 14 Oct 2010 21:38:40 -0000 Received: (qmail 64916 invoked by uid 500); 14 Oct 2010 21:38:40 -0000 Delivered-To: apmail-perl-dev-archive@perl.apache.org Received: (qmail 64891 invoked by uid 500); 14 Oct 2010 21:38:40 -0000 Mailing-List: contact dev-help@perl.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list dev@perl.apache.org Received: (qmail 64878 invoked by uid 99); 14 Oct 2010 21:38:40 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 14 Oct 2010 21:38:40 +0000 X-ASF-Spam-Status: No, hits=0.7 required=10.0 tests=RCVD_IN_DNSWL_NONE,SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (nike.apache.org: local policy) Received: from [209.85.216.177] (HELO mail-qy0-f177.google.com) (209.85.216.177) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 14 Oct 2010 21:38:33 +0000 Received: by qyk4 with SMTP id 4so190892qyk.1 for ; Thu, 14 Oct 2010 14:38:12 -0700 (PDT) MIME-Version: 1.0 Received: by 10.224.64.75 with SMTP id d11mr1436323qai.70.1287091914116; Thu, 14 Oct 2010 14:31:54 -0700 (PDT) Received: by 10.224.67.143 with HTTP; Thu, 14 Oct 2010 14:29:42 -0700 (PDT) In-Reply-To: <4CB77547.80007@livesite.net> References: <20101014201727.3ABA52388978@eris.apache.org> <4CB77547.80007@livesite.net> Date: Thu, 14 Oct 2010 14:29:42 -0700 Message-ID: Subject: Re: Fwd: svn commit: r1022689 - in /perl/Apache-Test/trunk: Changes MANIFEST Makefile.PL lib/Apache/TestConfig.pm lib/Apache/TestRun.pm From: Fred Moyer To: Ryan Gies Cc: mod_perl Dev , test-dev@perl.apache.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Virus-Checked: Checked by ClamAV on apache.org On Thu, Oct 14, 2010 at 2:25 PM, Ryan Gies wrote: > Cannot create make file directly. =A0(Q: Is this suppose to work?) Thanks for the spot - here's what I see when I do that: phred@pooky ~/dev/svn/modperl/mod_perl-2.0/Apache-Test $ perl Makefile.PL Subroutine MY::test redefined at Makefile.PL line 237. Do not run 'perl Makefile.PL' when Apache-Test is a subdirectory of modperl-2.0. Copy it elsewhere and run from there. phred@pooky ~/dev/svn/modperl/mod_perl-2.0/Apache-Test $ This looks like an unrelated issue - the local lib directory is not showing up on your @INC. Can you give me a few more details about your system? I.e. version of apache and perl -V? > > Steps > ----- > > svn checkout https://svn.apache.org/repos/asf/perl/modperl/trunk/ > mod_perl-2.0 > cd mod_perl-2.0/Apache-Test/ > perl Makefile.PL > > Result > ------ > > Can't locate Apache2/Build.pm in @INC (@INC contains: lib /code/src/lib/p= erl > /usr/local/lib/perl5/site_perl/5.10.0/i386-linux-thread-multi > /usr/local/lib/perl5/site_perl/5.10.0 > /usr/lib/perl5/vendor_perl/5.10.0/i386-linux-thread-multi > /usr/lib/perl5/vendor_perl/5.10.0 /usr/lib/perl5/vendor_perl > /usr/lib/perl5/5.10.0/i386-linux-thread-multi /usr/lib/perl5/5.10.0 > /usr/lib/perl5/site_perl .) at lib/Apache/TestConfig.pm line 34. > BEGIN failed--compilation aborted at lib/Apache/TestConfig.pm line 35. > Compilation failed in require at lib/Apache/TestMM.pm line 22. > BEGIN failed--compilation aborted at lib/Apache/TestMM.pm line 22. > Compilation failed in require at Makefile.PL line 17. > BEGIN failed--compilation aborted at Makefile.PL line 17. > > > > On 10/14/2010 04:19 PM, Fred Moyer wrote: >> >> FYI - just committed this major revision. =A0If you have an active >> Apache::Test trunk checkout, please update and run the tests. >> >> The goal here is to make Apache::Test easier to use, and bring the >> overall quality up to a point where people feel confident using it. >> >> >> ---------- Forwarded message ---------- >> From: >> Date: Thu, Oct 14, 2010 at 1:17 PM >> Subject: svn commit: r1022689 - in /perl/Apache-Test/trunk: Changes >> MANIFEST Makefile.PL lib/Apache/TestConfig.pm lib/Apache/TestRun.pm >> To: test-commits@perl.apache.org >> >> >> Author: phred >> Date: Thu Oct 14 20:17:26 2010 >> New Revision: 1022689 >> >> URL: http://svn.apache.org/viewvc?rev=3D1022689&view=3Drev >> Log: >> Remove the interactive configuration. >> Remove the custom configuration option, instead relying on PATH and ENV >> variables to configure Apache::Test based on runtime settings. >> >> Modified: >> =A0 =A0perl/Apache-Test/trunk/Changes >> =A0 =A0perl/Apache-Test/trunk/MANIFEST >> =A0 =A0perl/Apache-Test/trunk/Makefile.PL >> =A0 =A0perl/Apache-Test/trunk/lib/Apache/TestConfig.pm >> =A0 =A0perl/Apache-Test/trunk/lib/Apache/TestRun.pm >> >> Modified: perl/Apache-Test/trunk/Changes >> URL: >> http://svn.apache.org/viewvc/perl/Apache-Test/trunk/Changes?rev=3D102268= 9&r1=3D1022688&r2=3D1022689&view=3Ddiff >> >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D >> --- perl/Apache-Test/trunk/Changes (original) >> +++ perl/Apache-Test/trunk/Changes Thu Oct 14 20:17:26 2010 >> @@ -8,6 +8,10 @@ Changes - Apache::Test change logfile >> >> =A0=3Ditem 1.34-dev >> >> +Remove the custom config feature, and instead use inline directives, >> +ENV vars, and look for apxs et al in PATH. >> +[Fred Moyer] >> + >> =A0Prevent reconfiguration when t/TEST is called with -run-tests only. >> =A0(rev 1004278) [Torsten Foertsch] >> >> >> Modified: perl/Apache-Test/trunk/MANIFEST >> URL: >> http://svn.apache.org/viewvc/perl/Apache-Test/trunk/MANIFEST?rev=3D10226= 89&r1=3D1022688&r2=3D1022689&view=3Ddiff >> >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D >> --- perl/Apache-Test/trunk/MANIFEST (original) >> +++ perl/Apache-Test/trunk/MANIFEST Thu Oct 14 20:17:26 2010 >> @@ -42,15 +42,33 @@ lib/Apache/TestSort.pm >> =A0lib/Apache/TestTrace.pm >> =A0lib/Apache/TestUtil.pm >> =A0lib/Bundle/ApacheTest.pm >> -t/TEST.PL >> +t/alltest/01bang.t >> +t/alltest/all.t >> +t/alltest2/01bang.t >> +t/alltest2/all.t >> =A0t/bad_coding.t >> +t/cgi-bin/cookies.pl >> =A0t/cgi-bin/cookies.pl.PL >> +t/cgi-bin/next_available_port.pl >> =A0t/cgi-bin/next_available_port.pl.PL >> =A0t/conf/extra.conf.in >> +t/conf/modperl_extra.pl.in >> =A0t/cookies.t >> +t/htdocs/index.html >> +t/log_watch.t >> +t/more/01testpm.t >> +t/more/02testmore.t >> +t/more/03testpm.t >> +t/more/04testmore.t >> +t/more/all.t >> =A0t/next_available_port.t >> =A0t/ping.t >> =A0t/redirect.t >> =A0t/request.t >> +t/response/TestMore/testmorepm.pm >> +t/response/TestMore/testpm.pm >> +t/TEST.PL >> + >> >> =A0META.yml =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 Module meta-data (added by >> MakeMaker) >> + >> >> Modified: perl/Apache-Test/trunk/Makefile.PL >> URL: >> http://svn.apache.org/viewvc/perl/Apache-Test/trunk/Makefile.PL?rev=3D10= 22689&r1=3D1022688&r2=3D1022689&view=3Ddiff >> >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D >> --- perl/Apache-Test/trunk/Makefile.PL (original) >> +++ perl/Apache-Test/trunk/Makefile.PL Thu Oct 14 20:17:26 2010 >> @@ -19,6 +19,7 @@ use Apache::TestRun; >> =A0use Apache::TestTrace; >> =A0use Apache::TestReport; >> =A0use Apache::TestConfig (); >> +use Apache::TestRunPerl; >> >> =A0my $VERSION; >> =A0set_version(); >> @@ -35,6 +36,17 @@ finddepth(sub { >> =A0 =A0 push @scripts, "$File::Find::dir/$1"; >> =A0}, '.'); >> >> +my $has_mp; >> +eval { require mod_perl2 }; >> +if ($@) { >> + =A0 =A0eval { require mod_perl }; >> + =A0 =A0if (!$@) { >> + =A0 =A0 =A0 =A0$has_mp =3D 1; >> + =A0 =A0} >> +} else { >> + =A0 =A0$has_mp =3D 2; >> +} >> + >> =A0for (@scripts) { >> =A0 =A0 Apache::TestMM::generate_script($_); >> =A0} >> @@ -47,12 +59,10 @@ if (TOP_LEVEL) { >> =A0 =A0 add_Apache__test_target(); >> =A0} >> >> -Apache::TestConfig::custom_config_file_stub_write(); >> - >> =A0my @clean_files =3D >> - =A0 =A0qw(lib/Apache/TestConfigData.pm >> - =A0 =A0 =A0 .mypacklist >> + =A0 =A0qw(.mypacklist >> =A0 =A0 =A0 =A0t/TEST >> + =A0 =A0 =A0 t/REPORT >> =A0 =A0 =A0 =A0Makefile.old >> =A0 =A0 =A0 ); >> >> >> Modified: perl/Apache-Test/trunk/lib/Apache/TestConfig.pm >> URL: >> http://svn.apache.org/viewvc/perl/Apache-Test/trunk/lib/Apache/TestConfi= g.pm?rev=3D1022689&r1=3D1022688&r2=3D1022689&view=3Ddiff >> >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D >> --- perl/Apache-Test/trunk/lib/Apache/TestConfig.pm (original) >> +++ perl/Apache-Test/trunk/lib/Apache/TestConfig.pm Thu Oct 14 20:17:26 >> 2010 >> @@ -38,8 +38,6 @@ use constant IS_APACHE_TEST_BUILD =3D> >> =A0 =A0 grep { -e "$_/lib/Apache/TestConfig.pm" } >> =A0 =A0 =A0 =A0 =A0qw(Apache-Test . .. ../Apache-Test); >> >> -use constant CUSTOM_CONFIG_FILE =3D> =A0'Apache/TestConfigData.pm'; >> - >> =A0use lib (); >> =A0use File::Copy (); >> =A0use File::Find qw(finddepth); >> @@ -59,18 +57,6 @@ use Apache::TestRun (); >> >> =A0use vars qw(%Usage); >> >> -# variables stored in $Apache::TestConfigData::vars >> -my @data_vars_must =3D qw(httpd apxs); >> -my @data_vars_opt =A0=3D qw(user group port); >> -# mapping from $Apache::TestConfigData::vars to $ENV settings >> -my %vars_to_env =3D ( >> - =A0 =A0httpd =3D> =A0'APACHE_TEST_HTTPD', >> - =A0 =A0apxs =A0=3D> =A0'APACHE_TEST_APXS', >> - =A0 =A0user =A0=3D> =A0'APACHE_TEST_USER', >> - =A0 =A0group =3D> =A0'APACHE_TEST_GROUP', >> - =A0 =A0port =A0=3D> =A0'APACHE_TEST_PORT', >> -); >> - >> =A0%Usage =3D ( >> =A0 =A0top_dir =A0 =A0 =A0 =A0 =3D> =A0'top-level directory (default is = $PWD)', >> =A0 =A0t_dir =A0 =A0 =A0 =A0 =A0 =3D> =A0'the t/ test directory (default= is $top_dir/t)', >> @@ -181,10 +167,6 @@ sub modperl_build_config { >> >> =A0 =A0 my $server =3D ref $self ? $self->server : new_test_server(); >> >> - =A0 =A0# we don't want to get mp2 preconfigured data in order to be ab= le >> - =A0 =A0# to get the interactive tests running. >> - =A0 =A0return undef if $ENV{APACHE_TEST_INTERACTIVE_CONFIG_TEST}; >> - >> =A0 =A0 # we can't do this if we're using httpd 1.3.X >> =A0 =A0 # even if mod_perl2 is installed on the box >> =A0 =A0 # similarly, we shouldn't be loading mp2 if we're not >> @@ -195,6 +177,7 @@ sub modperl_build_config { >> =A0 =A0 =A0 =A0 eval { >> =A0 =A0 =A0 =A0 =A0 =A0 require Apache2::Build; >> =A0 =A0 =A0 =A0 } or return; >> + >> =A0 =A0 =A0 =A0 return Apache2::Build->build_config; >> =A0 =A0 } >> >> @@ -264,10 +247,6 @@ sub new { >> =A0 =A0 =A0 =A0 } >> =A0 =A0 } >> >> - =A0 =A0# custom config options from Apache::TestConfigData >> - =A0 =A0# again, this should force reconfiguration >> - =A0 =A0custom_config_add_conf_opts($args); >> - >> =A0 =A0 my $self =3D bless { >> =A0 =A0 =A0 =A0 clean =3D> =A0{}, >> =A0 =A0 =A0 =A0 vhosts =3D> =A0{}, >> @@ -298,12 +277,13 @@ sub new { >> =A0 =A0 #help to find libmodperl.so >> =A0 =A0 unless ($vars->{src_dir}) { >> =A0 =A0 =A0 =A0 my $src_dir =3D catfile $vars->{top_dir}, qw(.. src modu= les perl); >> - =A0 =A0 =A0 if (-d $src_dir) { >> - =A0 =A0 =A0 =A0 =A0 $vars->{src_dir} =3D $src_dir; >> - =A0 =A0 =A0 } else { >> - =A0 =A0 =A0 =A0 =A0 $src_dir =3D catfile $vars->{top_dir}, qw(src modu= les perl); >> - =A0 =A0 =A0 =A0 =A0 $vars->{src_dir} =3D $src_dir if -d $src_dir; >> - =A0 =A0 =A0 } >> + >> + =A0 =A0 =A0 =A0if (-d $src_dir) { >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 $vars->{src_dir} =3D $src_dir; >> + =A0 =A0 =A0 } else { >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 $src_dir =3D catfile $vars->{top_dir}, qw(= src modules perl); >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 $vars->{src_dir} =3D $src_dir if -d $src_d= ir; >> + =A0 =A0 =A0 } >> =A0 =A0 } >> >> =A0 =A0 $vars->{t_dir} =A0 =A0 =A0 =A0||=3D catfile $vars->{top_dir}, 't= '; >> @@ -399,29 +379,18 @@ sub httpd_config { >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 "bug report"; >> =A0 =A0 =A0 =A0 } >> >> - =A0 =A0 =A0 =A0if ($ENV{APACHE_TEST_NO_STICKY_PREFERENCES}) { >> - =A0 =A0 =A0 =A0 =A0 =A0error "You specified APACHE_TEST_NO_STICKY_PREF= ERENCES=3D1 " . >> - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0"in which case you must explicitly spec= ify -httpd " . >> - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0"and/or -apxs options"; >> - =A0 =A0 =A0 =A0 =A0 =A0Apache::TestRun::exit_perl(0); >> - =A0 =A0 =A0 =A0} >> - >> =A0 =A0 =A0 =A0 $self->clean(1); >> - =A0 =A0 =A0 =A0# this method restarts the whole program via exec >> - =A0 =A0 =A0 =A0# so it never returns >> - =A0 =A0 =A0 =A0$self->custom_config_first_time($self->{vars}); >> + >> + =A0 =A0 =A0 =A0error "You must explicitly specify -httpd and/or -apxs = options, " >> . >> + =A0 =A0 =A0 =A0 =A0 =A0"or set \$ENV{APACHE_TEST_HTTPD} and \$ENV{APAC= HE_TEST_APXS}, >> " . >> + =A0 =A0 =A0 =A0 =A0 =A0"or set your \$PATH to include the httpd and ap= xs binaries."; >> + =A0 =A0 =A0 =A0Apache::TestRun::exit_perl(1); >> + >> =A0 =A0 } >> =A0 =A0 else { >> =A0 =A0 =A0 =A0 debug "Using httpd: $vars->{httpd}"; >> =A0 =A0 } >> >> - =A0 =A0# if we have gotten that far we know at least about the locatio= n >> - =A0 =A0# of httpd and or apxs, so let's save it if we haven't saved an= y >> - =A0 =A0# custom configs yet >> - =A0 =A0unless (custom_config_exists()) { >> - =A0 =A0 =A0 =A0$self->custom_config_save($self->{vars}); >> - =A0 =A0} >> - >> =A0 =A0 $self->inherit_config; #see TestConfigParse.pm >> =A0 =A0 $self->configure_httpd_eapi; #must come after inherit_config >> >> @@ -434,7 +403,7 @@ sub httpd_config { >> >> =A0 =A0 $self->{server}->post_config; >> >> - =A0 =A0$self; >> + =A0 =A0return $self; >> =A0} >> >> =A0sub default_module { >> @@ -694,7 +663,7 @@ sub default_user { >> =A0 =A0 =A0 =A0 } >> =A0 =A0 } >> >> - =A0 =A0$user; >> + =A0 =A0return $user; >> =A0} >> >> =A0sub default_serveradmin { >> @@ -711,7 +680,18 @@ sub default_apxs { >> =A0 =A0 =A0 =A0 return $build_config->{MP_APXS}; >> =A0 =A0 } >> >> - =A0 =A0$ENV{APACHE_TEST_APXS}; >> + =A0 =A0if ($ENV{APACHE_TEST_APXS}) { >> + =A0 =A0 =A0 =A0return $ENV{APACHE_TEST_APXS}; >> + =A0 =A0} >> + >> + =A0 =A0# look in PATH as a last resort >> + =A0 =A0if (my $apxs =3D which('apxs')) { >> + =A0 =A0 =A0 =A0return $apxs; >> + =A0 =A0} elsif ($apxs =3D which('apxs2')) { >> + =A0 =A0 =A0 =A0return $apxs; >> + =A0 =A0} >> + >> + =A0 =A0return; >> =A0} >> >> =A0sub default_httpd { >> @@ -737,7 +717,22 @@ sub default_httpd { >> =A0 =A0 =A0 =A0 } >> =A0 =A0 } >> >> - =A0 =A0$ENV{APACHE_TEST_HTTPD}; >> + =A0 =A0if ($ENV{APACHE_TEST_HTTPD}) { >> + =A0 =A0 =A0 =A0return $ENV{APACHE_TEST_HTTPD}; >> + =A0 =A0} >> + >> + =A0 =A0# look in PATH as a last resort >> + =A0 =A0if (my $httpd =3D which('httpd')) { >> + =A0 =A0 =A0 =A0return $httpd; >> + =A0 =A0} elsif ($httpd =3D which('httpd2')) { >> + =A0 =A0 =A0 =A0return $httpd; >> + =A0 =A0} elsif ($httpd =3D which('apache')) { >> + =A0 =A0 =A0 =A0return $httpd; >> + =A0 =A0} elsif ($httpd =3D which('apache2')) { >> + =A0 =A0 =A0 =A0return $httpd; >> + =A0 =A0} >> + >> + =A0 =A0return; >> =A0} >> >> =A0my $localhost; >> @@ -1952,520 +1947,6 @@ sub shell_ready { >> =A0 =A0 return qq["$arg"]; >> =A0} >> >> -### Permanent custom configuration functions ### >> - >> -# determine which configuration file Apache/TestConfigData.pm to use >> -# (as there could be several). The order searched is: >> -# 1) $ENV{HOME}/.apache-test/ >> -# 2) in @INC >> -my $custom_config_path; >> -sub custom_config_path { >> - >> - =A0 =A0return $custom_config_path if $custom_config_path; >> - >> - =A0 =A0my @inc =A0=3D (); >> - >> - =A0 =A0# XXX $ENV{HOME} isn't propagated in mod_perl >> - =A0 =A0push @inc, catdir $ENV{HOME}, '.apache-test' if $ENV{HOME}; >> - >> - =A0 =A0push @inc, @INC; >> - >> - =A0 =A0for (@inc) { >> - =A0 =A0 =A0 =A0my $candidate =3D File::Spec->rel2abs(catfile $_, >> CUSTOM_CONFIG_FILE); >> - =A0 =A0 =A0 =A0next unless -e $candidate; >> - =A0 =A0 =A0 =A0# launder for -T >> - =A0 =A0 =A0 =A0($candidate) =3D $candidate =3D~ /^(.*)/; >> - =A0 =A0 =A0 =A0return $custom_config_path =3D $candidate; >> - =A0 =A0} >> - >> - =A0 =A0return ''; >> -} >> - >> -# tries to nuke all occurences of custom config >> -# used by things outside the A-T test suite >> -sub custom_config_nuke { >> - =A0 =A0my $cwd =3D fastcwd(); >> - >> - =A0 =A0# 1) create a fake empty (blib/)?lib/Apache/TestConfigData.pm >> - =A0 =A0# (don't delete it since it may mess up with MakeMaker) >> - =A0 =A0my $path =3D catfile $cwd, "lib", >> Apache::TestConfig::CUSTOM_CONFIG_FILE; >> - =A0 =A0# overwrite the empty stub >> - =A0 =A0Apache::TestConfig::custom_config_write($path, '') if -e $path; >> - >> - =A0 =A0$path =3D catfile $cwd, "blib", "lib", >> - =A0 =A0 =A0 =A0Apache::TestConfig::CUSTOM_CONFIG_FILE; >> - =A0 =A0if (-e $path) { >> - =A0 =A0 =A0 =A0my $mode =3D (stat _)[2]; >> - =A0 =A0 =A0 =A0my $mode_new =3D $mode | 0200; >> - =A0 =A0 =A0 =A0chmod $mode_new, $path; >> - =A0 =A0 =A0 =A0debug =A0"emptying $path"; >> - =A0 =A0 =A0 =A0Apache::TestConfig::custom_config_write($path, ''); >> - =A0 =A0 =A0 =A0chmod $mode, $path; >> - =A0 =A0} >> - >> - =A0 =A0# 2) go through @INC =3D ~/.apache-test and nuke any occurences= of >> - =A0 =A0# =A0 =A0CUSTOM_CONFIG_FILE >> - =A0 =A0my @inc =A0=3D (); >> - >> - =A0 =A0push @inc, catdir $ENV{HOME}, '.apache-test' if $ENV{HOME}; >> - >> - =A0 =A0push @inc, @INC; >> - >> - =A0 =A0for (@inc) { >> - =A0 =A0 =A0 =A0my $victim =3D File::Spec->rel2abs(catfile $_, CUSTOM_C= ONFIG_FILE); >> - =A0 =A0 =A0 =A0next unless -e $victim; >> - =A0 =A0 =A0 =A0debug "unlinking $victim"; >> - =A0 =A0 =A0 =A0unlink $victim; >> - =A0 =A0} >> -} >> - >> -sub custom_config_exists { >> - =A0 =A0# try to load custom config if it wasn't loaded yet (there are >> - =A0 =A0# many entry points to this API) >> - =A0 =A0custom_config_load(); >> - >> - =A0 =A0# it's enough to check whether we have a custom >> - =A0 =A0# config for 'httpd' or 'apxs'. >> - =A0 =A0my $httpd =3D $Apache::TestConfigData::vars->{httpd} || ''; >> - =A0 =A0return 1 if $httpd&& =A0-e $httpd&& =A0-x _; >> - >> - =A0 =A0my $apxs =3D $Apache::TestConfigData::vars->{apxs} || ''; >> - =A0 =A0return 1 if $apxs&& =A0-e $apxs&& =A0-x _; >> - >> - =A0 =A0return 0; >> -} >> - >> -# to be used only from Apache-Test/Makefile.PL to write the custom >> -# configuration module so it'll be copied to blib during 'make' and >> -# updated to use custom config data during 'make test' and then >> -# installed system-wide via 'make install' >> -# >> -# it gets written only if the custom configuration didn't exist >> -# already >> -sub custom_config_file_stub_write { >> - >> - =A0 =A0return if custom_config_exists(); >> - >> - =A0 =A0# It doesn't matter whether it gets written under modperl-2.0/l= ib >> - =A0 =A0# or Apache-Test/lib root, since Apache::TestRun uses the same >> - =A0 =A0# logic and will update that file with real config data, which >> - =A0 =A0# 'make install' will then pick and install system-wide. but >> - =A0 =A0# remember that $FindBin::Bin is the location of top-level >> - =A0 =A0# 'Makefile.PL' >> - =A0 =A0require FindBin; # load it only for this particular use >> - =A0 =A0my $path =3D catfile $FindBin::Bin, "lib", >> - =A0 =A0 =A0 =A0Apache::TestConfig::CUSTOM_CONFIG_FILE; >> - >> - =A0 =A0# write an empty stub >> - =A0 =A0Apache::TestConfig::custom_config_write($path, ''); >> -} >> - >> -sub custom_config_save { >> - =A0 =A0my $self =3D shift; >> - =A0 =A0my $conf_opts =3D shift; >> - >> - =A0 =A0if ($ENV{APACHE_TEST_NO_STICKY_PREFERENCES}) { >> - =A0 =A0 =A0 =A0debug "APACHE_TEST_NO_STICKY_PREFERENCES=3D1 =3D> =A0" = . >> - =A0 =A0 =A0 =A0 =A0 =A0"skipping save of custom config data"; >> - =A0 =A0 =A0 =A0return; >> - =A0 =A0} >> - >> - =A0 =A0my $vars =3D $self->{vars}; >> - =A0 =A0my $config_dump =3D ''; >> - >> - =A0 =A0# minimum httpd and/or apxs needs to be set >> - =A0 =A0return 0 unless $vars->{httpd} or >> $Apache::TestConfigData::vars->{httpd} >> - =A0 =A0 =A0 =A0or =A0 =A0 =A0 =A0 =A0$vars->{apxs} =A0or >> $Apache::TestConfigData::vars->{apxs}; >> - >> - =A0 =A0# it doesn't matter how these vars were set (httpd may or may n= ot >> - =A0 =A0# get set using the path to apxs, w/o an explicit -httpd value) >> - =A0 =A0for (@data_vars_must) { >> - =A0 =A0 =A0 =A0next unless my $var =3D $vars->{$_} || $conf_opts->{$_}= ; >> - =A0 =A0 =A0 =A0$config_dump .=3D qq{ =A0 =A0'$_' =3D> =A0'$var',\n}; >> - =A0 =A0} >> - >> - =A0 =A0# save these vars only if they were explicitly set via command = line >> - =A0 =A0# options. For example if someone builds A-T as user 'foo', the= n >> - =A0 =A0# installs it as root and we save it, all users will now try to >> - =A0 =A0# configure under that user 'foo' which won't quite work. >> - =A0 =A0for (@data_vars_opt) { >> - =A0 =A0 =A0 =A0next unless my $var =3D $conf_opts->{$_}; >> - =A0 =A0 =A0 =A0$config_dump .=3D qq{ =A0 =A0'$_' =3D> =A0'$var',\n}; >> - =A0 =A0} >> - >> - =A0 =A0if (IS_APACHE_TEST_BUILD) { >> - =A0 =A0 =A0 =A0my $path =3D catfile $vars->{top_dir}, 'lib', CUSTOM_CO= NFIG_FILE; >> - =A0 =A0 =A0 =A0# if it doesn't exist, then we already have a global co= nfig file >> - =A0 =A0 =A0 =A0# if it does, then we have need to update it and its bl= ib/ copy >> - =A0 =A0 =A0 =A0if (-e $path and custom_config_path_is_writable($path))= { >> - =A0 =A0 =A0 =A0 =A0 =A0custom_config_write($path, $config_dump); >> - =A0 =A0 =A0 =A0 =A0 =A0# also update blib/lib, since usually that's th= e one that >> - =A0 =A0 =A0 =A0 =A0 =A0# appears in @INC when t/TEST is run. and it wo= n't be >> - =A0 =A0 =A0 =A0 =A0 =A0# synced with blib/ unless 'make' was run >> - =A0 =A0 =A0 =A0 =A0 =A0my $blib_path =3D catfile $vars->{top_dir}, >> - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0'blib', 'lib', CUSTOM_CONFIG_FILE; >> - =A0 =A0 =A0 =A0 =A0 =A0if (-e $blib_path and >> custom_config_path_is_writable($blib_path)) { >> - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0custom_config_write($blib_path, $config= _dump); >> - =A0 =A0 =A0 =A0 =A0 =A0} >> - =A0 =A0 =A0 =A0 =A0 =A0return 1; >> - =A0 =A0 =A0 =A0} >> - =A0 =A0} >> - >> - =A0 =A0my $path; >> - =A0 =A0if ($path =3D custom_config_path() ) { >> - =A0 =A0 =A0 =A0# do nothing, the config file already exists (global) >> - =A0 =A0 =A0 =A0debug "Found custom config '$path'"; >> - =A0 =A0} >> - =A0 =A0elsif (File::Spec->file_name_is_absolute(__FILE__)) { >> - =A0 =A0 =A0 =A0# next try a global location, as if it was configured b= efore >> - =A0 =A0 =A0 =A0# Apache::Test's 'make install' (install in the same di= r as >> - =A0 =A0 =A0 =A0# Apache/TestRun.pm) >> - =A0 =A0 =A0 =A0# if the filename is not absolute that means that we ar= e still >> - =A0 =A0 =A0 =A0# in Apache-Test build (could just test for IS_APACHE_T= EST_BUILD) >> - =A0 =A0 =A0 =A0my $base =3D dirname dirname __FILE__; >> - =A0 =A0 =A0 =A0$path =3D catdir $base, CUSTOM_CONFIG_FILE; >> - =A0 =A0} >> - >> - =A0 =A0# check whether we can write to the directory of the chosen pat= h >> - =A0 =A0# (e.g. root-owned directory) >> - =A0 =A0if ($path and custom_config_path_is_writable($path)) { >> - =A0 =A0 =A0 =A0custom_config_write($path, $config_dump); >> - =A0 =A0 =A0 =A0return 1; >> - =A0 =A0} >> - =A0 =A0# if we have no writable path yet, try to use ~ >> - =A0 =A0elsif ($ENV{HOME}) { >> - =A0 =A0 =A0 =A0$path =3D catfile $ENV{HOME}, '.apache-test', CUSTOM_CO= NFIG_FILE; >> - =A0 =A0 =A0 =A0if ($path and custom_config_path_is_writable($path)) { >> - =A0 =A0 =A0 =A0 =A0 =A0custom_config_write($path, $config_dump); >> - =A0 =A0 =A0 =A0 =A0 =A0return 1; >> - =A0 =A0 =A0 =A0} >> - =A0 =A0} >> - >> - =A0 =A0# XXX: should we croak since we failed to write config >> - =A0 =A0error "Failed to find a config file to save the custom " . >> - =A0 =A0 =A0 =A0"configuration in"; >> - =A0 =A0return 0; >> -} >> - >> -sub custom_config_path_is_writable { >> - =A0 =A0my $path =3D shift; >> - >> - =A0 =A0return 0 unless $path; >> - >> - =A0 =A0my $file_created =A0 =A0=3D ''; >> - =A0 =A0my $top_dir_created =3D ''; >> - =A0 =A0# first make sure that the file is writable if it exists >> - =A0 =A0# already (it might be non-writable if installed via EU::MM or = in >> - =A0 =A0# blib/) >> - =A0 =A0if (-e $path) { >> - =A0 =A0 =A0 =A0my $mode =3D (stat _)[2]; >> - =A0 =A0 =A0 =A0$mode |=3D 0200; >> - =A0 =A0 =A0 =A0chmod $mode, $path; # it's ok if we fail >> - =A0 =A0 =A0 =A0# keep it writable if we have changed it from not being= one >> - =A0 =A0 =A0 =A0# so that custom_config_save will be able to just overw= rite it >> - =A0 =A0} >> - =A0 =A0else { >> - =A0 =A0 =A0 =A0my $dir =3D dirname $path; >> - =A0 =A0 =A0 =A0if ($dir and !-e $dir) { >> - =A0 =A0 =A0 =A0 =A0 =A0my @dirs =3D File::Path::mkpath($dir, 0, 0755); >> - =A0 =A0 =A0 =A0 =A0 =A0# the top level dir to nuke on cleanup if it wa= s created >> - =A0 =A0 =A0 =A0 =A0 =A0$top_dir_created =3D shift @dirs if @dirs; >> - =A0 =A0 =A0 =A0} >> - =A0 =A0 =A0 =A0# not really create yet, but will be in the moment >> - =A0 =A0 =A0 =A0$file_created =3D 1; >> - =A0 =A0} >> - >> - =A0 =A0# try to open for append (even though it may not exist >> - =A0 =A0my $fh =3D Symbol::gensym; >> - =A0 =A0if (open $fh, ">>$path") { >> - =A0 =A0 =A0 =A0close $fh; >> - =A0 =A0 =A0 =A0# cleanup if we just created the file >> - =A0 =A0 =A0 =A0unlink $path if $file_created; >> - =A0 =A0 =A0 =A0File::Path::rmtree([$top_dir_created], 0, 0) if $top_di= r_created; >> - =A0 =A0 =A0 =A0return 1; >> - =A0 =A0} >> - >> - =A0 =A0return 0; >> -} >> - >> -sub custom_config_write { >> - =A0 =A0my($path, $config_dump) =3D @_; >> - >> - =A0 =A0my $pkg =3D<< =A0"EOC"; >> -package Apache::TestConfigData; >> - >> -use strict; >> -use warnings; >> - >> -\$Apache::TestConfigData::vars =3D { >> -$config_dump >> -}; >> - >> -1; >> - >> -=3Dhead1 NAME >> - >> -Apache::TestConfigData - Configuration file for Apache::Test >> - >> -=3Dcut >> -EOC >> - >> - =A0 =A0debug "Writing custom config $path"; >> - =A0 =A0my $dir =3D dirname $path; >> - =A0 =A0File::Path::mkpath($dir, 0, 0755) unless -e $dir; >> - =A0 =A0my $fh =3D Symbol::gensym; >> - =A0 =A0open $fh, ">$path" or die "Cannot open $path: $!"; >> - =A0 =A0print $fh $pkg; >> - =A0 =A0close $fh; >> -} >> - >> -sub custom_config_add_conf_opts { >> - =A0 =A0my $args =3D shift; >> - >> - =A0 =A0return unless $Apache::TestConfigData::vars and >> - =A0 =A0 =A0 =A0keys %$Apache::TestConfigData::vars; >> - >> - =A0 =A0debug "overlaying custom config data"; >> - >> - =A0 =A0# the logic is quite complicated with 'httpd' and 'apxs', since >> - =A0 =A0# one is enough to run the test suite, and we need to avoid the >> - =A0 =A0# situation where both are saved in custom config but only one >> - =A0 =A0# (let's say httpd) is overriden by the command line /env var a= nd >> - =A0 =A0# a hell may break loose if we take that overriden httpd value = and >> - =A0 =A0# also use apxs from custom config which could point to a diffe= rent >> - =A0 =A0# server. So if there is an override of apxs or httpd, do not u= se >> - =A0 =A0# the custom config for apxs or httpd. >> - =A0 =A0my $vars_must_overriden =3D grep { >> - =A0 =A0 =A0 =A0$ENV{ $vars_to_env{$_} } || $args->{$_} >> - =A0 =A0} @data_vars_must; >> - >> - =A0 =A0# mod_perl 2.0 build always knows the right httpd location (and >> - =A0 =A0# optionally apxs) >> - =A0 =A0$vars_must_overriden++ if IS_MOD_PERL_2_BUILD(); >> - >> - =A0 =A0unless ($vars_must_overriden) { >> - =A0 =A0 =A0 =A0for (@data_vars_must) { >> - =A0 =A0 =A0 =A0 =A0 =A0next unless $Apache::TestConfigData::vars->{$_}= ; >> - =A0 =A0 =A0 =A0 =A0 =A0$args->{$_} =3D $Apache::TestConfigData::vars->= {$_}; >> - =A0 =A0 =A0 =A0} >> - =A0 =A0} >> - >> - =A0 =A0for (@data_vars_opt) { >> - =A0 =A0 =A0 =A0next unless $Apache::TestConfigData::vars->{$_}; >> - =A0 =A0 =A0 =A0# env vars override custom config >> - =A0 =A0 =A0 =A0my $env_value =3D $ENV{ $vars_to_env{$_} }; >> - =A0 =A0 =A0 =A0next unless defined $env_value and length $env_value; >> - =A0 =A0 =A0 =A0$args->{$_} ||=3D $Apache::TestConfigData::vars->{$_}; >> - =A0 =A0} >> -} >> - >> -my $custom_config_loaded =3D 0; >> -sub custom_config_load { >> - >> - =A0 =A0if ($ENV{APACHE_TEST_NO_STICKY_PREFERENCES}) { >> - =A0 =A0 =A0 =A0debug "APACHE_TEST_NO_STICKY_PREFERENCES=3D1 =3D> =A0" = . >> - =A0 =A0 =A0 =A0 =A0 =A0"skipping load of custom config data"; >> - =A0 =A0 =A0 =A0return; >> - =A0 =A0} >> - >> - =A0 =A0if ($ENV{APACHE_TEST_INTERACTIVE_CONFIG_TEST}) { >> - =A0 =A0 =A0 =A0debug "APACHE_TEST_INTERACTIVE_CONFIG_TEST=3D1 =3D> =A0= " . >> - =A0 =A0 =A0 =A0 =A0 =A0"skipping load of custom config data"; >> - =A0 =A0 =A0 =A0return; >> - =A0 =A0} >> - >> - =A0 =A0return if $custom_config_loaded; >> - >> - =A0 =A0if (my $custom_config_path =3D custom_config_path()) { >> - =A0 =A0 =A0 =A0debug "loading custom config data from: '$custom_config= _path'"; >> - =A0 =A0 =A0 =A0$custom_config_loaded++; >> - =A0 =A0 =A0 =A0require $custom_config_path; >> - =A0 =A0} >> - =A0 =A0else { >> - =A0 =A0 =A0 =A0debug "no custom config data was loaded"; >> - =A0 =A0} >> -} >> - >> -sub custom_config_first_time { >> - =A0 =A0my $self =3D shift; >> - =A0 =A0my $conf_opts =3D shift; >> - >> - =A0 =A0# we can't prompt when STDIN is not attached to tty, unless we >> - =A0 =A0# were told that's it OK via env var (in which case some progra= m >> - =A0 =A0# will feed the interactive prompts >> - =A0 =A0unless (-t STDIN || $ENV{APACHE_TEST_INTERACTIVE_PROMPT_OK}) { >> - =A0 =A0 =A0 =A0error "STDIN is not attached to tty, skip interactive c= onfig"; >> - =A0 =A0 =A0 =A0Apache::TestRun::skip_test_suite(); >> - =A0 =A0} >> - >> - =A0 =A0my $vars =3D $self->{vars}; >> - >> - =A0 =A0print qq[ >> - >> -We are now going to configure the Apache-Test framework. >> -This configuration process needs to be done only once. >> - >> -]; >> - >> - =A0 =A0print qq[ >> - >> -First we need to know where the 'httpd' executable is located. >> -If you have more than one Apache server is installed, make sure >> -you supply the path to the one you are going to use for testing. >> -You can always override this setting at run time via the '-httpd' >> -option. For example: >> - >> - =A0% t/TEST -httpd /path/to/alternative/httpd >> - >> -or via the environment variable APACHE_TEST_HTTPD. For example: >> - >> - =A0% APACHE_TEST_HTTPD=3D/path/to/alternative/httpd t/TEST >> - >> -If for some reason you want to skip the test suite, type: skip >> -]; >> - >> - =A0 =A0{ >> - =A0 =A0 =A0 =A0my %choices =3D (); >> - =A0 =A0 =A0 =A0my @tries =3D qw(httpd httpd2); >> - =A0 =A0 =A0 =A0# Win32 uses Apache not apache >> - =A0 =A0 =A0 =A0push @tries, WIN32 ? qw(Apache) : qw(apache); >> - =A0 =A0 =A0 =A0for (grep defined $_, >> - =A0 =A0 =A0 =A0 =A0 =A0 map({ catfile $vars->{$_}, $vars->{target} } q= w(sbindir >> bindir)), >> - =A0 =A0 =A0 =A0 =A0 =A0 $self->default_httpd, which($vars->{target}), >> - =A0 =A0 =A0 =A0 =A0 =A0 $ENV{APACHE}, $ENV{APACHE2}, >> - =A0 =A0 =A0 =A0 =A0 =A0 $ENV{APACHE_TEST_HTTPD}, $ENV{APACHE_TEST_HTTP= D2}, >> - =A0 =A0 =A0 =A0 =A0 =A0 map {which($_)} @tries) { >> - =A0 =A0 =A0 =A0 =A0 =A0$choices{$_}++ if -e $_&& =A0-x _; >> - =A0 =A0 =A0 =A0} >> - =A0 =A0 =A0 =A0my $optional =3D 0; >> - =A0 =A0 =A0 =A0my $wanted =3D 'httpd'; >> - =A0 =A0 =A0 =A0$vars->{$wanted} =3D >> - =A0 =A0 =A0 =A0 =A0 =A0_custom_config_prompt_path($wanted, \%choices, = $optional); >> - =A0 =A0} >> - >> - =A0 =A0print qq[ >> - >> -Next we need to know where the 'apxs' script is located. This script >> -provides a lot of information about the apache installation, and makes >> -it easier to find things. However it's not available on all platforms, >> -therefore it's optional. >> - >> -If you don't have it installed it's not a problem. Just press Enter. >> - >> -Notice that if you have Apache 2.x installed that script could be >> -called as 'apxs2'. >> - >> -If you have more than one Apache server is installed, make sure you >> -supply the path to the apxs script you are going to use for testing. >> -You can always override this setting at run time via the '-apxs' >> -option. For example: >> - >> - =A0% t/TEST -apxs /path/to/alternative/apxs >> - >> -or via the environment variable APACHE_TEST_APXS. For example: >> - >> - =A0% APACHE_TEST_APXS=3D/path/to/alternative/apxs t/TEST >> - >> -]; >> - =A0 =A0{ >> - =A0 =A0 =A0 =A0my %choices =3D (); >> - =A0 =A0 =A0 =A0for (grep defined $_, >> - =A0 =A0 =A0 =A0 =A0 =A0 map({ catfile $vars->{$_}, 'apxs' } qw(sbindir= bindir)), >> - =A0 =A0 =A0 =A0 =A0 =A0 $self->default_apxs, >> - =A0 =A0 =A0 =A0 =A0 =A0 $ENV{APXS}, =A0$ENV{APACHE_TEST_APXS}, =A0whic= h('apxs'), >> - =A0 =A0 =A0 =A0 =A0 =A0 $ENV{APXS2}, $ENV{APACHE_TEST_APXS2}, which('a= pxs2')) { >> - =A0 =A0 =A0 =A0 =A0 =A0$choices{$_}++ if -e $_&& =A0-x _; >> - =A0 =A0 =A0 =A0} >> - =A0 =A0 =A0 =A0my $optional =3D 1; >> - =A0 =A0 =A0 =A0my $wanted =3D 'apxs'; >> - =A0 =A0 =A0 =A0$vars->{$wanted} =3D >> - =A0 =A0 =A0 =A0 =A0 =A0_custom_config_prompt_path($wanted, \%choices, = $optional); >> - =A0 =A0} >> - >> - =A0 =A0$self->custom_config_save($conf_opts); >> - >> - =A0 =A0# we probably could reconfigure on the fly ($self->configure), = but >> - =A0 =A0# the problem is various cached data which won't be refreshed. = so >> - =A0 =A0# the simplest is just to restart the run from scratch >> - =A0 =A0Apache::TestRun::rerun($vars); >> -} >> - >> -sub _custom_config_prompt_path { >> - =A0 =A0my($wanted, $rh_choices, $optional) =3D @_; >> - >> - =A0 =A0my $ans; >> - =A0 =A0my $default =3D ''; >> - =A0 =A0my $optional_str =3D $optional ? " (optional)" : ''; >> - =A0 =A0my $prompt =3D >> - =A0 =A0 =A0 =A0"\nPlease provide a full path to$optional_str '$wanted' >> executable"; >> - >> - =A0 =A0my @choices =3D (); >> - =A0 =A0if (%$rh_choices) { >> - =A0 =A0 =A0 =A0$prompt .=3D " or choose from the following options:\n\= n"; >> - =A0 =A0 =A0 =A0my $c =3D 0; >> - =A0 =A0 =A0 =A0for (sort keys %$rh_choices) { >> - =A0 =A0 =A0 =A0 =A0 =A0$c++; >> - =A0 =A0 =A0 =A0 =A0 =A0$prompt .=3D " =A0 =A0[$c] $_\n"; >> - =A0 =A0 =A0 =A0 =A0 =A0push @choices, $_; >> - =A0 =A0 =A0 =A0} >> - =A0 =A0 =A0 =A0$prompt .=3D " \n"; >> - =A0 =A0 =A0 =A0$default =3D 1; # a wild guess >> - =A0 =A0} >> - =A0 =A0else { >> - =A0 =A0 =A0 =A0$prompt .=3D ":\n\n"; >> - =A0 =A0} >> - >> - =A0 =A0my $i =3D 0; >> - =A0 =A0while (1) { >> - >> - =A0 =A0 =A0 =A0# prevent infinite loops in smoke tests, only give the = user >> - =A0 =A0 =A0 =A0# five chances to specify httpd or apxs before giving u= p >> - =A0 =A0 =A0 =A0if ($i++ =3D=3D 5) { >> - >> - =A0 =A0 =A0 =A0 =A0 =A0Apache::TestRun::skip_test_suite('y'); >> - =A0 =A0 =A0 =A0 =A0 =A0return; >> - =A0 =A0 =A0 =A0} >> - >> - =A0 =A0 =A0 =A0$ans =3D ExtUtils::MakeMaker::prompt($prompt, $default)= ; >> - >> - =A0 =A0 =A0 =A0# strip leading/closing spaces >> - =A0 =A0 =A0 =A0$ans =3D~ s/^\s*|\s*$//g; >> - >> - =A0 =A0 =A0 =A0# convert the item number to the path >> - =A0 =A0 =A0 =A0if ($ans =3D~ /^(\d+)$/) { >> - =A0 =A0 =A0 =A0 =A0 =A0if ($1> =A00 and $choices[$1-1]) { >> - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0$ans =3D $choices[$1-1]; >> - =A0 =A0 =A0 =A0 =A0 =A0} >> - =A0 =A0 =A0 =A0 =A0 =A0else { >> - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0warn "The choice '$ans' doesn't exist\n= "; >> - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0next; >> - =A0 =A0 =A0 =A0 =A0 =A0} >> - =A0 =A0 =A0 =A0} >> - >> - =A0 =A0 =A0 =A0if ($optional) { >> - =A0 =A0 =A0 =A0 =A0 =A0return '' unless $ans; >> - =A0 =A0 =A0 =A0} >> - >> - =A0 =A0 =A0 =A0# stop the test suite without an error (so automatic to= ols >> - =A0 =A0 =A0 =A0# like CPAN.pm will be able to continue) >> - =A0 =A0 =A0 =A0if (lc($ans) eq 'skip'&& =A0!$optional) { >> - =A0 =A0 =A0 =A0 =A0 =A0Apache::TestRun::skip_test_suite(); >> - =A0 =A0 =A0 =A0 =A0 =A0next; # in case they change their mind >> - =A0 =A0 =A0 =A0} >> - >> - =A0 =A0 =A0 =A0unless (File::Spec->file_name_is_absolute($ans)) { >> - =A0 =A0 =A0 =A0 =A0 =A0warn "The path '$ans' is not an absolute path. = " . >> - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0"Please specify an absolute path\n"; >> - =A0 =A0 =A0 =A0 =A0 =A0next; >> - =A0 =A0 =A0 =A0} >> - >> - =A0 =A0 =A0 =A0warn("'$ans' doesn't exist.\n"), =A0 =A0 next unless -e= $ans; >> - =A0 =A0 =A0 =A0warn("'$ans' is not a file.\n"), =A0 =A0 next unless -f= _; >> - =A0 =A0 =A0 =A0warn("'$ans' is not executable.\n"), next unless -x _; >> - >> - =A0 =A0 =A0 =A0return $ans; >> - =A0 =A0} >> -} >> >> =A01; >> >> @@ -2605,13 +2086,6 @@ configuration phase (C, >> =A0automatically unshift the I =A0directory into C<@INC>, v= ia >> =A0the autogenerated I =A0file. >> >> -=3Dhead2 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). >> - >> >> =A0=3Dhead1 Special Placeholders >> >> >> Modified: perl/Apache-Test/trunk/lib/Apache/TestRun.pm >> URL: >> http://svn.apache.org/viewvc/perl/Apache-Test/trunk/lib/Apache/TestRun.p= m?rev=3D1022689&r1=3D1022688&r2=3D1022689&view=3Ddiff >> >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D >> --- perl/Apache-Test/trunk/lib/Apache/TestRun.pm (original) >> +++ perl/Apache-Test/trunk/lib/Apache/TestRun.pm Thu Oct 14 20:17:26 201= 0 >> @@ -89,7 +89,6 @@ my %usage =3D ( >> =A0 =A0'proxy' =A0 =A0 =A0 =A0 =A0 =3D> =A0'proxy requests (default prox= y is localhost)', >> =A0 =A0'trace=3DT' =A0 =A0 =A0 =A0 =3D> =A0'change tracing default to: w= arning, notice, ' . >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 'info, debug, ...', >> - =A0 'save' =A0 =A0 =A0 =A0 =A0 =A0=3D> =A0'save test paramaters into >> Apache::TestConfigData', >> =A0 =A0'one-process' =A0 =A0 =3D> =A0'run the server in single process m= ode', >> =A0 =A0(map { $_, "\U$_\E url" } @request_opts), >> =A0); >> @@ -506,13 +505,6 @@ sub configure { >> =A0 =A0 $test_config->generate_httpd_conf; >> =A0 =A0 $test_config->save; >> >> - =A0 =A0# custom config save if >> - =A0 =A0# 1) requested to save >> - =A0 =A0# 2) no saved config yet >> - =A0 =A0if ($self->{opts}->{save} or >> - =A0 =A0 =A0 =A0!Apache::TestConfig::custom_config_exists()) { >> - =A0 =A0 =A0 =A0$test_config->custom_config_save($self->{conf_opts}); >> - =A0 =A0} >> =A0} >> >> =A0sub try_exit_opts { >> @@ -685,9 +677,6 @@ sub run { >> >> =A0 =A0 $self->getopts(\@argv); >> >> - =A0 =A0# must be called after getopts so the tracing will be set right >> - =A0 =A0Apache::TestConfig::custom_config_load(); >> - >> =A0 =A0 $self->pre_configure(); >> >> =A0 =A0 # can't setup the httpd-specific parts of the config object yet >> @@ -1146,44 +1135,6 @@ sub exit_shell { >> =A0 =A0 CORE::exit $_[0]; >> =A0} >> >> -# successfully abort the test suite execution (to allow automatic >> -# tools like CPAN.pm, to continue with installation). >> -# >> -# if a true value is passed, quit right away >> -# otherwise ask the user, if they may want to change their mind which >> -# will return them back to where they left >> -sub skip_test_suite { >> - =A0 =A0my $no_doubt =3D shift; >> - >> - =A0 =A0# we can't prompt when STDIN is not attached to tty, unless we >> - =A0 =A0# were told that's it OK via env var (in which case some progra= m >> - =A0 =A0# will feed the interactive prompts). =A0Also skip the prompt i= f the >> - =A0 =A0# automated testing environment variable is set. >> - =A0 =A0unless (-t STDIN || $ENV{APACHE_TEST_INTERACTIVE_PROMPT_OK} >> - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 || !$ENV{AUTOMATED_TESTING} ) = { >> - =A0 =A0 =A0 =A0$no_doubt =3D 1; >> - =A0 =A0} >> - >> - =A0 =A0print qq[ >> - >> -Running the test suite is important to make sure that the module that >> -you are about to install works on your system. If you choose not to >> -run the test suite and you have a problem using this module, make sure >> -to return and run this test suite before reporting any problems to the >> -developers of this module. >> - >> -]; >> - =A0 =A0unless ($no_doubt) { >> - =A0 =A0 =A0 =A0my $default =3D 'No'; >> - =A0 =A0 =A0 =A0my $prompt =3D 'Skip the test suite?'; >> - =A0 =A0 =A0 =A0my $ans =3D ExtUtils::MakeMaker::prompt($prompt, $defau= lt); >> - =A0 =A0 =A0 =A0return if lc($ans) =3D~ /no/; >> - =A0 =A0} >> - >> - =A0 =A0error "Skipping the test suite execution, while returning succe= ss >> status"; >> - =A0 =A0exit_perl 1; >> -} >> - >> =A01; >> >> =A0__END__ >> @@ -1270,153 +1221,4 @@ Don't forget to run the super class' c

> >> =A0META: to be completed >> >> - >> - >> -=3Dhead1 Persistent Custom Configuration >> - >> -When C =A0is first installed or used, it will save the >> -values of C, C, C, C, and C, if set, >> -to a configuration file C. =A0This information >> -will then be used in setting these options for subsequent uses of >> -C =A0unless temprorarily overridden, either by setting the >> -appropriate environment variable (C, >> -C, C, C, and >> -C) or by giving the relevant option (C<-httpd>, >> -C<-apxs>, C<-port>, C<-user>, and C<-group>) when the C =A0script >> -is run. >> - >> -To avoid either using previous persistent configurations or saving >> -current configurations, set the C >> -environment variable to a true value. >> - >> -Finally it's possible to permanently override the previously saved >> -options by passing C>. >> - >> -Here is the algorithm of how and when options are saved for the first >> -time and when they are used. We will use a few variables to simplify >> -the pseudo-code/pseudo-chart flow: >> - >> -C<$config_exists> =A0- custom configuration has already been saved, to >> -get this setting run C, which tests whether >> -either C =A0or C =A0values are set. It doesn't check for o= ther >> -values, since all we need is C =A0or C =A0to get the test = suite >> -running. custom_config_exists() checks in the following order >> -F =A0(if during Apache-Test build) , >> -F<~/.apache-test/Apache/TestConfigData.pm> =A0and >> -F =A0in the perl's libraries. >> - >> -C<$config_overriden> =A0- that means that we have either C =A0or >> -C =A0values provided by user, via env vars or command line optio= ns. >> - >> -=3Dover >> - >> -=3Ditem 1 Building Apache-Test or modperl-2.0 (or any other project tha= t >> -bundles Apache-Test). >> - >> - =A01) perl Apache-Test/Makefile.PL >> - =A0(for bundles top-level Makefile.PL will run this as well) >> - >> - =A0if $config_exists >> - =A0 =A0 =A0do nothing >> - =A0else >> - =A0 =A0 =A0create lib/Apache/TestConfigData.pm w/ empty config: {} >> - >> - =A02) make >> - >> - =A03) make test >> - >> - =A0if $config_exists >> - =A0 =A0 =A0if $config_overriden >> - =A0 =A0 =A0 =A0 =A0override saved options (for those that were overrid= en) >> - =A0 =A0 =A0else >> - =A0 =A0 =A0 =A0 =A0use saved options >> - =A0else >> - =A0 =A0 =A0if $config_overriden >> - =A0 =A0 =A0 =A0 =A0save them in lib/Apache/TestConfigData.pm >> - =A0 =A0 =A0 =A0 =A0(which will be installed on 'make install') >> - =A0 =A0 =A0else >> - =A0 =A0 =A0 =A0 =A0- run interactive prompt for C =A0and option= ally for >> C >> - =A0 =A0 =A0 =A0 =A0- save the custom config in lib/Apache/TestConfigDa= ta.pm >> - =A0 =A0 =A0 =A0 =A0- restart the currently run program >> - >> - =A0modperl-2.0 is a special case in (3). it always overrides 'httpd' >> - =A0and 'apxs' settings. Other settings like 'port', can be used from >> - =A0the saved config. >> - >> - =A04) make install >> - >> - =A0 =A0 if $config_exists only in lib/Apache/TestConfigData.pm >> - =A0 =A0 =A0 =A0it will be installed system-wide >> - =A0 =A0 else >> - =A0 =A0 =A0 =A0nothing changes (since lib/Apache/TestConfigData.pm won= 't exist) >> - >> -=3Ditem 2 Testing 3rd party modules (after Apache-Test was installed) >> - >> -Notice that the following situation is quite possible: >> - >> - =A0cd Apache-Test >> - =A0perl Makefile.PL&& =A0make install >> - >> -so that Apache-Test was installed but no custom configuration saved >> -(since its C =A0wasn't run). In which case the interactive >> -configuration should kick in (unless config options were passed) and >> -in any case saved once configured. >> - >> -C<$custom_config_path> =A0- perl's F =A0(at t= he >> -same location as F) if that area is writable by >> -that user (e.g. perl's lib is not owned by 'root'). If not, in >> -F<~/.apache-test/Apache/TestConfigData.pm>. >> - >> - =A01) perl Apache-Test/Makefile.PL >> - =A02) make >> - =A03) make test >> - >> - =A0if $config_exists >> - =A0 =A0 =A0if $config_overriden >> - =A0 =A0 =A0 =A0 =A0override saved options (for those that were overrid= en) >> - =A0 =A0 =A0else >> - =A0 =A0 =A0 =A0 =A0use saved options >> - =A0else >> - =A0 =A0 =A0if $config_overriden >> - =A0 =A0 =A0 =A0 =A0save them in $custom_config_path >> - =A0 =A0 =A0else >> - =A0 =A0 =A0 =A0 =A0- run interactive prompt for C =A0and option= ally for >> C >> - =A0 =A0 =A0 =A0 =A0- save the custom config in $custom_config_path >> - =A0 =A0 =A0 =A0 =A0- restart the currently run program >> - >> - =A04) make install >> - >> -=3Dback >> - >> - >> - >> -=3Dhead2 Saving Custom Configuration Options >> - >> -If you want to override the existing custom configurations options to >> -C, use the C<-save> =A0flag when running C. >> - >> -If you are running C =A0as a user who does not have >> -permission to alter the system C, you can >> -place your own private configuration file F =A0under >> -C<$ENV{HOME}/.apache-test/Apache/>, which C =A0will use, = if >> -present. An example of such a configuration file is >> - >> - =A0# file $ENV{HOME}/.apache-test/Apache/TestConfigData.pm >> - =A0package Apache::TestConfigData; >> - =A0use strict; >> - =A0use warnings; >> - =A0use vars qw($vars); >> - >> - =A0$vars =3D { >> - =A0 =A0 =A0'group' =3D> =A0'me', >> - =A0 =A0 =A0'user' =3D> =A0'myself', >> - =A0 =A0 =A0'port' =3D> =A0'8529', >> - =A0 =A0 =A0'httpd' =3D> =A0'/usr/local/apache/bin/httpd', >> - >> - =A0}; >> - =A01; >> - >> - >> - >> - >> =A0=3Dcut >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org >> For additional commands, e-mail: dev-help@perl.apache.org >> >> > > --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org For additional commands, e-mail: dev-help@perl.apache.org