Before we can try to improve the problems with A-T config issues, we need a test suite. Since until now, every fix was breaking 10 other things.

So I've started working on one. It's probably going to change a lot, but I have a working prototype. In order to use it apply the attached patch against Apache-Test/ and run:

perl Makefile.PL

now the t_c/TEST script runs the tests against Apache-Test, modperl-2.0, other CPAN modules.

All you need to do is to supply a config file for each group of the above tests. For example:

I run this against Apache-Test:

t_c/TEST -v -base ~/work/modules/Apache-VMonitor-2.0 -config ~/.apache-test/apache_test_config.pm

where ~/.apache-test/apache_test_config.pm contains:

@Apache::TestItSelf::Configs = (
    {
     apxs_exec     => '/home/stas/httpd/prefork/bin/apxs',
     httpd_exec    => '/home/stas/httpd/prefork/bin/httpd',
     perl_exec     => '/home/stas/perl/5.8.5-ithread/bin/perl5.8.5',
     mp_gen        => 2.0,
     httpd_gen     => 2.0,
     httpd_version => 'Apache/2.0.53-dev',
     httpd_mpm     => 'prefork',
     makepl_arg    => '-libmodperl mod_perl-5.8.5-ithread.so',
     timeout       => 200,
    },
    {
     apxs_exec     => '/home/stas/httpd/worker/bin/apxs',
     httpd_exec    => '/home/stas/httpd/worker/bin/httpd',
     perl_exec     => '/home/stas/perl/5.8.5-ithread/bin/perl5.8.5',
     mp_gen        => 2.0,
     httpd_gen     => 2.0,
     httpd_version => 'Apache/2.0.53-dev',
     httpd_mpm     => 'worker',
     makepl_arg    => '-libmodperl mod_perl-5.8.5-ithread.so',
     timeout       => 200,
    },

);


1;

Next I run the same tests against Apache-VMonitor-2.0 (or any other module that deployes A-T):

t_c/TEST -v -base ~/work/modules/Apache-VMonitor-2.0 -config ~/.apache-test/apache2_modules_testitself_config.pm

where ~/.apache-test/apache2_modules_testitself_config.pm is:

@Apache::TestItSelf::Configs = (
    {
     apxs_exec     => '/home/stas/httpd/prefork/bin/apxs',
     httpd_exec    => '/home/stas/httpd/prefork/bin/httpd',
     perl_exec     => '/home/stas/perl/5.8.5-ithread/bin/perl5.8.5',
     mp_gen        => 2.0,
     httpd_gen     => 2.0,
     httpd_version => 'Apache/2.0.53-dev',
     httpd_mpm     => 'prefork',
     makepl_arg    => 'MOD_PERL=2 -libmodperl mod_perl-5.8.5-ithread.so',
     timeout       => 200,
     test_verbose  => 0,
    },
    {
     apxs_exec     => '/home/stas/httpd/worker/bin/apxs',
     httpd_exec    => '/home/stas/httpd/worker/bin/httpd',
     perl_exec     => '/home/stas/perl/5.8.5-ithread/bin/perl5.8.5',
     mp_gen        => 2.0,
     httpd_gen     => 2.0,
     httpd_version => 'Apache/2.0.53-dev',
     httpd_mpm     => 'worker',
     makepl_arg    => 'MOD_PERL=2 -libmodperl mod_perl-5.8.5-ithread.so',
     timeout       => 200,
     test_verbose  => 0,
    },

);

1;

and finally modperl-2.0:

t_c/TEST -v -base ~/apache.org/mp2-cvs -config ~/.apache-test/modperl2_testitself_config.pm t_c/httpd_arg.t

where ~/.apache-test/modperl2_testitself_config.pm

