File Coverage

blib/lib/Test/Smoke/App/SmokePerl.pm
Criterion Covered Total %
statement 73 76 96.0
branch 10 12 83.3
condition 5 8 62.5
subroutine 11 11 100.0
pod 1 1 100.0
total 100 108 92.5


line stmt bran cond sub pod time code
1             package Test::Smoke::App::SmokePerl;
2 1     1   138481 use warnings;
  1         11  
  1         33  
3 1     1   5 use strict;
  1         2  
  1         36  
4              
5             our $VERSION = '0.001';
6              
7 1     1   18 use base 'Test::Smoke::App::Base';
  1         4  
  1         482  
8              
9 1     1   420 use Test::Smoke::App::Archiver;
  1         3  
  1         59  
10 1     1   459 use Test::Smoke::App::Reporter;
  1         3  
  1         40  
11 1     1   455 use Test::Smoke::App::RunSmoke;
  1         3  
  1         33  
12 1     1   417 use Test::Smoke::App::SendReport;
  1         3  
  1         30  
13 1     1   422 use Test::Smoke::App::SyncTree;
  1         3  
  1         33  
14              
15 1     1   581 use Test::Smoke::App::Options;
  1         3  
  1         44  
16             my $opt = 'Test::Smoke::App::Options';
17              
18 1     1   8 use Test::Smoke::Util 'get_patch';
  1         2  
  1         441  
19              
20             =head1 NAME
21              
22             Test::Smoke::App::SmokePerl - The tssmokeperl.pl application.
23              
24             =head1 DESCRIPTION
25              
26             =head2 $app->run();
27              
28             Run all the parts:
29              
30             =over
31              
32             =item * synctree
33              
34             =item * runsmoke
35              
36             =item * report
37              
38             =item * sendrpt
39              
40             =item * archive
41              
42             =back
43              
44             =cut
45              
46             sub run {
47 2     2 1 2989 my $self = shift;
48 2         15 $self->log_debug("Read configuration from: %s", $self->option('configfile'));
49              
50 2   50     7 my $old_commit = get_patch($self->option('ddir'))->[0] || "";
51 2 50 66     11 if ($self->option('smartsmoke') && $self->option('patchlevel')) {
52 0         0 $old_commit = $self->option('patchlevel');
53             }
54 2         17 $self->log_debug("Commitlevel before sync: %s", $old_commit);
55              
56 2         8 my $current_commit;
57 2 100       26 if ($self->option('sync')) {
58 1         4 local @ARGV = @{$self->ARGV};
  1         23  
59 1         25 $self->{_synctree} = Test::Smoke::App::SyncTree->new(
60             $opt->synctree_config()
61             );
62 1         24 $self->log_info("==> Starting synctree");
63 1         12 $current_commit = $self->synctree->run();
64             }
65             else {
66 1         49 $self->log_warn("==> Skipping synctree");
67 1         14 $current_commit = get_patch($self->option('ddir'))->[0];
68             }
69 2         18 $self->log_debug("Commitlevel after sync: %s", $current_commit);
70              
71 2 50 66     11 if ($self->option('smartsmoke') && ($current_commit eq $old_commit)) {
72 0         0 $self->log_warn("Skipping this smoke, commit(%s) did not change.", $old_commit);
73 0         0 return;
74             }
75             {
76 2         8 local @ARGV = @{$self->ARGV};
  2         9  
  2         12  
77 2         46 $self->{_runsmoke} = Test::Smoke::App::RunSmoke->new(
78             $opt->runsmoke_config()
79             );
80 2         25 $self->log_info("==> Starting runsmoke");
81 2         14 $self->runsmoke->run();
82             }
83              
84 2 100       12 if ($self->option('report')) {
85 1         7 local @ARGV = @{$self->ARGV};
  1         6  
86 1         10 $self->{_reporter} = Test::Smoke::App::Reporter->new(
87             $opt->reporter_config()
88             );
89 1         7 $self->log_info("==> Starting reporter");
90 1         21 $self->reporter->run();
91             }
92             else {
93 1         24 $self->log_warn("==> Skipping reporter");
94             }
95              
96 2 100       16 if ($self->option('sendreport')) {
97 1         3 local @ARGV = @{$self->ARGV};
  1         4  
98 1         31 $self->{_sendreport} = Test::Smoke::App::SendReport->new(
99             $opt->sendreport_config()
100             );
101 1         53 $self->log_info("==> Starting sendreport");
102 1         41 $self->sendreport->run();
103             }
104             else {
105 1         20 $self->log_warn("==> Skipping sendreport");
106             }
107              
108 2 100       21 if ($self->option('archive')) {
109 1         4 local @ARGV = @{$self->ARGV};
  1         16  
110 1         37 $self->{_archiver} = Test::Smoke::App::Archiver->new(
111             $opt->archiver_config()
112             );
113 1         13 $self->log_info("==> Starting archiver");
114 1         19 $self->archiver->run();
115             }
116             else {
117 1         16 $self->log_warn("==> Skipping archiver");
118             }
119             }
120              
121             1;
122              
123             =head1 COPYRIGHT
124              
125             (c) 2002-2013, Abe Timmerman All rights reserved.
126              
127             With contributions from Jarkko Hietaniemi, Merijn Brand, Campo
128             Weijerman, Alan Burlison, Allen Smith, Alain Barbet, Dominic Dunlop,
129             Rich Rauenzahn, David Cantrell.
130              
131             This library is free software; you can redistribute it and/or modify
132             it under the same terms as Perl itself.
133              
134             See:
135              
136             =over 4
137              
138             =item * L
139              
140             =item * L
141              
142             =back
143              
144             This program is distributed in the hope that it will be useful,
145             but WITHOUT ANY WARRANTY; without even the implied warranty of
146             MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
147              
148             =cut