|  line  | 
 stmt  | 
 bran  | 
 cond  | 
 sub  | 
 pod  | 
 time  | 
 code  | 
| 
1
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 package Test::Workflow::Test;  | 
| 
2
 | 
137
 | 
 
 | 
 
 | 
  
137
  
 | 
 
 | 
1935
 | 
 use strict;  | 
| 
 
 | 
137
 | 
 
 | 
 
 | 
 
 | 
 
 | 
302
 | 
    | 
| 
 
 | 
137
 | 
 
 | 
 
 | 
 
 | 
 
 | 
6548
 | 
    | 
| 
3
 | 
137
 | 
 
 | 
 
 | 
  
137
  
 | 
 
 | 
1274
 | 
 use warnings;  | 
| 
 
 | 
137
 | 
 
 | 
 
 | 
 
 | 
 
 | 
292
 | 
    | 
| 
 
 | 
137
 | 
 
 | 
 
 | 
 
 | 
 
 | 
6969
 | 
    | 
| 
4
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
5
 | 
137
 | 
 
 | 
 
 | 
  
137
  
 | 
 
 | 
1057
 | 
 use Fennec::Util qw/accessors/;  | 
| 
 
 | 
137
 | 
 
 | 
 
 | 
 
 | 
 
 | 
350
 | 
    | 
| 
 
 | 
137
 | 
 
 | 
 
 | 
 
 | 
 
 | 
1007
 | 
    | 
| 
6
 | 
137
 | 
 
 | 
 
 | 
  
137
  
 | 
 
 | 
37632
 | 
 use List::Util qw/shuffle/;  | 
| 
 
 | 
137
 | 
 
 | 
 
 | 
 
 | 
 
 | 
296
 | 
    | 
| 
 
 | 
137
 | 
 
 | 
 
 | 
 
 | 
 
 | 
19598
 | 
    | 
| 
7
 | 
137
 | 
 
 | 
 
 | 
  
137
  
 | 
 
 | 
953
 | 
 use Carp qw/cluck/;  | 
| 
 
 | 
137
 | 
 
 | 
 
 | 
 
 | 
 
 | 
593
 | 
    | 
| 
 
 | 
137
 | 
 
 | 
 
 | 
 
 | 
 
 | 
181926
 | 
    | 
