| 1 | package Test::Smoke::App::SendReport; | ||||||||||||||||||||||||||||
| 2 | 2 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 3 | 2 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||
| 5 | 2 | our $VERSION = '0.001'; | |||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||
| 7 | 2 | ▶ | use base 'Test::Smoke::App::Base'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||
| 9 | 2 | ▶ | use File::Spec::Functions; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 10 | 2 | ▶ | use Test::Smoke::Mailer; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 11 | 2 | ▶ | use Test::Smoke::Poster; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 12 | 2 | ▶ | use Test::Smoke::Reporter; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 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 | 1 | ▶ | sub run { | ||||||||||||||||||||||||||
|
Subroutine
run: called CC=3 SCAR=12.0
Pod
documented
| |||||||||||||||||||||||||||||
| 33 | 1 | my $self = shift; | |||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||
| 35 | 1 | $self->check_for_report_and_json; | |||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||
| 37 | 1 | ▶ | if ($self->option('mail')) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 38 | 0 | $self->{_mailer} = Test::Smoke::Mailer->new( | |||||||||||||||||||||||||||
| 39 | $self->option('mail_type'), | ||||||||||||||||||||||||||||
| 40 | $self->options, | ||||||||||||||||||||||||||||
| 41 | v => $self->option('verbose'), | ||||||||||||||||||||||||||||
| 42 | ); | ||||||||||||||||||||||||||||
| 43 | 0 | $self->log_info("==> Starting mailer"); | |||||||||||||||||||||||||||
| 44 | 0 | $self->mailer->mail(); | |||||||||||||||||||||||||||
| 45 | } | ||||||||||||||||||||||||||||
| 46 | else { | ||||||||||||||||||||||||||||
| 47 | 1 | $self->log_warn("==> Skipping mailer"); | |||||||||||||||||||||||||||
| 48 | } | ||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||
| 50 | 1 | ▶ | if ($self->option('smokedb_url')) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 51 | 1 | $self->{_poster} = Test::Smoke::Poster->new( | |||||||||||||||||||||||||||
| 52 | $self->option('poster'), | ||||||||||||||||||||||||||||
| 53 | $self->options, | ||||||||||||||||||||||||||||
| 54 | v => $self->option('verbose'), | ||||||||||||||||||||||||||||
| 55 | ); | ||||||||||||||||||||||||||||
| 56 | 1 | $self->log_info("==> Starting poster"); | |||||||||||||||||||||||||||
| 57 | 1 | my $id = $self->poster->post(); | |||||||||||||||||||||||||||
| 58 | 1 | $self->log_warn("%s/%s", $self->option('smokedb_url'), $id); | |||||||||||||||||||||||||||
| 59 | 1 | 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 | 0 | ▶ | sub check_for_report_and_json { | ||||||||||||||||||||||||||
|
Subroutine
check_for_report_and_json: not called CC=5 SCAR=34.0
| |||||||||||||||||||||||||||||
| 73 | 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 | ▶ | if (!-f $rptfile) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 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 | ▶ | if (!-f $jsnfile) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 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 | ▶ | if ($missing || $self->option('report')) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$missing or $self->option("report")
MC/DC0%0/2
$missing or $self->option("report")
$missing
$self->option("report")
Truth table0%0/3
A or B
A= $missingB= $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 | 0 | ▶ | sub regen_report_and_json { | ||||||||||||||||||||||||||
|
Subroutine
regen_report_and_json: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||
| 106 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 107 | |||||||||||||||||||||||||||||
| 108 | 0 | my $outfile = catfile($self->option('ddir'), $self->option('outfile')); | |||||||||||||||||||||||||||
| 109 | 0 | ▶ | if (!-f $outfile) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 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 | 2 | 1; | |||||||||||||||||||||||||||
| 125 | |||||||||||||||||||||||||||||
| 126 | =head1 COPYRIGHT | ||||||||||||||||||||||||||||
| 127 | |||||||||||||||||||||||||||||
| 128 | (c) 2002-2013, Abe Timmerman <abeltje@cpan.org> 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<http://www.perl.com/perl/misc/Artistic.html> | ||||||||||||||||||||||||||||
| 142 | |||||||||||||||||||||||||||||
| 143 | =item * L<http://www.gnu.org/copyleft/gpl.html> | ||||||||||||||||||||||||||||
| 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 | ||||||||||||||||||||||||||||