stas 2004/02/02 10:41:04
Modified: perl-framework/Apache-Test/lib/Apache TestRun.pm
perl-framework/Apache-Test Changes
Log:
Instrument A-T with an optional successful (shell-wise) abort of the
test suite, by asking the user whether they want to continue w/o
completing the test suite. Use it in places where we know that the
test suite will certaionly fail (e.g. running from /root as 'root', or
not providing httpd/apxs locations).
Revision Changes Path
1.146 +45 -4
httpd-test/perl-framework/Apache-Test/lib/Apache/TestRun.pm
Index: TestRun.pm
===================================================================
RCS file:
/home/cvs/httpd-test/perl-framework/Apache-Test/lib/Apache/TestRun.pm,v
retrieving revision 1.145
retrieving revision 1.146
diff -u -u -r1.145 -r1.146
--- TestRun.pm 31 Jan 2004 01:53:09 -0000 1.145
+++ TestRun.pm 2 Feb 2004 18:41:04 -0000 1.146
@@ -12,6 +12,7 @@
use Apache::TestTrace;
use Cwd;
+use ExtUtils::MakeMaker;
use File::Find qw(finddepth);
use File::Path;
use File::Spec::Functions qw(catfile catdir);
@@ -947,6 +948,7 @@
Only if the test prints 'OK', the directory is suitable to be used for
testing.
EOI
+ skip_test_suite();
exit_perl 0;
}
}
@@ -1130,6 +1132,35 @@
CORE::exit $_[0];
}
+# 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 {
+ my $no_doubt = shift;
+
+ print 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.
+
+];
+ unless ($no_doubt) {
+ my $default = 'No';
+ my $prompt = 'Skip the test suite?';
+ my $ans = ExtUtils::MakeMaker::prompt($prompt, $default);
+ return if lc($ans) =~ /no/;
+ }
+
+ error "Skipping the test suite execution, while returning success
status";
+ exit_perl 1;
+}
+
# called from Apache::TestConfig::new()
sub custom_config_add_conf_opts {
my $args = shift;
@@ -1397,7 +1428,6 @@
my $test_config = $self->{test_config};
my $vars = $test_config->{vars};
- require ExtUtils::MakeMaker;
require File::Spec;
local *which = \&Apache::TestConfig::which;
@@ -1422,6 +1452,7 @@
% APACHE_TEST_HTTPD=/path/to/alternative/httpd t/TEST
+If for some reason you want to skip the test suite, type: skip
];
{
@@ -1449,9 +1480,12 @@
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. Notice that if you have Apache 2.x installed that script
-could be called as 'apxs2'.
+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.
@@ -1535,6 +1569,13 @@
if ($optional) {
return '' unless $ans;
+ }
+
+ # stop the test suite without an error (so automatic tools
+ # like CPAN.pm will be able to continue)
+ if (lc($ans) eq 'skip' && !$optional) {
+ skip_test_suite();
+ next; # in case they change their mind
}
unless (File::Spec->file_name_is_absolute($ans)) {
1.86 +6 -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.85
retrieving revision 1.86
diff -u -u -r1.85 -r1.86
--- Changes 31 Jan 2004 09:58:24 -0000 1.85
+++ Changes 2 Feb 2004 18:41:04 -0000 1.86
@@ -8,6 +8,12 @@
=item 1.08_dev
+Instrument A-T with an optional successful (shell-wise) abort of the
+test suite, by asking the user whether they want to continue w/o
+completing the test suite. Use it in places where we know that the
+test suite will certaionly fail (e.g. running from /root as 'root', or
+not providing httpd/apxs locations). [Stas]
+
In order to make Apache-Test compatible with the rest of Perl testing
frameworks, we no longer chdir into t/, but run from the root of the
project (where t/ resides). A test needing to know where it's running