develooper Front page | perl.perl5.changes | Postings from March 2023

[Perl/perl5] e41134: t/harness - rework App::Prove::State setup tonot ...

Yves Orton via perl5-changes
March 28, 2023 09:59
[Perl/perl5] e41134: t/harness - rework App::Prove::State setup tonot ...
Message ID:
  Branch: refs/heads/yves/test_harness_state_init_fixes
  Commit: e4113403c959dc59a4b604662f009fa6f823c97c
  Author: Yves Orton <>
  Date:   2023-03-28 (Tue, 28 Mar 2023)

  Changed paths:
    M pod/perlhack.pod
    M t/harness

  Log Message:
  t/harness - rework App::Prove::State setup to not warn and use customizable state file

Currently we only store state if we are running parallel tests, so if
you run the tests in series we do not store data on how long they took,
and we can't use that information in a follow up parallel test run.

We also do not allow the state file to be customized to be outside of
the repo, so git clean -dfx wipes it. This means you can't keep your
test data over time, which can be a bit annoying.

We also currently construct the state object twice during setup,
resulting in two (useless) warnings when the state file is missing,
which also doubles the time to set up the tests because the yaml file
gets read twice, and not very efficiently either.

This patch changes the logic so that we initialize the state object only
once during startup, and we use the state file if we are going to run
tests, parallel or not, provided the user does not explicitly disable it
(see below). The order that tests are run is affected only when the
tests are run in parallel.

It also allows the user to specify where the state file should live,
with the $ENV{PERL_TEST_STATE_FILE} environment variable, which can be
set to 0 or the empty string to disable use of the state file if needed.

We also take care to silence the warning about an empty state file,
except in the case where the user has overriden the file name with the

Lastly this patch disables loading the state data /at all/, when
the dump_tests option is invoked. There is no need nor point to
load the state data when we are simply going to dump out the list
of tests we will run. Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About