1TAP::Parser::Scheduler(U3s)er Contributed Perl DocumentatTiAoPn::Parser::Scheduler(3)
2
3
4

NAME

6       TAP::Parser::Scheduler - Schedule tests during parallel testing
7

VERSION

9       Version 3.42
10

SYNOPSIS

12           use TAP::Parser::Scheduler;
13

DESCRIPTION

METHODS

16   Class Methods
17       "new"
18
19           my $sched = TAP::Parser::Scheduler->new(tests => \@tests);
20           my $sched = TAP::Parser::Scheduler->new(
21               tests => [ ['t/test_name.t','Test Description'], ... ],
22               rules => \%rules,
23           );
24
25       Given 'tests' and optional 'rules' as input, returns a new
26       "TAP::Parser::Scheduler" object.  Each member of @tests should be
27       either a a test file name, or a two element arrayref, where the first
28       element is a test file name, and the second element is a test
29       description. By default, we'll use the test name as the description.
30
31       The optional "rules" attribute provides direction on which tests should
32       be run in parallel and which should be run sequentially. If no rule
33       data structure is provided, a default data structure is used which
34       makes every test eligible to be run in parallel:
35
36           { par => '**' },
37
38       The rules data structure is documented more in the next section.
39
40   Rules data structure
41       The ""rules"" data structure is the the heart of the scheduler. It
42       allows you to express simple rules like "run all tests in sequence" or
43       "run all tests in parallel except these five tests.". However, the
44       rules structure also supports glob-style pattern matching and recursive
45       definitions, so you can also express arbitarily complicated patterns.
46
47       The rule must only have one top level key: either 'par' for "parallel"
48       or 'seq' for "sequence".
49
50       Values must be either strings with possible glob-style matching, or
51       arrayrefs of strings or hashrefs which follow this pattern recursively.
52
53       Every element in an arrayref directly below a 'par' key is eligible to
54       be run in parallel, while vavalues directly below a 'seq' key must be
55       run in sequence.
56
57       Rules examples
58
59       Here are some examples:
60
61           # All tests be run in parallel (the default rule)
62           { par => '**' },
63
64           # Run all tests in sequence, except those starting with "p"
65           { par => 't/p*.t' },
66
67           # Run all tests in parallel, except those starting with "p"
68           {
69               seq => [
70                         { seq => 't/p*.t' },
71                         { par => '**'     },
72                      ],
73           }
74
75           # Run some  startup tests in sequence, then some parallel tests then some
76           # teardown tests in sequence.
77           {
78               seq => [
79                   { seq => 't/startup/*.t' },
80                   { par => ['t/a/*.t','t/b/*.t','t/c/*.t'], }
81                   { seq => 't/shutdown/*.t' },
82               ],
83           },
84
85       Rules resolution
86
87       •   By default, all tests are eligible to be run in parallel.
88           Specifying any of your own rules removes this one.
89
90       •   "First match wins". The first rule that matches a test will be the
91           one that applies.
92
93       •   Any test which does not match a rule will be run in sequence at the
94           end of the run.
95
96       •   The existence of a rule does not imply selecting a test. You must
97           still specify the tests to run.
98
99       •   Specifying a rule to allow tests to run in parallel does not make
100           the run in parallel. You still need specify the number of parallel
101           "jobs" in your Harness object.
102
103       Glob-style pattern matching for rules
104
105       We implement our own glob-style pattern matching. Here are the patterns
106       it supports:
107
108           ** is any number of characters, including /, within a pathname
109           * is zero or more characters within a filename/directory name
110           ? is exactly one character within a filename/directory name
111           {foo,bar,baz} is any of foo, bar or baz.
112           \ is an escape character
113
114   Instance Methods
115       "get_all"
116
117       Get a list of all remaining tests.
118
119       "get_job"
120
121       Return the next available job as TAP::Parser::Scheduler::Job object or
122       "undef" if none are available. Returns a
123       TAP::Parser::Scheduler::Spinner if the scheduler still has pending jobs
124       but none are available to run right now.
125
126       "as_string"
127
128       Return a human readable representation of the scheduling tree.  For
129       example:
130
131           my @tests = (qw{
132               t/startup/foo.t
133               t/shutdown/foo.t
134
135               t/a/foo.t t/b/foo.t t/c/foo.t t/d/foo.t
136           });
137           my $sched = TAP::Parser::Scheduler->new(
138               tests => \@tests,
139               rules => {
140                   seq => [
141                       { seq => 't/startup/*.t' },
142                       { par => ['t/a/*.t','t/b/*.t','t/c/*.t'] },
143                       { seq => 't/shutdown/*.t' },
144                   ],
145               },
146           );
147
148       Produces:
149
150           par:
151             seq:
152               par:
153                 seq:
154                   par:
155                     seq:
156                       't/startup/foo.t'
157                   par:
158                     seq:
159                       't/a/foo.t'
160                     seq:
161                       't/b/foo.t'
162                     seq:
163                       't/c/foo.t'
164                   par:
165                     seq:
166                       't/shutdown/foo.t'
167               't/d/foo.t'
168
169
170
171perl v5.32.1                      2021-01-27         TAP::Parser::Scheduler(3)
Impressum