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   103194 use warnings;
  1         9  
  1         31  
3 1     1   4 use strict;
  1         2  
  1         29  
4              
5             our $VERSION = '0.001';
6              
7 1     1   4 use base 'Test::Smoke::App::Base';
  1         2  
  1         384  
8              
9 1     1   369 use Test::Smoke::App::Archiver;
  1         3  
  1         68  
10 1     1   447 use Test::Smoke::App::Reporter;
  1         3  
  1         35  
11 1     1   384 use Test::Smoke::App::RunSmoke;
  1         3  
  1         29  
12 1     1   338 use Test::Smoke::App::SendReport;
  1         3  
  1         28  
13 1     1   327 use Test::Smoke::App::SyncTree;
  1         3  
  1         31  
14              
15 1     1   503 use Test::Smoke::App::Options;
  1         3  
  1         34  
16             my $opt = 'Test::Smoke::App::Options';
17              
18 1     1   7 use Test::Smoke::Util 'get_patch';
  1         2  
  1         378  
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 2740 my $self = shift;
48 2         10 $self->log_debug("Read configuration from: %s", $self->option('configfile'));
49              
50 2   50     15 my $old_commit = get_patch($self->option('ddir'))->[0] || "";
51 2 50 66     10 if ($self->option('smartsmoke') && $self->option('patchlevel')) {
52 0         0 $old_commit = $self->option('patchlevel');
53             }
54 2         12 $self->log_debug("Commitlevel before sync: %s", $old_commit);
55              
56 2         4 my $current_commit;
57 2 100       7 if ($self->option('sync')) {
58 1         2 local @ARGV = @{$self->ARGV};
  1         22  
59 1         21 $self->{_synctree} = Test::Smoke::App::SyncTree->new(
60             $opt->synctree_config()
61             );
62 1         20 $self->log_info("==> Starting synctree");
63 1         9 $current_commit = $self->synctree->run();
64             }
65             else {
66 1         42 $self->log_warn("==> Skipping synctree");
67 1         11 $current_commit = get_patch($self->option('ddir'))->[0];
68             }
69 2         10 $self->log_debug("Commitlevel after sync: %s", $current_commit);
70              
71 2 50 66     7 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         7 local @ARGV = @{$self->ARGV};
  2         5  
  2         10  
77 2         21 $self->{_runsmoke} = Test::Smoke::App::RunSmoke->new(
78             $opt->runsmoke_config()
79             );
80 2         15 $self->log_info("==> Starting runsmoke");
81 2         14 $self->runsmoke->run();
82             }
83              
84 2 100       7 if ($self->option('report')) {
85 1         2 local @ARGV = @{$self->ARGV};
  1         4  
86 1         6 $self->{_reporter} = Test::Smoke::App::Reporter->new(
87             $opt->reporter_config()
88             );
89 1         7 $self->log_info("==> Starting reporter");
90 1         22 $self->reporter->run();
91             }
92             else {
93 1         18 $self->log_warn("==> Skipping reporter");
94             }
95              
96 2 100       9 if ($self->option('sendreport')) {
97 1         4 local @ARGV = @{$self->ARGV};
  1         10  
98 1         23 $self->{_sendreport} = Test::Smoke::App::SendReport->new(
99             $opt->sendreport_config()
100             );
101 1         30 $self->log_info("==> Starting sendreport");
102 1         27 $self->sendreport->run();
103             }
104             else {
105 1         10 $self->log_warn("==> Skipping sendreport");
106             }
107              
108 2 100       20 if ($self->option('archive')) {
109 1         7 local @ARGV = @{$self->ARGV};
  1         7  
110 1         26 $self->{_archiver} = Test::Smoke::App::Archiver->new(
111             $opt->archiver_config()
112             );
113 1         9 $self->log_info("==> Starting archiver");
114 1         17 $self->archiver->run();
115             }
116             else {
117 1         12 $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