summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--pod/perlhack.pod10
-rw-r--r--t/harness20
2 files changed, 26 insertions, 4 deletions
diff --git a/pod/perlhack.pod b/pod/perlhack.pod
index 1e8d907ca9..7a524619a9 100644
--- a/pod/perlhack.pod
+++ b/pod/perlhack.pod
@@ -942,6 +942,16 @@ Note that the command line above added a C<-j> parameter to make, so as
to cause parallel compilation. This may or may not work on your
platform.
+Normally data on how long tests take is stored in F<t/test_state>,
+however you can change this to use a different filename by setting the
+C<PERL_TEST_STATE_FILE> environment variable to something different, or
+to a false value (0 or the empty string) to disable use of the state
+mechanism entirely. There are no protections against the format of the
+state file changing over time, so if you have any issues related to this
+file it is up to you to delete the file manually and then let the
+harness recreate it, although the file format does not change frequently
+so this should not be necessary very often.
+
=head2 Running tests by hand
You can run part of the test suite by hand by using one of the
diff --git a/t/harness b/t/harness
index ce686eb171..50801fa0bf 100644
--- a/t/harness
+++ b/t/harness
@@ -139,7 +139,6 @@ sub _extract_tests {
}
my %total_time;
-
sub _compute_tests_and_ordering($) {
my @tests = $_[0]->@*;
@@ -147,10 +146,23 @@ sub _compute_tests_and_ordering($) {
my %all_dirs;
my %map_file_to_dir;
- if ($jobs > 1) {
+ if (!$dump_tests) {
require App::Prove::State;
- $state = App::Prove::State->new({ store => 'test_state' });
- $state->apply_switch('slow', 'save');
+ if (!$state) {
+ # silence unhelpful warnings from App::Prove::State about not having
+ # a save state, unless we actually set the PERL_TEST_STATE we don't care
+ # and we don't need to know if its fresh or not.
+ local $SIG{__WARN__} = $ENV{PERL_TEST_STATE} ? $SIG{__WARN__} : sub {
+ return if $_[0] and $_[0]=~/No saved state/;
+ warn $_[0];
+ };
+ my $state_file = $ENV{PERL_TEST_STATE_FILE} // 'test_state';
+ if ($state_file) { # set PERL_TEST_STATE_FILE to 0 to skip this
+ $state = App::Prove::State->new({ store => $state_file });
+ $state->apply_switch('save');
+ $state->apply_switch('slow') if $jobs > 1;
+ }
+ }
# For some reason get_tests returns *all* the tests previously run,
# (in the right order), not simply the selection in @tests
# (in the right order). Not sure if this is a bug or a feature.