| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Test::Smoke::Poster; |
|
2
|
4
|
|
|
4
|
|
427
|
use warnings; |
|
|
4
|
|
|
|
|
11
|
|
|
|
4
|
|
|
|
|
136
|
|
|
3
|
4
|
|
|
4
|
|
21
|
use strict; |
|
|
4
|
|
|
|
|
8
|
|
|
|
4
|
|
|
|
|
88
|
|
|
4
|
4
|
|
|
4
|
|
22
|
use Carp; |
|
|
4
|
|
|
|
|
8
|
|
|
|
4
|
|
|
|
|
303
|
|
|
5
|
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
our $VERSION = '0.001'; |
|
7
|
|
|
|
|
|
|
|
|
8
|
4
|
|
|
4
|
|
27
|
use Cwd qw/:DEFAULT abs_path/; |
|
|
4
|
|
|
|
|
9
|
|
|
|
4
|
|
|
|
|
768
|
|
|
9
|
4
|
|
|
4
|
|
575
|
use File::Spec::Functions qw/:DEFAULT rel2abs/; |
|
|
4
|
|
|
|
|
997
|
|
|
|
4
|
|
|
|
|
660
|
|
|
10
|
4
|
|
|
4
|
|
1751
|
use Test::Smoke::Poster::Curl; |
|
|
4
|
|
|
|
|
15
|
|
|
|
4
|
|
|
|
|
175
|
|
|
11
|
4
|
|
|
4
|
|
1696
|
use Test::Smoke::Poster::HTTP_Tiny; |
|
|
4
|
|
|
|
|
10
|
|
|
|
4
|
|
|
|
|
132
|
|
|
12
|
4
|
|
|
4
|
|
1698
|
use Test::Smoke::Poster::LWP_UserAgent; |
|
|
4
|
|
|
|
|
12
|
|
|
|
4
|
|
|
|
|
1697
|
|
|
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
|
108
|
my $factory = shift; |
|
78
|
6
|
|
33
|
|
|
51
|
my $poster = shift || $CONFIG{df_poster}; |
|
79
|
|
|
|
|
|
|
|
|
80
|
6
|
50
|
|
|
|
119
|
my %args = ref $_[0] eq 'HASH' ? %{$_[0]} : @_; |
|
|
0
|
|
|
|
|
0
|
|
|
81
|
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
my %fields = map { |
|
83
|
36
|
100
|
|
|
|
101
|
my $value = exists $args{$_} ? $args{ $_ } : $CONFIG{ "df_$_" }; |
|
84
|
36
|
|
|
|
|
135
|
( $_ => $value ) |
|
85
|
6
|
|
|
|
|
23
|
} ( @{ $CONFIG{general_options} }, @{ $CONFIG{$poster}{allowed} } ); |
|
|
6
|
|
|
|
|
35
|
|
|
|
6
|
|
|
|
|
29
|
|
|
86
|
6
|
50
|
|
|
|
102
|
if ( ! file_name_is_absolute( $fields{ddir} ) ) { |
|
87
|
6
|
|
|
|
|
235
|
$fields{ddir} = catdir( abs_path(), $fields{ddir} ); |
|
88
|
|
|
|
|
|
|
} |
|
89
|
6
|
|
|
|
|
97
|
$fields{ddir} = rel2abs( $fields{ddir}, abs_path() ); |
|
90
|
6
|
|
|
|
|
209
|
$fields{poster} = $poster; |
|
91
|
|
|
|
|
|
|
|
|
92
|
6
|
|
|
|
|
16
|
my @missing; |
|
93
|
6
|
|
|
|
|
13
|
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
|
|
|
|
31
|
if (@missing) { |
|
100
|
0
|
|
|
|
|
0
|
croak("Missing option:\n\t", join("\n\t", @missing)); |
|
101
|
|
|
|
|
|
|
} |
|
102
|
|
|
|
|
|
|
|
|
103
|
6
|
|
|
|
|
23
|
my $class = $CONFIG{$poster}{class}; |
|
104
|
6
|
|
|
|
|
88
|
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 |