| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
#!/usr/bin/perl -w |
|
2
|
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
# |
|
4
|
|
|
|
|
|
|
# Kirrily "Skud" Robert |
|
5
|
|
|
|
|
|
|
# $Id$ |
|
6
|
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
5
|
use strict; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
48
|
|
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
package CPAN::Test::Reporter; |
|
10
|
|
|
|
|
|
|
|
|
11
|
1
|
|
|
1
|
|
1209
|
use Getopt::Long; |
|
|
1
|
|
|
|
|
19364
|
|
|
|
1
|
|
|
|
|
6
|
|
|
12
|
1
|
|
|
1
|
|
589
|
use Mail::Send; |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
use Config; |
|
14
|
|
|
|
|
|
|
use Carp; |
|
15
|
|
|
|
|
|
|
use CPAN; |
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
use vars '$VERSION'; |
|
18
|
|
|
|
|
|
|
$VERSION = '0.02'; |
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
=pod |
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
=head1 NAME |
|
23
|
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
CPAN::Test::Reporter - Report test results of a package retrieved from CPAN |
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
27
|
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
my $report = CPAN::Test::Reporter->new; |
|
29
|
|
|
|
|
|
|
$report->which_perl(path to the perl binary we tested with); |
|
30
|
|
|
|
|
|
|
$report->grade(pass|fail|na|unknown); |
|
31
|
|
|
|
|
|
|
$report->package(module name); |
|
32
|
|
|
|
|
|
|
$report->test_results(our build and/or make test results); |
|
33
|
|
|
|
|
|
|
$report->comments(other commentary on the module); |
|
34
|
|
|
|
|
|
|
$report->send(to whom); |
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
37
|
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
CPAN::Test::Reporter uniformly posts package test results in support of the |
|
39
|
|
|
|
|
|
|
cpan-testers project. See B |
|
40
|
|
|
|
|
|
|
for details. |
|
41
|
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
NOTE TO TESTERS: this module will currently send its output email to |
|
43
|
|
|
|
|
|
|
cpan-workers@perl.org, which might not be what you want. You can set |
|
44
|
|
|
|
|
|
|
$CPAN::Test::Reporters::CPAN_TESTERS to another email address if you |
|
45
|
|
|
|
|
|
|
prefer. |
|
46
|
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
=cut |
|
48
|
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
my $CPAN_TESTERS = 'cpan-workers@perl.org'; |
|
50
|
|
|
|
|
|
|
use vars '%Config'; |
|
51
|
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=head2 new() |
|
53
|
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
Creates a new reporter object. |
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=for testing |
|
57
|
1
|
|
|
1
|
|
445
|
BEGIN: use_ok('CPAN::Test::Reporter', "use CPAN::Test::Reporter"); |
|
|
1
|
|
|
|
|
8
|
|
|
|
1
|
|
|
|
|
837
|
|
|
|
0
|
|
|
|
|
0
|
|
|
|
0
|
|
|
|
|
0
|
|
|
|
0
|
|
|
|
|
0
|
|
|
58
|
1
|
|
|
|
|
2104
|
my $r = new CPAN::Test::Reporter; |
|
59
|
0
|
|
|
|
|
0
|
ok($r->isa('CPAN::Test::Reporter'), "Got a CPAN::Test::Reporter object"); |
|
60
|
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=cut |
|
62
|
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
sub new { |
|
64
|
|
|
|
|
|
|
my $self = {}; |
|
65
|
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
$self->{comments} = "[ None ]"; |
|
67
|
|
|
|
|
|
|
bless $self; |
|
68
|
|
|
|
|
|
|
return $self; |
|
69
|
|
|
|
|
|
|
} |
|
70
|
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=head2 grade($grade) |
|
73
|
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
grade($grade) indicates the success or failure of the package's builtin |
|
75
|
|
|
|
|
|
|
tests, and is one of: |
|
76
|
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
grade meaning |
|
78
|
|
|
|
|
|
|
----- ------- |
|
79
|
|
|
|
|
|
|
pass all tests included with the package passed |
|
80
|
|
|
|
|
|
|
fail some tests failed |
|
81
|
|
|
|
|
|
|
na the package does not work on this platform |
|
82
|
|
|
|
|
|
|
unknown the package did not include tests |
|
83
|
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=for testing |
|
85
|
0
|
|
|
|
|
0
|
my $r = new CPAN::Test::Reporter; |
|
|
0
|
|
|
|
|
0
|
|
|
86
|
0
|
|
|
|
|
0
|
$r->grade('pass'); |
|
87
|
0
|
|
|
|
|
0
|
is($r->{grade}, 'pass', "Set the grade"); |
|
88
|
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=cut |
|
90
|
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
sub grade { |
|
92
|
|
|
|
|
|
|
my ($self, $grade) = @_; |
|
93
|
|
|
|
|
|
|
my %grades = ( # Legal grades: |
|
94
|
|
|
|
|
|
|
'pass' => "all tests pass", |
|
95
|
|
|
|
|
|
|
'fail' => "some tests fail", |
|
96
|
|
|
|
|
|
|
'na' => "package will not work on this platform", |
|
97
|
|
|
|
|
|
|
'unknown' => "package did not include tests", |
|
98
|
|
|
|
|
|
|
); |
|
99
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
Carp::carp "grade argument is required" unless $grade; |
|
101
|
|
|
|
|
|
|
Carp::carp "grade '$grade' is invalid" unless $grades{$grade}; |
|
102
|
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
$self->{grade} = $grade; |
|
104
|
|
|
|
|
|
|
} |
|
105
|
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
=head2 which_perl($path) |
|
107
|
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
Specifies the version of perl you just used to test the module. |
|
109
|
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
my $r = new CPAN::Test::Reporter; |
|
111
|
|
|
|
|
|
|
$r->which_perl('5.6.1'); |
|
112
|
|
|
|
|
|
|
is($r->{which_perl}, '5.6.1', "Set the perl version"); |
|
113
|
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
=cut |
|
115
|
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
sub which_perl { |
|
117
|
|
|
|
|
|
|
my ($self, $version) = @_; |
|
118
|
|
|
|
|
|
|
$self->{which_perl} = $version; |
|
119
|
|
|
|
|
|
|
} |
|
120
|
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
=head2 package($module) |
|
122
|
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
Sets the name of the package you're working on, for example Foo-Bar-0.01 |
|
124
|
|
|
|
|
|
|
There are no restrictions on what you put here -- it was found that even |
|
125
|
|
|
|
|
|
|
requiring it to end in a dash and a version number was too restrictive |
|
126
|
|
|
|
|
|
|
for use in the wild. |
|
127
|
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
=for testing |
|
129
|
0
|
|
|
|
|
0
|
my $r = new CPAN::Test::Reporter; |
|
|
0
|
|
|
|
|
0
|
|
|
130
|
0
|
|
|
|
|
0
|
$r->package("Foo-Bar-0.01"); |
|
131
|
0
|
|
|
|
|
0
|
is($r->{package}, "Foo-Bar-0.01", "Set the package"); |
|
132
|
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
=cut |
|
134
|
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
sub package { |
|
136
|
|
|
|
|
|
|
my ($self, $package) = @_; |
|
137
|
|
|
|
|
|
|
$self->{package} = $package; |
|
138
|
|
|
|
|
|
|
} |
|
139
|
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
=head2 test_results($results) |
|
141
|
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
Sets the results for the test. $results is in the form of a string, |
|
143
|
|
|
|
|
|
|
presumably as provided by CPAN::Smoke. |
|
144
|
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
=for testing |
|
146
|
0
|
|
|
|
|
0
|
my $r = new CPAN::Test::Reporter; |
|
|
0
|
|
|
|
|
0
|
|
|
147
|
0
|
|
|
|
|
0
|
$r->test_results("here are my test results"); |
|
148
|
0
|
|
|
|
|
0
|
is($r->{test_results}, "here are my test results", "Set the test results"); |
|
149
|
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
=cut |
|
151
|
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
sub test_results { |
|
153
|
|
|
|
|
|
|
my ($self, $test_results) = @_; |
|
154
|
|
|
|
|
|
|
$self->{test_results} = $test_results; |
|
155
|
|
|
|
|
|
|
} |
|
156
|
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
=head2 comments($comments) |
|
158
|
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
Sets your comments on the test. |
|
160
|
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
=for testing |
|
162
|
0
|
|
|
|
|
0
|
my $r = new CPAN::Test::Reporter; |
|
|
0
|
|
|
|
|
0
|
|
|
163
|
0
|
|
|
|
|
0
|
$r->comments("here are my comments"); |
|
164
|
0
|
|
|
|
|
0
|
is($r->{comments}, "here are my comments", "Set the comments"); |
|
165
|
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
=cut |
|
167
|
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
sub comments { |
|
169
|
|
|
|
|
|
|
my ($self, $comments) = @_; |
|
170
|
|
|
|
|
|
|
$self->{comments} = $comments; |
|
171
|
|
|
|
|
|
|
} |
|
172
|
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
=head2 send(@recipients) |
|
174
|
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
Sends the email to cpan-testers and Cc's the mail to the recipients |
|
176
|
|
|
|
|
|
|
listed. Uses full email addresses. |
|
177
|
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
=cut |
|
179
|
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
sub send { |
|
181
|
|
|
|
|
|
|
my ($self, @recipients) = @_; |
|
182
|
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
my $report = qq( |
|
184
|
|
|
|
|
|
|
This distribution has been tested as part of the cpan-testers |
|
185
|
|
|
|
|
|
|
effort to test as many new uploads to CPAN as possible. See |
|
186
|
|
|
|
|
|
|
http://testers.cpan.org/ |
|
187
|
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
Please cc any replies to cpan-testers\@perl.org to keep other |
|
189
|
|
|
|
|
|
|
test volunteers informed and to prevent any duplicate effort. |
|
190
|
|
|
|
|
|
|
|
|
191
|
|
|
|
|
|
|
Comments: |
|
192
|
|
|
|
|
|
|
|
|
193
|
|
|
|
|
|
|
$self->{comments} |
|
194
|
|
|
|
|
|
|
|
|
195
|
|
|
|
|
|
|
Test results: |
|
196
|
|
|
|
|
|
|
|
|
197
|
|
|
|
|
|
|
$self->{test_results} |
|
198
|
|
|
|
|
|
|
|
|
199
|
|
|
|
|
|
|
Perl version: $self->{which_perl} |
|
200
|
|
|
|
|
|
|
|
|
201
|
|
|
|
|
|
|
); |
|
202
|
|
|
|
|
|
|
|
|
203
|
|
|
|
|
|
|
$report .= Config::myconfig(); |
|
204
|
|
|
|
|
|
|
|
|
205
|
|
|
|
|
|
|
my $subject = uc($self->{grade}) |
|
206
|
|
|
|
|
|
|
. " $self->{package} $Config{archname} $Config{osvers}"; |
|
207
|
|
|
|
|
|
|
my $msg = new Mail::Send Subject => $subject, To => $CPAN_TESTERS; |
|
208
|
|
|
|
|
|
|
|
|
209
|
|
|
|
|
|
|
if (@recipients) { |
|
210
|
|
|
|
|
|
|
$msg->cc(build_cc(@recipients)); |
|
211
|
|
|
|
|
|
|
} |
|
212
|
|
|
|
|
|
|
|
|
213
|
|
|
|
|
|
|
$msg->set('X-reported-via', "CPAN::Test::Reporter version $VERSION"); |
|
214
|
|
|
|
|
|
|
|
|
215
|
|
|
|
|
|
|
my $fh = $msg->open; |
|
216
|
|
|
|
|
|
|
print $fh $report; |
|
217
|
|
|
|
|
|
|
$fh->close; |
|
218
|
|
|
|
|
|
|
} |
|
219
|
|
|
|
|
|
|
|
|
220
|
|
|
|
|
|
|
=for testing |
|
221
|
0
|
|
|
|
|
0
|
is(CPAN::Test::Reporter::build_cc('skud@infotrope.net', 'skud@e-smith.com'), 'skud@infotrope.net, skud@e-smith.com', "Building CC list from email addresses"); |
|
|
0
|
|
|
|
|
0
|
|
|
222
|
|
|
|
|
|
|
|
|
223
|
|
|
|
|
|
|
=cut |
|
224
|
|
|
|
|
|
|
|
|
225
|
|
|
|
|
|
|
sub build_cc { |
|
226
|
|
|
|
|
|
|
my @recipients = @_; |
|
227
|
|
|
|
|
|
|
return join(", ", @recipients); |
|
228
|
|
|
|
|
|
|
} |
|
229
|
|
|
|
|
|
|
|
|
230
|
|
|
|
|
|
|
|
|
231
|
|
|
|
|
|
|
=head1 COPYRIGHT |
|
232
|
|
|
|
|
|
|
|
|
233
|
|
|
|
|
|
|
Copyright (c) 1999 Kurt Starsinic, 2001 Kirrily Robert. |
|
234
|
|
|
|
|
|
|
This program is free software; you may redistribute it |
|
235
|
|
|
|
|
|
|
and/or modify it under the same terms as Perl itself. |
|
236
|
|
|
|
|
|
|
|
|
237
|
|
|
|
|
|
|
=head1 SEE ALSO |
|
238
|
|
|
|
|
|
|
|
|
239
|
|
|
|
|
|
|
L |
|
240
|
|
|
|
|
|
|
|
|
241
|
|
|
|
|
|
|
=head1 AUTHOR |
|
242
|
|
|
|
|
|
|
|
|
243
|
|
|
|
|
|
|
Kirrily "Skud" Robert , based on the cpantest script |
|
244
|
|
|
|
|
|
|
by Kurt Starsinic EFE |
|
245
|
|
|
|
|
|
|
|
|
246
|
|
|
|
|
|
|
=cut |
|
247
|
|
|
|
|
|
|
|
|
248
|
|
|
|
|
|
|
return "FALSE"; # true value ;) |