@Apache::TestItSelf::Configs = (
{
apxs_exec => '/home/stas/httpd/prefork/bin/apxs',
httpd_exec => '/home/stas/httpd/prefork/bin/httpd',
perl_exec => '/home/stas/perl/5.8.5-ithread/bin/perl5.8.5',
mp_gen => 2.0,
httpd_gen => 2.0,
httpd_version => 'Apache/2.0.53-dev',
httpd_mpm => 'prefork',
makepl_arg => 'MP_APXS=/home/stas/httpd/prefork/bin/apxs MP_INST_APACHE2=1 MP_MAINTAINER=1',
timeout => 900,
},
{
apxs_exec => '/home/stas/httpd/worker/bin/apxs',
httpd_exec => '/home/stas/httpd/worker/bin/httpd',
perl_exec => '/home/stas/perl/5.8.5-ithread/bin/perl5.8.5',
mp_gen => 2.0,
httpd_gen => 2.0,
httpd_version => 'Apache/2.0.53-dev',
httpd_mpm => 'worker',
makepl_arg => 'MP_APXS=/home/stas/httpd/worker/bin/apxs MP_INST_APACHE2=1 MP_MAINTAINER=1',
timeout => 900,
},


);

1;

t_c/interactive.t can't be run with modperl-2.0. I'm going to add the skip mechanism via the config files.

