line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Test::Valgrind::Tool; |
2
|
|
|
|
|
|
|
|
3
|
7
|
|
|
7
|
|
2345
|
use strict; |
|
7
|
|
|
|
|
14
|
|
|
7
|
|
|
|
|
176
|
|
4
|
7
|
|
|
7
|
|
33
|
use warnings; |
|
7
|
|
|
|
|
13
|
|
|
7
|
|
|
|
|
294
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
=head1 NAME |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
Test::Valgrind::Tool - Base class for Test::Valgrind tools. |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
=head1 VERSION |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
Version 1.17 |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
=cut |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
our $VERSION = '1.17'; |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
=head1 DESCRIPTION |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
This class is the base for L tools. |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
They wrap around C tools by parsing its output and sending reports to the parent session whenever an error occurs. |
23
|
|
|
|
|
|
|
They are expected to function both in suppressions generation and in analysis mode. |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
=cut |
26
|
|
|
|
|
|
|
|
27
|
7
|
|
|
7
|
|
1660
|
use Test::Valgrind::Util; |
|
7
|
|
|
|
|
12
|
|
|
7
|
|
|
|
|
195
|
|
28
|
|
|
|
|
|
|
|
29
|
7
|
|
|
7
|
|
36
|
use base qw; |
|
7
|
|
|
|
|
10
|
|
|
7
|
|
|
|
|
3953
|
|
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
=head1 METHODS |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
=head2 C |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
my $required_version = $tvt->requires_version; |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
The minimum C version needed to run this tool. |
38
|
|
|
|
|
|
|
Defaults to C<3.1.0>. |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
=cut |
41
|
|
|
|
|
|
|
|
42
|
0
|
|
|
0
|
1
|
0
|
sub requires_version { '3.1.0' } |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=head2 C |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
my $tvt = Test::Valgrind::Tool->new(tool => $tool); |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
Creates a new tool object of type C<$tool> by requiring and redispatching the method call to the module named C<$tool> if it contains C<'::'> or to C otherwise. |
49
|
|
|
|
|
|
|
The class represented by C<$tool> must inherit this class. |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
=cut |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
sub new { |
54
|
10
|
|
|
10
|
1
|
20
|
my $class = shift; |
55
|
10
|
|
33
|
|
|
56
|
$class = ref($class) || $class; |
56
|
|
|
|
|
|
|
|
57
|
10
|
|
|
|
|
25
|
my %args = @_; |
58
|
|
|
|
|
|
|
|
59
|
10
|
100
|
|
|
|
36
|
if ($class eq __PACKAGE__) { |
60
|
|
|
|
|
|
|
my ($tool, $msg) = Test::Valgrind::Util::validate_subclass( |
61
|
3
|
|
50
|
|
|
24
|
delete $args{tool} || 'memcheck', |
62
|
|
|
|
|
|
|
); |
63
|
3
|
50
|
|
|
|
12
|
$class->_croak($msg) unless defined $tool; |
64
|
3
|
|
|
|
|
19
|
return $tool->new(%args); |
65
|
|
|
|
|
|
|
} |
66
|
|
|
|
|
|
|
|
67
|
7
|
|
|
|
|
67
|
$class->SUPER::new(@_); |
68
|
|
|
|
|
|
|
} |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=head2 C |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
my $tvt_train = Test::Valgrind::Tool->new_trainer; |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
Creates a new tool object suitable for generating suppressions. |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
Defaults to return C, which skips suppression generation. |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=cut |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
0
|
1
|
|
sub new_trainer { } |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
=head2 C |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
my $parser_class = $tvt->parser_class($session); |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
Returns the class from which the parser for this tool output will be instanciated. |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
This method must be implemented when subclassing. |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=cut |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
sub parser_class; |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
=head2 C |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
my $report_class = $tvt->report_class($session); |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
Returns the class in which suppression reports generated by this tool will be blessed. |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
This method must be implemented when subclassing. |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
=cut |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
sub report_class; |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
=head2 C |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
my @args = $tvt->args($session); |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
Returns the list of tool-specific arguments that are to be passed to C. |
111
|
|
|
|
|
|
|
All the suppression arguments are already handled by the session. |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
Defaults to the empty list. |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
=cut |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
2
|
1
|
|
sub args { } |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
=head2 C |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
my $tag = $tvt->suppressions_tag($session); |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
Returns a identifier that will be used to pick up the right suppressions for running the tool, or C to indicate that no special suppressions are needed. |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
This method must be implemented when subclassing. |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
=cut |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
sub suppressions_tag; |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
=head2 C |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
$tvt->start($session); |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
Called when the C<$session> starts. |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
Defaults to set L. |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
=head2 C |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
my $filtered_report = $tvt->filter($session, $report); |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
The C<$session> calls this method after receiving a report from the parser and before letting the command filter it. |
144
|
|
|
|
|
|
|
You can either return a mangled C<$report> (which does not need to be a clone of the original) or C if you want the action to ignore it completely. |
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
Defaults to the identity function. |
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
=cut |
149
|
|
|
|
|
|
|
|
150
|
10
|
|
|
10
|
1
|
40
|
sub filter { $_[2] } |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
=head2 C |
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
$tvt->finish($session); |
155
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
Called when the C<$session> finishes. |
157
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
Defaults to clear L. |
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
=head1 SEE ALSO |
161
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
L, L, L. |
163
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
=head1 AUTHOR |
165
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
Vincent Pit, C<< >>, L. |
167
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
You can contact me by mail or on C (vincent). |
169
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
=head1 BUGS |
171
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
Please report any bugs or feature requests to C, or through the web interface at L. |
173
|
|
|
|
|
|
|
I will be notified, and then you'll automatically be notified of progress on your bug as I make changes. |
174
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
=head1 SUPPORT |
176
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
You can find documentation for this module with the perldoc command. |
178
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
perldoc Test::Valgrind::Tool |
180
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
=head1 COPYRIGHT & LICENSE |
182
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
Copyright 2009,2010,2011,2013,2015 Vincent Pit, all rights reserved. |
184
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. |
186
|
|
|
|
|
|
|
|
187
|
|
|
|
|
|
|
=cut |
188
|
|
|
|
|
|
|
|
189
|
|
|
|
|
|
|
1; # End of Test::Valgrind::Tool |