TAP::Pa...heduler(3pm)
πΈ NAME πΈ
TAP::Parser::Scheduler β Schedule tests during parallel testing π
π VERSION π
Version 3.50 β¨
π SYNOPSIS π
use TAP::Parser::Scheduler;
π«Ά DESCRIPTION π«Ά
Okay bestie, this page doesnβt have a big standalone description block β it rolls straight into the methods after the heading. The scheduler is the main character here, and all the tea is below. π
π METHODS π
π Class Methods π
new
my $sched = TAP::Parser::Scheduler->new(tests => \@tests);
my $sched = TAP::Parser::Scheduler->new(
tests => [ ['t/test_name.t','Test Description'], ... ],
rules => \%rules,
);
Given tests and optional rules as input, this returns a new TAP::Parser::Scheduler object. Every member of @tests should be either a test file name, or a two-element arrayref where the first element is a test file name and the second element is a test description. By default, weβll use the test name as the description. π«Ά
The optional rules attribute gives direction on which tests should run in parallel and which should run sequentially. If no rule data structure is provided, a default data structure is used that makes every test eligible to be run in parallel:
{ par => '**' },
The rules data structure is documented more in the next section. π
π Rules data structure π
The rules data structure is literally the heart of the scheduler. It lets you express simple rules like βrun all tests in sequenceβ or βrun all tests in parallel except these five tests.β But the rules structure also supports glob-style pattern matching and recursive definitions, so you can also express arbitrarily complicated patterns. No cap. β¨
The rule must only have one top-level key: either 'par' for parallel or 'seq' for sequence.
Values must be either strings with possible glob-style matching, or arrayrefs of strings or hashrefs which follow this pattern recursively.
Every element in an arrayref directly below a 'par' key is eligible to be run in parallel, while values directly below a 'seq' key must be run in sequence. π
π§ͺ Rules examples π§ͺ
Here are some examples:
# All tests be run in parallel (the default rule)
{ par => '**' },
# Run all tests in sequence, except those starting with "p"
{ par => 't/p*.t' },
# Run all tests in parallel, except those starting with "p"
{
seq => [
{ seq => 't/p*.t' },
{ par => '**' },
],
}
# Run some startup tests in sequence, then some parallel tests then some
# teardown tests in sequence.
{
seq => [
{ seq => 't/startup/*.t' },
{ par => ['t/a/*.t','t/b/*.t','t/c/*.t'], }
{ seq => 't/shutdown/*.t' },
],
},
β Rules resolution β
- By default, all tests are eligible to be run in parallel. Specifying any of your own rules removes this one.
- βFirst match wins.β The first rule that matches a test will be the one that applies.
- Any test which does not match a rule will be run in sequence at the end of the run.
- The existence of a rule does not imply selecting a test. You must still specify the tests to run.
- Specifying a rule that allows tests to run in parallel does not make the run parallel. You still need to specify the number of parallel
"jobs"in yourHarnessobject. π
π Glob-style pattern matching for rules π
We implement our own glob-style pattern matching. Here are the patterns it supports:
** is any number of characters, including /, within a pathname
* is zero or more characters within a filename/directory name
? is exactly one character within a filename/directory name
{foo,bar,baz} is any of foo, bar or baz.
\ is an escape character
π Instance Methods π
get_all
Get a list of all remaining tests. Thatβs it, thatβs the whole vibe. π
get_job
Return the next available job as a TAP::Parser::Scheduler::Job object or undef if none are available. Returns a TAP::Parser::Scheduler::Spinner if the scheduler still has pending jobs but none are available to run right now. π
as_string
Return a human readable representation of the scheduling tree. For example:
my @tests = (qw{
t/startup/foo.t
t/shutdown/foo.t
t/a/foo.t t/b/foo.t t/c/foo.t t/d/foo.t
});
my $sched = TAP::Parser::Scheduler->new(
tests => \@tests,
rules => {
seq => [
{ seq => 't/startup/*.t' },
{ par => ['t/a/*.t','t/b/*.t','t/c/*.t'] },
{ seq => 't/shutdown/*.t' },
],
},
);
Produces:
par:
seq:
par:
seq:
par:
seq:
't/startup/foo.t'
par:
seq:
't/a/foo.t'
seq:
't/b/foo.t'
seq:
't/c/foo.t'
par:
seq:
't/shutdown/foo.t'
't/d/foo.t'
xoxo, bestie π β this tea is from the Perl Programmers Reference Guide, source/versionperl v5.42.3, dated2026-11-03. Slay. β¨π
π¦ where this page comes from
- alpine 3.24: perl-doc 5.42.3-r0 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms