| 1 |
package Test2::Harness::Runner::Run; |
| 2 |
use strict; |
| 3 |
use warnings; |
| 4 |
|
| 5 |
our $VERSION = '1.000179'; |
| 6 |
|
| 7 |
use Carp qw/croak/; |
| 8 |
use File::Spec(); |
| 9 |
|
| 10 |
use Test2::Harness::Util::File::JSONL; |
| 11 |
|
| 12 |
use parent 'Test2::Harness::Run'; |
| 13 |
use Test2::Harness::Util::HashBase qw{ |
| 14 |
<workdir |
| 15 |
|
| 16 |
+run_dir |
| 17 |
+jobs_file |
| 18 |
+jobs |
| 19 |
}; |
| 20 |
|
| 21 |
sub init { |
| 22 |
my $self = shift; |
| 23 |
|
| 24 |
$self->SUPER::init(); |
| 25 |
|
| 26 |
croak "'workdir' is a required attribute" unless $self->{+WORKDIR}; |
| 27 |
} |
| 28 |
|
| 29 |
sub run_dir { $_[0]->{+RUN_DIR} //= $_[0]->SUPER::run_dir($_[0]->{+WORKDIR}) } |
| 30 |
sub jobs_file { $_[0]->{+JOBS_FILE} //= File::Spec->catfile($_[0]->run_dir, 'jobs.jsonl') } |
| 31 |
sub jobs { $_[0]->{+JOBS} //= Test2::Harness::Util::File::JSONL->new(name => $_[0]->jobs_file, use_write_lock => 1) } |
| 32 |
|
| 33 |
1; |
| 34 |
|
| 35 |
__END__ |
| 36 |
|
| 37 |
|
| 38 |
=pod |
| 39 |
|
| 40 |
=encoding UTF-8 |
| 41 |
|
| 42 |
=head1 NAME |
| 43 |
|
| 44 |
Test2::Harness::Runner::Run - Runner specific subclass of a test run. |
| 45 |
|
| 46 |
=head1 DESCRIPTION |
| 47 |
|
| 48 |
Runner subclass of L<Test2::Harness::Run> for use inside the runner. |
| 49 |
|
| 50 |
=head1 METHODS |
| 51 |
|
| 52 |
In addition to the methods provided by L<Test2::Harness::Run>, these are provided. |
| 53 |
|
| 54 |
=over 4 |
| 55 |
|
| 56 |
=item $dir = $run->workdir |
| 57 |
|
| 58 |
Runner directory. |
| 59 |
|
| 60 |
=item $dir = $run->run_dir |
| 61 |
|
| 62 |
Directory specific to this run. |
| 63 |
|
| 64 |
=item $path = $run->jobs_file |
| 65 |
|
| 66 |
Path to the C<jobs.jsonl> file. |
| 67 |
|
| 68 |
=item $fh = $run->jobs |
| 69 |
|
| 70 |
Filehandle to C<jobs.jsonl>. |
| 71 |
|
| 72 |
=back |
| 73 |
|
| 74 |
=head1 SOURCE |
| 75 |
|
| 76 |
The source code repository for Test2-Harness can be found at |
| 77 |
F<http://github.com/Test-More/Test2-Harness/>. |
| 78 |
|
| 79 |
=head1 MAINTAINERS |
| 80 |
|
| 81 |
=over 4 |
| 82 |
|
| 83 |
=item Chad Granum E<lt>[email protected]<gt> |
| 84 |
|
| 85 |
=back |
| 86 |
|
| 87 |
=head1 AUTHORS |
| 88 |
|
| 89 |
=over 4 |
| 90 |
|
| 91 |
=item Chad Granum E<lt>[email protected]<gt> |
| 92 |
|
| 93 |
=back |
| 94 |
|
| 95 |
=head1 COPYRIGHT |
| 96 |
|
| 97 |
Copyright 2020 Chad Granum E<lt>[email protected]<gt>. |
| 98 |
|
| 99 |
This program is free software; you can redistribute it and/or |
| 100 |
modify it under the same terms as Perl itself. |
| 101 |
|
| 102 |
See F<http://dev.perl.org/licenses/> |
| 103 |
|
| 104 |
=cut |