| 
8
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 require Time::HiRes;  | 
| 
9
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
10
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 accessors qw/setup tests teardown around block_name is_wrap control/;  | 
| 
11
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
12
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 sub new {  | 
| 
13
 | 
891
 | 
 
 | 
 
 | 
  
891
  
 | 
  
0
  
 | 
1371
 | 
     my $class  = shift;  | 
| 
14
 | 
891
 | 
 
 | 
 
 | 
 
 | 
 
 | 
4123
 | 
     my %params = @_;  | 
| 
15
 | 
891
 | 
 
 | 
  
 50
  
 | 
 
 | 
 
 | 
27183
 | 
     return bless(  | 
| 
 
 | 
 
 | 
 
 | 
  
 50
  
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
 
 | 
 
 | 
 
 | 
  
 50
  
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
 
 | 
 
 | 
 
 | 
  
 50
  
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
 
 | 
 
 | 
 
 | 
  
 50
  
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
 
 | 
 
 | 
 
 | 
  
 50
  
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
 
 | 
 
 | 
 
 | 
  
100
  
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
16
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
         {  | 
| 
17
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
             setup      => $params{setup}      || [],  | 
| 
18
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
             tests      => $params{tests}      || [],  | 
| 
19
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
             teardown   => $params{teardown}   || [],  | 
| 
20
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
             around     => $params{around}     || [],  | 
| 
21
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
             control    => $params{control}    || [],  | 
| 
22
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
             block_name => $params{block_name} || "",  | 
| 
23
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
             is_wrap    => $params{is_wrap}    || 0,  | 
| 
24
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
         },  | 
| 
25
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
         $class  | 
| 
26
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     );  | 
| 
27
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 }  | 
| 
28
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
29
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 sub name {  | 
| 
30
 | 
174
 | 
 
 | 
 
 | 
  
174
  
 | 
  
0
  
 | 
202
 | 
     my $self = shift;  | 
| 
31
 | 
174
 | 
 
 | 
 
 | 
 
 | 
 
 | 
401
 | 
     return $self->tests->[0]->name  | 
| 
32
 | 
174
 | 
  
100
  
 | 
 
 | 
 
 | 
 
 | 
163
 | 
         if @{$self->tests} == 1;  | 
| 
33
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
34
 | 
21
 | 
 
 | 
 
 | 
 
 | 
 
 | 
60
 | 
     return $self->block_name;  | 
| 
35
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 }  | 
| 
36
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
37
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 sub run {  | 
| 
38
 | 
617
 | 
 
 | 
 
 | 
  
617
  
 | 
  
0
  
 | 
674535
 | 
     my $self = shift;  | 
| 
39
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
40
 | 
617
 | 
 
 | 
 
 | 
 
 | 
 
 | 
3037
 | 
     my ($instance) = @_;  | 
| 
41
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
42
 | 
617
 | 
 
 | 
 
 | 
 
 | 
 
 | 
3742
 | 
     my $run       = $self->_wrap_tests($instance);  | 
| 
43
 | 
617
 | 
 
 | 
 
 | 
 
 | 
 
 | 
2822
 | 
     my $prunner   = $instance->TEST_WORKFLOW->test_run;  | 
| 
44
 | 
617
 | 
 
 | 
 
 | 
 
 | 
 
 | 
15382
 | 
     my $testcount = @{$self->tests};  | 
| 
 
 | 
617
 | 
 
 | 
 
 | 
 
 | 
 
 | 
1873
 | 
    | 
| 
45
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
46
 | 
617
 | 
  
100
  
 | 
 
 | 
 
 | 
 
 | 
4978
 | 
     return $run->() if $self->is_wrap;  | 
| 
47
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
48
 | 
539
 | 
  
100
  
 | 
  
 66
  
 | 
 
 | 
 
 | 
8098
 | 
     return $prunner->( $run, $self, $instance )  | 
| 
49
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
         if $prunner && $testcount == 1;  | 
| 
50
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
51
 | 
13
 | 
 
 | 
 
 | 
 
 | 
 
 | 
26
 | 
     $run->();  | 
| 
52
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 }  | 
| 
53
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
54
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 sub _wrap_tests {  | 
| 
55
 | 
617
 | 
 
 | 
 
 | 
  
617
  
 | 
 
 | 
1359
 | 
     my $self = shift;  | 
| 
56
 | 
617
 | 
 
 | 
 
 | 
 
 | 
 
 | 
1315
 | 
     my ($instance) = @_;  | 
| 
57
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
58
 | 
617
 | 
 
 | 
 
 | 
 
 | 
 
 | 
4214
 | 
     my $ref = ref $self;  | 
| 
59
 | 
617
 | 
 
 | 
 
 | 
 
 | 
 
 | 
16690
 | 
     $ref =~ s/^.*:://;  | 
| 
60
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
61
 | 
617
 | 
 
 | 
 
 | 
 
 | 
 
 | 
8368
 | 
     my $meta = $instance->TEST_WORKFLOW;  | 
| 
62
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
63
 | 
617
 | 
 
 | 
  
100
  
 | 
 
 | 
 
 | 
12993
 | 
     my $sort = $meta->test_sort || 'rand';  | 
| 
64
 | 
617
 | 
 
 | 
 
 | 
 
 | 
 
 | 
1328
 | 
     my @tests = Test::Workflow::order_tests( $sort, @{$self->tests} );  | 
| 
 
 | 
617
 | 
 
 | 
 
 | 
 
 | 
 
 | 
3401
 | 
    | 
| 
65
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
66
 | 
617
 | 
 
 | 
 
 | 
 
 | 
 
 | 
5881
 | 
     my $wait = $meta->test_wait;  | 
| 
67
 | 
617
 | 
 
 | 
 
 | 
 
 | 
 
 | 
7308
 | 
     my $pid  = $$;  | 
| 
68
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
69
 | 
617
 | 
 
 | 
  
 66
  
 | 
 
 | 
 
 | 
13344
 | 
     my $debug = $instance->can('FENNEC') && $instance->FENNEC->debug;  | 
| 
70
 | 
617
 | 
  
 50
  
 | 
 
 | 
 
 | 
 
 | 
2133
 | 
     my $collector = $debug ? Fennec::Runner->new->collector : undef;  | 
| 
71
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
72
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     return sub {  | 
| 
73
 | 
264
 | 
 
 | 
 
 | 
  
264
  
 | 
 
 | 
2449
 | 
         my $control_store = [];  | 
| 
74
 | 
264
 | 
 
 | 
 
 | 
 
 | 
 
 | 
5234
 | 
         $meta->control_store($control_store);  | 
| 
75
 | 
264
 | 
 
 | 
 
 | 
 
 | 
 
 | 
1408
 | 
         for my $sub (@{$self->control}) {  | 
| 
 
 | 
264
 | 
 
 | 
 
 | 
 
 | 
 
 | 
6263
 | 
    | 
| 
76
 | 
6
 | 
 
 | 
 
 | 
 
 | 
 
 | 
130
 | 
             my $control = $sub->();  | 
| 
77
 | 
6
 | 
  
 50
  
 | 
 
 | 
 
 | 
 
 | 
6151
 | 
             if ($debug) {  | 
| 
78
 | 
0
 | 
 
 | 
 
 | 
 
 | 
 
 | 
0
 | 
                 my ($sec, $ms) = Time::HiRes::gettimeofday();  | 
| 
79
 | 
0
 | 
 
 | 
 
 | 
 
 | 
 
 | 
0
 | 
                 my $msg = sprintf(  | 
| 
80
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
                     "FENNEC_DEBUG_MOCK:PID:%d\0CLASS:%s\0SEC:%d\0MSEC:%d\0OVERRIDES:%s\n",  | 
| 
81
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
                     $$,  | 
| 
82
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
                     $control->package,  | 
| 
83
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
                     $sec,  | 
| 
84
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
                     $ms,  | 
| 
85
 | 
0
 | 
 
 | 
 
 | 
 
 | 
 
 | 
0
 | 
                     join ' ' => grep { /^\w/ } keys %$control  | 
| 
86
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
                 );  | 
| 
87
 | 
0
 | 
 
 | 
 
 | 
 
 | 
 
 | 
0
 | 
                 $collector->diag($msg);  | 
| 
88
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
             }  | 
| 
89
 | 
6
 | 
 
 | 
 
 | 
 
 | 
 
 | 
53
 | 
             push @$control_store => $control;  | 
| 
90
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
         }  | 
| 
91
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
92
 | 
264
 | 
  
100
  
 | 
  
 66
  
 | 
 
 | 
 
 | 
13154
 | 
         $wait->() if $wait && $self->can('is_wrap') && $self->is_wrap;  | 
| 
 
 | 
 
 | 
 
 | 
  
100
  
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
93
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
94
 | 
264
 | 
 
 | 
 
 | 
 
 | 
 
 | 
3540
 | 
         $_->run($instance) for @{$self->setup};  | 
| 
 
 | 
264
 | 
 
 | 
 
 | 
 
 | 
 
 | 
3719
 | 
    | 
| 
95
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
96
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
         my $base = sub {  | 
| 
97
 | 
254
 | 
 
 | 
 
 | 
 
 | 
 
 | 
4192
 | 
             for my $test (@tests) {  | 
| 
98
 | 
365
 | 
 
 | 
 
 | 
 
 | 
 
 | 
333649
 | 
                 $test->run($instance);  | 
| 
99
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
             }  | 
| 
100
 | 
264
 | 
 
 | 
 
 | 
 
 | 
 
 | 
5139
 | 
         };  | 
| 
101
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
102
 | 
264
 | 
 
 | 
 
 | 
 
 | 
 
 | 
2452
 | 
         my $outer = $base;  | 
| 
103
 | 
264
 | 
 
 | 
 
 | 
 
 | 
 
 | 
2331
 | 
         for my $around ( @{$self->around} ) {  | 
| 
 
 | 
264
 | 
 
 | 
 
 | 
 
 | 
 
 | 
2148
 | 
    | 
| 
104
 | 
31
 | 
 
 | 
 
 | 
 
 | 
 
 | 
110
 | 
             my $inner = $outer;  | 
| 
105
 | 
31
 | 
 
 | 
 
 | 
 
 | 
 
 | 
451
 | 
             $outer = sub { $around->run( $instance, $inner ) };  | 
| 
 
 | 
31
 | 
 
 | 
 
 | 
 
 | 
 
 | 
762
 | 
    | 
| 
106
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
         }  | 
| 
107
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
108
 | 
264
 | 
 
 | 
 
 | 
 
 | 
 
 | 
1299
 | 
         $outer->();  | 
| 
109
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
110
 | 
226
 | 
 
 | 
 
 | 
 
 | 
 
 | 
20841
 | 
         $_->run($instance) for @{$self->teardown};  | 
| 
 
 | 
226
 | 
 
 | 
 
 | 
 
 | 
 
 | 
2060
 | 
    | 
| 
111
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
112
 | 
226
 | 
 
 | 
 
 | 
 
 | 
 
 | 
1709
 | 
         $meta->control_store(undef);  | 
| 
113
 | 
226
 | 
 
 | 
 
 | 
 
 | 
 
 | 
539
 | 
         $control_store = undef;  | 
| 
114
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
115
 | 
226
 | 
  
100
  
 | 
  
 66
  
 | 
 
 | 
 
 | 
6033
 | 
         $wait->() if $wait && $self->can('is_wrap') && $self->is_wrap;  | 
| 
 
 | 
 
 | 
 
 | 
  
100
  
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
116
 | 
617
 | 
 
 | 
 
 | 
 
 | 
 
 | 
26111
 | 
     };  | 
| 
117
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 }  | 
| 
118
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
119
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 1;  | 
| 
120
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
121
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 __END__  |