| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Test::Smoke::App::SendReport; |
|
2
|
2
|
|
|
2
|
|
108741
|
use warnings; |
|
|
2
|
|
|
|
|
15
|
|
|
|
2
|
|
|
|
|
69
|
|
|
3
|
2
|
|
|
2
|
|
10
|
use strict; |
|
|
2
|
|
|
|
|
4
|
|
|
|
2
|
|
|
|
|
70
|
|
|
4
|
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
our $VERSION = '0.001'; |
|
6
|
|
|
|
|
|
|
|
|
7
|
2
|
|
|
2
|
|
11
|
use base 'Test::Smoke::App::Base'; |
|
|
2
|
|
|
|
|
4
|
|
|
|
2
|
|
|
|
|
548
|
|
|
8
|
|
|
|
|
|
|
|
|
9
|
2
|
|
|
2
|
|
489
|
use File::Spec::Functions; |
|
|
2
|
|
|
|
|
911
|
|
|
|
2
|
|
|
|
|
152
|
|
|
10
|
2
|
|
|
2
|
|
864
|
use Test::Smoke::Mailer; |
|
|
2
|
|
|
|
|
6
|
|
|
|
2
|
|
|
|
|
70
|
|
|
11
|
2
|
|
|
2
|
|
837
|
use Test::Smoke::Poster; |
|
|
2
|
|
|
|
|
5
|
|
|
|
2
|
|
|
|
|
73
|
|
|
12
|
2
|
|
|
2
|
|
578
|
use Test::Smoke::Reporter; |
|
|
2
|
|
|
|
|
6
|
|
|
|
2
|
|
|
|
|
914
|
|
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
=head1 NAME |
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
Test::Smoke::App::SendReport - Implementation for tssendrpt.pl |
|
17
|
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
=head1 DESCRIPTIN |
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
=head2 $sendrpt->run() |
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
=over |
|
23
|
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
=item * Send e-mail if C<< $self->option('mail') >> |
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
=item * Post to CoreSmokeDB if C<< $self->option('smokedb_url') >> |
|
27
|
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
=back |
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
=cut |
|
31
|
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub run { |
|
33
|
1
|
|
|
1
|
1
|
1666
|
my $self = shift; |
|
34
|
|
|
|
|
|
|
|
|
35
|
1
|
|
|
|
|
7
|
$self->check_for_report_and_json; |
|
36
|
|
|
|
|
|
|
|
|
37
|
1
|
50
|
|
|
|
8
|
if ($self->option('mail')) { |
|
38
|
0
|
|
|
|
|
0
|
$self->{_mailer} = Test::Smoke::Mailer->new( |
|
39
|
|
|
|
|
|
|
$self->option('mail_type'), |
|
40
|
|
|
|
|
|
|
$self->options, |
|
41
|
|
|
|
|
|
|
v => $self->option('verbose'), |
|
42
|
|
|
|
|
|
|
); |
|
43
|
0
|
|
|
|
|
0
|
$self->log_info("==> Starting mailer"); |
|
44
|
0
|
|
|
|
|
0
|
$self->mailer->mail(); |
|
45
|
|
|
|
|
|
|
} |
|
46
|
|
|
|
|
|
|
else { |
|
47
|
1
|
|
|
|
|
33
|
$self->log_warn("==> Skipping mailer"); |
|
48
|
|
|
|
|
|
|
} |
|
49
|
|
|
|
|
|
|
|
|
50
|
1
|
50
|
|
|
|
20
|
if ($self->option('smokedb_url')) { |
|
51
|
1
|
|
|
|
|
9
|
$self->{_poster} = Test::Smoke::Poster->new( |
|
52
|
|
|
|
|
|
|
$self->option('poster'), |
|
53
|
|
|
|
|
|
|
$self->options, |
|
54
|
|
|
|
|
|
|
v => $self->option('verbose'), |
|
55
|
|
|
|
|
|
|
); |
|
56
|
1
|
|
|
|
|
33
|
$self->log_info("==> Starting poster"); |
|
57
|
1
|
|
|
|
|
20
|
my $id = $self->poster->post(); |
|
58
|
1
|
|
|
|
|
18
|
$self->log_warn("%s/%s", $self->option('smokedb_url'), $id); |
|
59
|
1
|
|
|
|
|
8
|
return $id; |
|
60
|
|
|
|
|
|
|
} |
|
61
|
|
|
|
|
|
|
else { |
|
62
|
0
|
|
|
|
|
|
$self->log_warn("==> Skipping poster"); |
|
63
|
|
|
|
|
|
|
} |
|
64
|
|
|
|
|
|
|
} |
|
65
|
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=head2 $sendrpt->check_for_report_and_json() |
|
67
|
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
Check for the '.rpt' and the '.jsn' file, return true if both exist. |
|
69
|
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=cut |
|
71
|
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
sub check_for_report_and_json { |
|
73
|
0
|
|
|
0
|
|
|
my $self = shift; |
|
74
|
|
|
|
|
|
|
|
|
75
|
0
|
|
|
|
|
|
my $rptfile = catfile($self->option('ddir'), $self->option('rptfile')); |
|
76
|
0
|
|
|
|
|
|
my $jsnfile = catfile($self->option('ddir'), $self->option('jsnfile')); |
|
77
|
0
|
|
|
|
|
|
my $missing = 0; |
|
78
|
0
|
0
|
|
|
|
|
if (!-f $rptfile) { |
|
79
|
0
|
|
|
|
|
|
$self->log_warn("RPTfile ($rptfile) not found"); |
|
80
|
0
|
|
|
|
|
|
$missing = 1; |
|
81
|
|
|
|
|
|
|
} |
|
82
|
|
|
|
|
|
|
else { |
|
83
|
0
|
|
|
|
|
|
$self->log_debug("RPTfile (%s) found.", $rptfile); |
|
84
|
|
|
|
|
|
|
} |
|
85
|
0
|
0
|
|
|
|
|
if (!-f $jsnfile) { |
|
86
|
0
|
|
|
|
|
|
$self->log_warn("JSNfile ($jsnfile) not found"); |
|
87
|
0
|
|
|
|
|
|
$missing = 1; |
|
88
|
|
|
|
|
|
|
} |
|
89
|
|
|
|
|
|
|
else { |
|
90
|
0
|
|
|
|
|
|
$self->log_debug("JSNfile (%s) found.", $jsnfile); |
|
91
|
|
|
|
|
|
|
} |
|
92
|
0
|
0
|
0
|
|
|
|
if ($missing || $self->option('report')) { |
|
93
|
0
|
|
|
|
|
|
$self->log_info("Regenerate report and json."); |
|
94
|
0
|
|
|
|
|
|
$self->regen_report_and_json(); |
|
95
|
|
|
|
|
|
|
} |
|
96
|
0
|
|
|
|
|
|
return 1; |
|
97
|
|
|
|
|
|
|
} |
|
98
|
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=head2 $sendrpt->regen_report_and_json() |
|
100
|
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
Create a reporter object and generate the '.rpt' and '.jsn' files. |
|
102
|
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
=cut |
|
104
|
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
sub regen_report_and_json { |
|
106
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
107
|
|
|
|
|
|
|
|
|
108
|
0
|
|
|
|
|
|
my $outfile = catfile($self->option('ddir'), $self->option('outfile')); |
|
109
|
0
|
0
|
|
|
|
|
if (!-f $outfile) { |
|
110
|
0
|
|
|
|
|
|
die "No smoke results found ($outfile)\n"; |
|
111
|
|
|
|
|
|
|
} |
|
112
|
0
|
|
|
|
|
|
my $reporter = Test::Smoke::Reporter->new( |
|
113
|
|
|
|
|
|
|
$self->options, |
|
114
|
|
|
|
|
|
|
v => $self->option('verbose'), |
|
115
|
|
|
|
|
|
|
); |
|
116
|
0
|
|
|
|
|
|
$self->log_debug("[Reporter] write_to_file()"); |
|
117
|
0
|
|
|
|
|
|
$reporter->write_to_file(); |
|
118
|
0
|
|
|
|
|
|
$self->log_debug("[Reporter] smokedb_data()"); |
|
119
|
0
|
|
|
|
|
|
$reporter->smokedb_data(); |
|
120
|
|
|
|
|
|
|
|
|
121
|
0
|
|
|
|
|
|
return 1; |
|
122
|
|
|
|
|
|
|
} |
|
123
|
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
1; |
|
125
|
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
=head1 COPYRIGHT |
|
127
|
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
(c) 2002-2013, Abe Timmerman All rights reserved. |
|
129
|
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
With contributions from Jarkko Hietaniemi, Merijn Brand, Campo |
|
131
|
|
|
|
|
|
|
Weijerman, Alan Burlison, Allen Smith, Alain Barbet, Dominic Dunlop, |
|
132
|
|
|
|
|
|
|
Rich Rauenzahn, David Cantrell. |
|
133
|
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or modify |
|
135
|
|
|
|
|
|
|
it under the same terms as Perl itself. |
|
136
|
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
See: |
|
138
|
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
=over 4 |
|
140
|
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
=item * L |
|
142
|
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
=item * L |
|
144
|
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
=back |
|
146
|
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful, |
|
148
|
|
|
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
149
|
|
|
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
|
150
|
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
=cut |