line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Test::Valgrind::Action; |
2
|
|
|
|
|
|
|
|
3
|
4
|
|
|
4
|
|
2208
|
use strict; |
|
4
|
|
|
|
|
6
|
|
|
4
|
|
|
|
|
98
|
|
4
|
4
|
|
|
4
|
|
16
|
use warnings; |
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
162
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
=head1 NAME |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
Test::Valgrind::Action - Base class for Test::Valgrind actions. |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
=head1 VERSION |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
Version 1.18 |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
=cut |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
our $VERSION = '1.18'; |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
=head1 DESCRIPTION |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
This class is the base for L actions. |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
Actions are called each time a tool encounter an error and decide what to do with it (for example passing or failing tests). |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
=cut |
25
|
|
|
|
|
|
|
|
26
|
4
|
|
|
4
|
|
20
|
use Test::Valgrind::Util; |
|
4
|
|
|
|
|
6
|
|
|
4
|
|
|
|
|
114
|
|
27
|
|
|
|
|
|
|
|
28
|
4
|
|
|
4
|
|
20
|
use base qw; |
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
1342
|
|
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
=head1 METHODS |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
=head2 C |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
my $tva = Test::Valgrind::Action->new(action => $action); |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
Creates a new action object of type C<$action> by requiring and redispatching the method call to the module named C<$action> if it contains C<'::'> or to C otherwise. |
37
|
|
|
|
|
|
|
The class represented by C<$action> must inherit this class. |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=cut |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub new { |
42
|
4
|
|
|
4
|
1
|
54
|
my $class = shift; |
43
|
4
|
|
33
|
|
|
20
|
$class = ref($class) || $class; |
44
|
|
|
|
|
|
|
|
45
|
4
|
|
|
|
|
10
|
my %args = @_; |
46
|
|
|
|
|
|
|
|
47
|
4
|
50
|
|
|
|
30
|
if ($class eq __PACKAGE__) { |
48
|
|
|
|
|
|
|
my ($action, $msg) = Test::Valgrind::Util::validate_subclass( |
49
|
0
|
|
0
|
|
|
0
|
$args{action} || 'Test', |
50
|
|
|
|
|
|
|
); |
51
|
0
|
0
|
|
|
|
0
|
$class->_croak($msg) unless defined $action; |
52
|
0
|
|
|
|
|
0
|
return $action->new(%args); |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
|
55
|
4
|
|
|
|
|
28
|
$class->SUPER::new(@_); |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=head2 C |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
Indicates if the action wants C to run in suppression-generating mode or in analysis mode. |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=cut |
63
|
|
|
|
|
|
|
|
64
|
0
|
|
|
0
|
1
|
0
|
sub do_suppressions { 0 } |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=head2 C |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
$tva->start($session); |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
Called when the C<$session> starts. |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
Defaults to set L. |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=head2 C |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
$tva->report($session, $report); |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
Invoked each time the C process attached to the C<$session> spots an error. |
79
|
|
|
|
|
|
|
C<$report> is a L object describing the error. |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
Defaults to check L. |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=cut |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
sub report { |
86
|
0
|
|
|
0
|
1
|
0
|
my ($self) = @_; |
87
|
|
|
|
|
|
|
|
88
|
0
|
0
|
|
|
|
0
|
$self->_croak('Action isn\'t started') unless $self->started; |
89
|
|
|
|
|
|
|
|
90
|
0
|
|
|
|
|
0
|
return; |
91
|
|
|
|
|
|
|
} |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
=head2 C |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
$tva->abort($session, $msg); |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
Triggered when the C<$session> has to interrupt the action. |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
Defaults to croak. |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
=cut |
102
|
|
|
|
|
|
|
|
103
|
0
|
|
|
0
|
1
|
0
|
sub abort { $_[0]->_croak($_[2]) } |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
=head2 C |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
$tva->finish($session); |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
Called when the C<$session> finishes. |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
Defaults to clear L. |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
=head2 C |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
$tva->status($session); |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
Returns the status code corresponding to the last run of the action. |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
=cut |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
sub status { |
122
|
2
|
|
|
2
|
1
|
9
|
my ($self, $sess) = @_; |
123
|
|
|
|
|
|
|
|
124
|
2
|
|
|
|
|
21
|
my $started = $self->started; |
125
|
|
|
|
|
|
|
|
126
|
2
|
50
|
|
|
|
18
|
$self->_croak("Action was never started") unless defined $started; |
127
|
2
|
50
|
|
|
|
15
|
$self->_croak("Action is still running") if $started; |
128
|
|
|
|
|
|
|
|
129
|
2
|
|
|
|
|
16
|
return; |
130
|
|
|
|
|
|
|
} |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
=head1 SEE ALSO |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
L, L, L. |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
=head1 AUTHOR |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
Vincent Pit, C<< >>, L. |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
You can contact me by mail or on C (vincent). |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
=head1 BUGS |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
Please report any bugs or feature requests to C, or through the web interface at L. |
145
|
|
|
|
|
|
|
I will be notified, and then you'll automatically be notified of progress on your bug as I make changes. |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
=head1 SUPPORT |
148
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
You can find documentation for this module with the perldoc command. |
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
perldoc Test::Valgrind::Action |
152
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
=head1 COPYRIGHT & LICENSE |
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
Copyright 2009,2010,2011,2013,2015 Vincent Pit, all rights reserved. |
156
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. |
158
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
=cut |
160
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
1; # End of Test::Valgrind::Action |