(The only practical problem I see at the moment is that things are pretty slow... but it's better than no tests suite at all).

The config files are going to evolve and the key names will change too...

At the moment there are only 2 test files, more will be added as things evolve.

Comments are welcome. I'd like to start committing things after some additional polish if there are no objections.

--
__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com
Index: Makefile.PL
===================================================================
RCS file: /home/cvs/httpd-test/perl-framework/Apache-Test/Makefile.PL,v
retrieving revision 1.24
diff -u -u -r1.24 Makefile.PL
--- Makefile.PL 27 Sep 2004 04:16:22 -0000      1.24
+++ Makefile.PL 3 Nov 2004 00:45:48 -0000
@@ -16,6 +16,7 @@
 use Apache::TestMM qw(test clean); #enable 'make test and make clean'
 use Apache::TestRun;
 use Apache::TestTrace;
+use Apache::TestReport;
 use Apache::TestConfig ();
 
 my $VERSION;
@@ -25,11 +26,12 @@
 
 Apache::TestMM::filter_args();
 
-my @scripts = qw(t/TEST);
+my @scripts = qw(t/TEST t_c/TEST);
 
 for (@scripts) {
     Apache::TestMM::generate_script($_);
 }
+Apache::TestReport->generate_script;
 
 
 # if built with mod_perl 2.0, its top-level Makefile.PL already
Index: lib/Apache/TestConfig.pm
===================================================================
RCS file: 
/home/cvs/httpd-test/perl-framework/Apache-Test/lib/Apache/TestConfig.pm,v
retrieving revision 1.254
diff -u -u -r1.254 TestConfig.pm
--- lib/Apache/TestConfig.pm    28 Oct 2004 23:03:29 -0000      1.254
+++ lib/Apache/TestConfig.pm    3 Nov 2004 00:45:48 -0000
@@ -1825,6 +1825,44 @@
     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;
+        error "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)
Index: t/conf/modperl_extra.pl.in
===================================================================
RCS file: 
/home/cvs/httpd-test/perl-framework/Apache-Test/t/conf/modperl_extra.pl.in,v
retrieving revision 1.1
diff -u -u -r1.1 modperl_extra.pl.in
--- t/conf/modperl_extra.pl.in  15 Oct 2004 04:32:36 -0000      1.1
+++ t/conf/modperl_extra.pl.in  3 Nov 2004 00:45:48 -0000
@@ -3,7 +3,15 @@
 
 use File::Spec ();
 
-use lib ();  # empty so we can calculate the lib to use
+BEGIN {
+    use Carp;
+    $SIG{__DIE__} = \&Carp::confess;
+}
+
+#use lib ();  # empty so we can calculate the lib to use
+
+#use Config ();
+eval { require lib };
 
 my @libs = (File::Spec->catfile('@ServerRoot@', 'response'),
             File::Spec->catfile('@ServerRoot@', qw(.. lib)));

--- /dev/null   1969-12-31 19:00:00.000000000 -0500
+++ t_c/httpd_arg.t     2004-11-01 19:47:57.000000000 -0500
@@ -0,0 +1,115 @@
+#
+# basic testing with -httpd argument passed explicitly (to
+# Makefile.PL, to t/TEST, etc.)
+#
+
+use strict;
+use warnings FATAL => 'all';
+
+use Test::More;
+use MyTest::Util qw(myrun3 go_in go_out test_configs);
+use Apache::TestConfig ();
+
+my @configs = test_configs();
+my $tests_per_config = 18;
+plan tests => $tests_per_config * @configs;
+
+my $orig_dir = go_in();
+
+for my $c (@configs) {
+    Apache::TestConfig::custom_config_nuke();
+    $ENV{APACHE_TEST_NO_STICKY_PREFERENCES} = 1;
+    makefile_pl_plus_httpd_arg($c);
+
+    # this one will have custom config, but it shouldn't interrupt
+    # with the explicit one
+    # XXX: useless at the moment, since the previously stored custom
+    # config and the explicit config both point to the same config
+    $ENV{APACHE_TEST_NO_STICKY_PREFERENCES} = 0;
+    makefile_pl_plus_httpd_arg($c);
+
+    Apache::TestConfig::custom_config_nuke();
+    t_TEST_plus_httpd_arg($c);
+}
+
+go_out($orig_dir);
+
+# 6 tests
+# explicit Makefile.PL -httpd argument
+sub makefile_pl_plus_httpd_arg {
+    my $c = shift;
+
+    my($cmd, $out, $err);
+
+    # clean and ignore the results
+    $cmd = "make clean";
+    ($out, $err) = myrun3($cmd);
+
+    my $makepl_arg = $c->{makepl_arg} || '';
+    $cmd = "$c->{perl_exec} Makefile.PL $makepl_arg -httpd $c->{httpd_exec}";
+    ($out, $err) = myrun3($cmd);
+    unlike $err, qr/\[  error\]/, $cmd;
+
+    $cmd = "make";
+    ($out, $err) = myrun3($cmd);
+    is $err, "", $cmd;
+
+    my $test_verbose = $c->{test_verbose} ? "TEST_VERBOSE=1" : "";
+    $cmd = "make test $test_verbose";
+    ($out, $err) = myrun3($cmd);
+    like $out, qr/using $c->{httpd_version} \($c->{httpd_mpm} MPM\)/, $cmd;
+    like $out, qr/All tests successful/, $cmd;
+    unlike $err, qr/\[  error\]/, $cmd;
+
+    # test that httpd is found in t/REPORT (if exists)
+    $cmd = "t/REPORT";
+    if (-e $cmd) {
+        ($out, $err) = myrun3($cmd);
+        like $out, qr/Server version: $c->{httpd_version}/, $cmd;
+    }
+    else {
+        ok 1;
+    }
+}
+
+# explicit t/TEST -httpd argument
+sub t_TEST_plus_httpd_arg {
+    my $c = shift;
+
+    my($cmd, $out, $err);
+
+    # clean and ignore the results
+    $cmd = "make clean";
+    ($out, $err) = myrun3($cmd);
+
+    my $makepl_arg = $c->{makepl_arg} || '';
+    $cmd = "$c->{perl_exec} Makefile.PL $makepl_arg";
+    ($out, $err) = myrun3($cmd);
+    unlike $err, qr/\[  error\]/, $cmd;
+
+    $cmd = "make";
+    ($out, $err) = myrun3($cmd);
+    is $err, "", $cmd;
+
+    my $test_verbose = $c->{test_verbose} ? "-v " : "";
+    $cmd = "t/TEST -httpd $c->{httpd_exec} $test_verbose";
+    ($out, $err) = myrun3($cmd);
+    like $out,
+        qr/using $c->{httpd_version} \($c->{httpd_mpm} MPM\)/,
+        $cmd;
+    like $out, qr/All tests successful/, $cmd;
+    unlike $err, qr/\[  error\]/, $cmd;
+
+    # test that httpd is found in t/REPORT (if exists)
+    $cmd = "t/REPORT";
+    if (-e $cmd) {
+        ($out, $err) = myrun3($cmd);
+        like $out, qr/Server version: $c->{httpd_version}/, $cmd;
+    }
+    else {
+        ok 1;
+    }
+}
+
+__END__
+

--- /dev/null   1969-12-31 19:00:00.000000000 -0500
+++ t_c/interactive.t   2004-11-01 19:55:18.000000000 -0500
@@ -0,0 +1,130 @@
+#
+# interactive testing (when A-T) can't figure out the configuration
+#
+
+use strict;
+use warnings FATAL => 'all';
+
+use Test::More;
+
+use IPC::Run qw(start pump finish timeout);
+
+use MyTest::Util qw(myrun3 go_in go_out test_configs);
+use Apache::TestConfig ();
+use Apache::TestTrace qw(error);
+
+my @configs = test_configs();
+my $tests_per_config = 10;
+plan tests => $tests_per_config * @configs;
+
+my $orig_dir = go_in();
+
+for my $c (@configs) {
+
+    # install the sticky custom config
+    install($c);
+
+    # interactive config doesn't work with this var on
+    $ENV{APACHE_TEST_NO_STICKY_PREFERENCES} = 0;
+    basic($c);
+}
+
+go_out($orig_dir);
+
+# 3 tests
+sub install {
+    my $c = shift;
+
+    my($cmd, $out, $err);
+
+    $cmd = "make clean";
+    ($out, $err) = myrun3($cmd);
+    # ignore the results
+
+    Apache::TestConfig::custom_config_nuke();
+
+    my $makepl_arg = $c->{makepl_arg} || '';
+    $cmd = "$c->{perl_exec} Makefile.PL $makepl_arg " .
+        "-httpd $c->{httpd_exec} -apxs $c->{apxs_exec}";
+    ($out, $err) = myrun3($cmd);
+    unlike $err, qr/\[  error\]/, $cmd;
+
+    $cmd = "make";
+    ($out, $err) = myrun3($cmd);
+    is $err, "", $cmd;
+
+    $cmd = "make install";
+    ($out, $err) = myrun3($cmd);
+    unlike $err, qr/\[  error\]/, $cmd;
+}
+
+# 7 tests
+sub basic {
+    my $c = shift;
+
+    my($cmd, $out, $err);
+
+    # clean and ignore the results
+    $cmd = "make clean";
+    ($out, $err) = myrun3($cmd);
+
+    Apache::TestConfig::custom_config_nuke();
+
+    my $makepl_arg = $c->{makepl_arg} || '';
+    $cmd = "$c->{perl_exec} Makefile.PL $makepl_arg";
+    ($out, $err) = myrun3($cmd);
+    unlike $err, qr/\[  error\]/, $cmd;
+
+    $cmd = "make";
+    ($out, $err) = myrun3($cmd);
+    is $err, "", $cmd;
+
+    {
+        my $in;
+        my $expected = '';
+        my @cmd = qw(make test);
+        push @cmd, "TEST_VERBOSE=1" if $c->{test_verbose};
+        $cmd = join " ", @cmd;
+
+        $in  = '';
+        $out = '';
+        $err = '';
+        my $h = start [EMAIL PROTECTED], \$in, \$out, \$err, 
timeout($c->{timeout});
+
+        $expected = "Please provide a full path to 'httpd' executable";
+        eval { $h->pump until $out =~ /$expected/gc };
+        if ($@) {
+            error "\n\n ****** STDOUT *******\n [$out]\n\n";
+            error "\n\n ****** STDERR *******\n [$err]\n\n";
+            die $@;
+        }
+
+        $in .= "$c->{httpd_exec}\n" ;
+        $expected = "Please provide a full path to .*? 'apxs' executable";
+        $h->pump until $out =~ /$expected/gc ;
+
+        $in .= "$c->{apxs_exec}\n" ;
+        $h->finish or die "cat returned $?" ;
+
+        like $out, qr/using $c->{httpd_version} \($c->{httpd_mpm} MPM\)/, $cmd;
+        like $out, qr/All tests successful/, $cmd;
+        unlike $err, qr/\[  error\]/, $cmd;
+    }
+
+    $cmd = "make install";
+    ($out, $err) = myrun3($cmd);
+    unlike $err, qr/\[  error\]/, $cmd;
+
+    # test that httpd is found in t/REPORT (if exists)
+    $cmd = "t/REPORT";
+    if (-e $cmd) {
+        ($out, $err) = myrun3($cmd);
+        like $out, qr/Server version: $c->{httpd_version}/, $cmd;
+    }
+    else {
+        ok 1;
+    }
+}
+
+__END__
+


--- /dev/null   1969-12-31 19:00:00.000000000 -0500
+++ t_c/README  2004-10-31 16:22:29.000000000 -0500
@@ -0,0 +1,8 @@
+This test suite tests various Apache-Test setups (i.e. whether the
+configuration works correctly), something that can't be tested with
+the normal run-time test suite.
+
+DEBUGGING:
+
+env IPCRUNDEBUG=data t_c/TEST t_c/interactive.t
+(for more options see IPC::Run / IPC::Run3 manpages)

--- /dev/null   1969-12-31 19:00:00.000000000 -0500
+++ t_c/TEST    2004-10-31 21:15:21.000000000 -0500
@@ -0,0 +1,101 @@
+#!/home/stas/perl/5.8.5-ithread/bin/perl5.8.5
+# WARNING: this file is generated, do not edit
+# 01: lib/Apache/TestConfig.pm:898
+# 02: lib/Apache/TestConfig.pm:988
+# 03: lib/Apache/TestMM.pm:137
+# 04: Makefile.PL:32
+
+BEGIN { eval { require blib && blib->import; } }
+
+$Apache::TestConfig::Argv{'libmodperl'} = q|mod_perl-5.8.5-ithread.so|;
+use strict;
+
+use lib qw(lib ../lib t_c/lib);
+
+use strict;
+use warnings FATAL => 'all';
+
+use Test::Harness;
+use FindBin;
+
+use Apache::TestTrace;
+
+use Getopt::Long qw(GetOptions);
+
+my %usage = (
+   'base-dir'     => 'which dir to run the tests in',
+   'config-file'  => 'which config file to use',
+   'help'         => 'display this message',
+   'verbose[=1]'  => 'verbose output',
+);
+
+my @flag_opts    = qw(verbose help);
+my @string_opts  = qw(config-file base-dir);
+
+my %opts;
+# grab from @ARGV only the options that we expect
+GetOptions(\%opts, @flag_opts, (map "$_=s", @string_opts));
+
+# t/TEST -v -base /home/stas/apache.org/Apache-Test \
+# -config /home/stas/.apache-test/apache_test_config.pm
+#
+
+$Test::Harness::verbose = 1 if $opts{verbose};
+
+opt_help() if $opts{help};
+opt_help() unless $opts{'base-dir'} && $opts{'config-file'};
+unless (-d $opts{'base-dir'}) {
+    error "can't find $opts{'base-dir'}";
+    opt_help();
+}
+
+unless (-r $opts{'config-file'}) {
+    error "can't read $opts{'config-file'}";
+    opt_help();
+}
+
+# forward the data to the sub-processes run by Test::Harness
+$ENV{APACHE_TESTITSELF_CONFIG_FILE} = $opts{'config-file'};
+$ENV{APACHE_TESTITSELF_BASE_DIR}    = $opts{'base-dir'};
+
+run_my_tests();
+
+sub run_my_tests {
+
+    my $base = "t_c";
+    unless (-d $base) {
+        # try to move into the top-level directory
+        chdir ".." or die "Can't chdir: $!";
+    }
+
+    my @tests;
+    if (@ARGV) {
+        for (@ARGV) {
+            if (-d $_) {
+                push @tests, <$_/*.t>;
+            } else {
+                $_ .= ".t" unless /\.t$/;
+                push @tests, $_;
+            }
+        }
+    } else {
+        chdir $base;
+        @tests = sort (<*.t>);
+        chdir "..";
+        @tests = map { "$base/$_" } @tests;
+    }
+
+    runtests @tests;
+}
+
+sub opt_help {
+    print <<EOM;
+usage: TEST [options ...]
+   where options include:
+EOM
+
+    for (sort keys %usage){
+        printf "  -%-13s %s\n", $_, $usage{$_};
+    }
+    exit;
+}

--- /dev/null   1969-12-31 19:00:00.000000000 -0500
+++ t_c/TEST.PL 2004-10-31 15:45:06.000000000 -0500
@@ -0,0 +1,91 @@
+use strict;
+
+use lib qw(lib ../lib t_c/lib);
+
+use strict;
+use warnings FATAL => 'all';
+
+use Test::Harness;
+use FindBin;
+
+use Apache::TestTrace;
+
+use Getopt::Long qw(GetOptions);
+
+my %usage = (
+   'base-dir'     => 'which dir to run the tests in',
+   'config-file'  => 'which config file to use',
+   'help'         => 'display this message',
+   'verbose[=1]'  => 'verbose output',
+);
+
+my @flag_opts    = qw(verbose help);
+my @string_opts  = qw(config-file base-dir);
+
+my %opts;
+# grab from @ARGV only the options that we expect
+GetOptions(\%opts, @flag_opts, (map "$_=s", @string_opts));
+
+# t/TEST -v -base /home/stas/apache.org/Apache-Test \
+# -config /home/stas/.apache-test/apache_test_config.pm
+#
+
+$Test::Harness::verbose = 1 if $opts{verbose};
+
+opt_help() if $opts{help};
+opt_help() unless $opts{'base-dir'} && $opts{'config-file'};
+unless (-d $opts{'base-dir'}) {
+    error "can't find $opts{'base-dir'}";
+    opt_help();
+}
+
+unless (-r $opts{'config-file'}) {
+    error "can't read $opts{'config-file'}";
+    opt_help();
+}
+
+# forward the data to the sub-processes run by Test::Harness
+$ENV{APACHE_TESTITSELF_CONFIG_FILE} = $opts{'config-file'};
+$ENV{APACHE_TESTITSELF_BASE_DIR}    = $opts{'base-dir'};
+
+run_my_tests();
+
+sub run_my_tests {
+
+    my $base = "t_c";
+    unless (-d $base) {
+        # try to move into the top-level directory
+        chdir ".." or die "Can't chdir: $!";
+    }
+
+    my @tests;
+    if (@ARGV) {
+        for (@ARGV) {
+            if (-d $_) {
+                push @tests, <$_/*.t>;
+            } else {
+                $_ .= ".t" unless /\.t$/;
+                push @tests, $_;
+            }
+        }
+    } else {
+        chdir $base;
+        @tests = sort (<*.t>);
+        chdir "..";
+        @tests = map { "$base/$_" } @tests;
+    }
+
+    runtests @tests;
+}
+
+sub opt_help {
+    print <<EOM;
+usage: TEST [options ...]
+   where options include:
+EOM
+
+    for (sort keys %usage){
+        printf "  -%-13s %s\n", $_, $usage{$_};
+    }
+    exit;
+}

--- /dev/null   1969-12-31 19:00:00.000000000 -0500
+++ t_c/lib/MyTest/Util.pm      2004-10-31 17:13:28.000000000 -0500
@@ -0,0 +1,54 @@
+package MyTest::Util;
+
+use strict;
+use warnings FATAL => 'all';
+
+use Apache::TestConfig;
+use Apache::TestTrace;
+
+use Exporter ();
+use IPC::Run3 ();
+use Cwd;
+
+use vars qw(@ISA @EXPORT @EXPORT_OK);
[EMAIL PROTECTED] = qw(Exporter);
[EMAIL PROTECTED]    = ();
[EMAIL PROTECTED] = qw(myrun3 go_in go_out test_configs);
+
+sub myrun3 {
+    my($cmd) = shift;
+    my $out = '';
+    my $err = '';
+
+    IPC::Run3::run3($cmd, \undef, \$out, \$err);
+
+    return ($out, $err);
+}
+
+sub go_in {
+    my $orig_dir = cwd();
+    my $in = $ENV{APACHE_TESTITSELF_BASE_DIR} || '';
+    chdir $in or die "failed to chdir to $in: $!";
+    return $orig_dir;
+}
+
+sub go_out {
+    my $dir = shift;
+    chdir $dir or die "failed to chdir to $dir: $!";
+}
+
+sub test_configs {
+    my $config_file = $ENV{APACHE_TESTITSELF_CONFIG_FILE} || '';
+    require $config_file;
+    unless (@Apache::TestItSelf::Configs) {
+        error "can't find test configs in '$config_file'";
+        exit 1;
+    }
+
+    return @Apache::TestItSelf::Configs;
+}
+
+
+1;
+
+__END__

Reply via email to