line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Test::Smoke::Poster; |
2
|
4
|
|
|
4
|
|
347
|
use warnings; |
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
118
|
|
3
|
4
|
|
|
4
|
|
18
|
use strict; |
|
4
|
|
|
|
|
6
|
|
|
4
|
|
|
|
|
61
|
|
4
|
4
|
|
|
4
|
|
16
|
use Carp; |
|
4
|
|
|
|
|
5
|
|
|
4
|
|
|
|
|
243
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
our $VERSION = '0.001'; |
7
|
|
|
|
|
|
|
|
8
|
4
|
|
|
4
|
|
23
|
use Cwd qw/:DEFAULT abs_path/; |
|
4
|
|
|
|
|
6
|
|
|
4
|
|
|
|
|
527
|
|
9
|
4
|
|
|
4
|
|
428
|
use File::Spec::Functions qw/:DEFAULT rel2abs/; |
|
4
|
|
|
|
|
720
|
|
|
4
|
|
|
|
|
480
|
|
10
|
4
|
|
|
4
|
|
1449
|
use Test::Smoke::Poster::Curl; |
|
4
|
|
|
|
|
9
|
|
|
4
|
|
|
|
|
123
|
|
11
|
4
|
|
|
4
|
|
1397
|
use Test::Smoke::Poster::HTTP_Tiny; |
|
4
|
|
|
|
|
9
|
|
|
4
|
|
|
|
|
101
|
|
12
|
4
|
|
|
4
|
|
1336
|
use Test::Smoke::Poster::LWP_UserAgent; |
|
4
|
|
|
|
|
11
|
|
|
4
|
|
|
|
|
1356
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
=head1 NAME |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
Test::Smoke::Poster - Factory for poster objects. |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
=head1 SYNOPSIS |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
use Test::Smoke::Poster; |
21
|
|
|
|
|
|
|
my $poster = Test::Smoke::Poster->new( |
22
|
|
|
|
|
|
|
'LWP::UserAgent', |
23
|
|
|
|
|
|
|
ddir => '.', |
24
|
|
|
|
|
|
|
smokedb_url => 'http://perl5.test-smoke.org/report', |
25
|
|
|
|
|
|
|
); |
26
|
|
|
|
|
|
|
$poster->post(); |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
=head1 DESCRIPTION |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
Returns a instance of the object-class requested. |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
=cut |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
my %CONFIG = ( |
35
|
|
|
|
|
|
|
df_poster => 'HTTP::Tiny', |
36
|
|
|
|
|
|
|
df_ddir => undef, |
37
|
|
|
|
|
|
|
df_jsnfile => 'mktest.jsn', |
38
|
|
|
|
|
|
|
df_v => 0, |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
df_smokedb_url => 'http://perl5.test-smoke.org/report', |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
df_ua_timeout => undef, |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
df_curlargs => [ ], |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
'LWP::UserAgent' => { |
47
|
|
|
|
|
|
|
allowed => [qw/ua_timeout/], |
48
|
|
|
|
|
|
|
required => [], |
49
|
|
|
|
|
|
|
class => 'Test::Smoke::Poster::LWP_UserAgent', |
50
|
|
|
|
|
|
|
}, |
51
|
|
|
|
|
|
|
'HTTP::Tiny' => { |
52
|
|
|
|
|
|
|
allowed => [qw/ua_timeout/], |
53
|
|
|
|
|
|
|
required => [], |
54
|
|
|
|
|
|
|
class => 'Test::Smoke::Poster::HTTP_Tiny', |
55
|
|
|
|
|
|
|
}, |
56
|
|
|
|
|
|
|
'curl' => { |
57
|
|
|
|
|
|
|
allowed => [qw/curlbin curlargs ua_timeout/], |
58
|
|
|
|
|
|
|
required => [qw/curlbin/], |
59
|
|
|
|
|
|
|
class => 'Test::Smoke::Poster::Curl', |
60
|
|
|
|
|
|
|
}, |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
valid_type => { |
63
|
|
|
|
|
|
|
'LWP::UserAgent' => 1, |
64
|
|
|
|
|
|
|
'HTTP::Tiny' => 1, |
65
|
|
|
|
|
|
|
}, |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
general_options => [qw/ddir jsnfile v smokedb_url poster/], |
68
|
|
|
|
|
|
|
); |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=head2 Test::Smoke::Poster->new($poster_type, %arguments) |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
Check arguments and return an instance of $poster_type. |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=cut |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
sub new { |
77
|
6
|
|
|
6
|
1
|
109
|
my $factory = shift; |
78
|
6
|
|
33
|
|
|
34
|
my $poster = shift || $CONFIG{df_poster}; |
79
|
|
|
|
|
|
|
|
80
|
6
|
50
|
|
|
|
98
|
my %args = ref $_[0] eq 'HASH' ? %{$_[0]} : @_; |
|
0
|
|
|
|
|
0
|
|
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
my %fields = map { |
83
|
36
|
100
|
|
|
|
81
|
my $value = exists $args{$_} ? $args{ $_ } : $CONFIG{ "df_$_" }; |
84
|
36
|
|
|
|
|
90
|
( $_ => $value ) |
85
|
6
|
|
|
|
|
23
|
} ( @{ $CONFIG{general_options} }, @{ $CONFIG{$poster}{allowed} } ); |
|
6
|
|
|
|
|
30
|
|
|
6
|
|
|
|
|
23
|
|
86
|
6
|
50
|
|
|
|
61
|
if ( ! file_name_is_absolute( $fields{ddir} ) ) { |
87
|
6
|
|
|
|
|
284
|
$fields{ddir} = catdir( abs_path(), $fields{ddir} ); |
88
|
|
|
|
|
|
|
} |
89
|
6
|
|
|
|
|
86
|
$fields{ddir} = rel2abs( $fields{ddir}, abs_path() ); |
90
|
6
|
|
|
|
|
171
|
$fields{poster} = $poster; |
91
|
|
|
|
|
|
|
|
92
|
6
|
|
|
|
|
12
|
my @missing; |
93
|
6
|
|
|
|
|
11
|
for my $required (@{ $CONFIG{$poster}{required} }) { |
|
6
|
|
|
|
|
34
|
|
94
|
|
|
|
|
|
|
push( |
95
|
|
|
|
|
|
|
@missing, |
96
|
|
|
|
|
|
|
"option '$required' missing for '$CONFIG{$poster}{class}'" |
97
|
0
|
0
|
|
|
|
0
|
) if !defined $fields{$required}; |
98
|
|
|
|
|
|
|
} |
99
|
6
|
50
|
|
|
|
27
|
if (@missing) { |
100
|
0
|
|
|
|
|
0
|
croak("Missing option:\n\t", join("\n\t", @missing)); |
101
|
|
|
|
|
|
|
} |
102
|
|
|
|
|
|
|
|
103
|
6
|
|
|
|
|
25
|
my $class = $CONFIG{$poster}{class}; |
104
|
6
|
|
|
|
|
82
|
return $class->new(%fields); |
105
|
|
|
|
|
|
|
} |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
1; |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
=head1 COPYRIGHT |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
(c) 2002-2013, Abe Timmerman All rights reserved. |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
With contributions from Jarkko Hietaniemi, Merijn Brand, Campo |
114
|
|
|
|
|
|
|
Weijerman, Alan Burlison, Allen Smith, Alain Barbet, Dominic Dunlop, |
115
|
|
|
|
|
|
|
Rich Rauenzahn, David Cantrell. |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or modify |
118
|
|
|
|
|
|
|
it under the same terms as Perl itself. |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
See: |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
=over 4 |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
=item * L |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
=item * L |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
=back |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful, |
131
|
|
|
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of |
132
|
|
|
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
=cut |