| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Test::Chimps::Client; |
|
2
|
|
|
|
|
|
|
|
|
3
|
5
|
|
|
5
|
|
32574
|
use 5.008; |
|
|
5
|
|
|
|
|
18
|
|
|
|
5
|
|
|
|
|
211
|
|
|
4
|
5
|
|
|
5
|
|
26
|
use warnings; |
|
|
5
|
|
|
|
|
11
|
|
|
|
5
|
|
|
|
|
207
|
|
|
5
|
5
|
|
|
5
|
|
25
|
use strict; |
|
|
5
|
|
|
|
|
14
|
|
|
|
5
|
|
|
|
|
264
|
|
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '0.11_01'; |
|
8
|
|
|
|
|
|
|
|
|
9
|
5
|
|
|
5
|
|
28
|
use Carp; |
|
|
5
|
|
|
|
|
9
|
|
|
|
5
|
|
|
|
|
385
|
|
|
10
|
5
|
|
|
5
|
|
1781
|
use Params::Validate qw/:all/; |
|
|
5
|
|
|
|
|
11520
|
|
|
|
5
|
|
|
|
|
1138
|
|
|
11
|
5
|
|
|
5
|
|
17194
|
use HTTP::Request::Common; |
|
|
5
|
|
|
|
|
177620
|
|
|
|
5
|
|
|
|
|
558
|
|
|
12
|
5
|
|
|
5
|
|
16519
|
use LWP::UserAgent; |
|
|
5
|
|
|
|
|
178796
|
|
|
|
5
|
|
|
|
|
228
|
|
|
13
|
|
|
|
|
|
|
|
|
14
|
5
|
|
|
5
|
|
67
|
use constant PROTO_VERSION => 1.0; |
|
|
5
|
|
|
|
|
12
|
|
|
|
5
|
|
|
|
|
522
|
|
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
=head1 NAME |
|
17
|
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
Test::Chimps::Client - Send smoke test results to a server |
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
This module simplifies the process of sending smoke test results |
|
23
|
|
|
|
|
|
|
(in the form of Cs) to a smoke server. |
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
use File::Temp; |
|
26
|
|
|
|
|
|
|
my $tmpfile = File::Temp->new( SUFFIX => ".tar.gz" ); |
|
27
|
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
use TAP::Harness::Archive; |
|
29
|
|
|
|
|
|
|
chdir "some/module/directory"; |
|
30
|
|
|
|
|
|
|
my $harness = TAP::Harness::Archive->new( { |
|
31
|
|
|
|
|
|
|
archive => $tmpfile, |
|
32
|
|
|
|
|
|
|
extra_properties => { |
|
33
|
|
|
|
|
|
|
project => 'my project', |
|
34
|
|
|
|
|
|
|
revision => 'some revision', |
|
35
|
|
|
|
|
|
|
committer => 'me', |
|
36
|
|
|
|
|
|
|
osname => $Config{osname}, |
|
37
|
|
|
|
|
|
|
osvers => $Config{osvers}, |
|
38
|
|
|
|
|
|
|
archname => $Config{archname}, |
|
39
|
|
|
|
|
|
|
}, |
|
40
|
|
|
|
|
|
|
.... |
|
41
|
|
|
|
|
|
|
} ); |
|
42
|
|
|
|
|
|
|
$harness->runtests(glob('t/*.t')); |
|
43
|
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
use Test::Chimps::Client; |
|
45
|
|
|
|
|
|
|
my $client = Test::Chimps::Client->new( |
|
46
|
|
|
|
|
|
|
archive => $tmpfile, |
|
47
|
|
|
|
|
|
|
server => "http://...", |
|
48
|
|
|
|
|
|
|
); |
|
49
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
print "Sending smoke report for $server\n"; |
|
51
|
|
|
|
|
|
|
my ($status, $msg) = $client->send; |
|
52
|
|
|
|
|
|
|
die "Error: the server responded: $msg\n" |
|
53
|
|
|
|
|
|
|
unless $status; |
|
54
|
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=head1 INSTALLATION |
|
56
|
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
To install this module, run the following commands: |
|
58
|
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
perl Makefile.PL |
|
60
|
|
|
|
|
|
|
make |
|
61
|
|
|
|
|
|
|
make test |
|
62
|
|
|
|
|
|
|
make install |
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
65
|
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
Chimps is the Collaborative Heterogeneous Infinite Monkey |
|
67
|
|
|
|
|
|
|
Perfectionification Service. It is a framework for storing, |
|
68
|
|
|
|
|
|
|
viewing, generating, and uploading smoke reports. |
|
69
|
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
This distribution provides client-side modules and binaries |
|
71
|
|
|
|
|
|
|
for Chimps. |
|
72
|
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=head1 METHODS |
|
74
|
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=head2 new ARGS |
|
76
|
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
Creates a new Client object. ARGS is a hash whose valid keys are: |
|
78
|
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=over 4 |
|
80
|
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=item * file |
|
82
|
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
Mandatory. The value must be a C. These are the |
|
84
|
|
|
|
|
|
|
test results that will be submitted to the server. |
|
85
|
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=item * report_variables |
|
87
|
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
Optional. A hashref of report variables and values to send to the |
|
89
|
|
|
|
|
|
|
server. |
|
90
|
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=item * server |
|
92
|
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
Mandatory. The URI of the server script to upload the model to. |
|
94
|
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=back |
|
96
|
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
=cut |
|
98
|
|
|
|
|
|
|
|
|
99
|
5
|
|
|
5
|
|
31
|
use base qw/Class::Accessor/; |
|
|
5
|
|
|
|
|
12
|
|
|
|
5
|
|
|
|
|
4152
|
|
|
100
|
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
__PACKAGE__->mk_ro_accessors(qw/archive server/); |
|
102
|
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
sub new { |
|
104
|
1
|
|
|
1
|
1
|
1190
|
my $class = shift; |
|
105
|
1
|
|
|
|
|
3
|
my $obj = bless {}, $class; |
|
106
|
1
|
|
|
|
|
6
|
$obj->_init(@_); |
|
107
|
1
|
|
|
|
|
5
|
return $obj; |
|
108
|
|
|
|
|
|
|
} |
|
109
|
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
sub _init { |
|
111
|
1
|
|
|
1
|
|
3
|
my $self = shift; |
|
112
|
1
|
|
|
|
|
68
|
my %args = validate_with( |
|
113
|
|
|
|
|
|
|
params => \@_, |
|
114
|
|
|
|
|
|
|
called => 'The Test::Chimps::Client constructor', |
|
115
|
|
|
|
|
|
|
spec => { |
|
116
|
|
|
|
|
|
|
archive => { isa => 'File::Temp' }, |
|
117
|
|
|
|
|
|
|
server => 1, |
|
118
|
|
|
|
|
|
|
report_variables => { |
|
119
|
|
|
|
|
|
|
optional => 1, |
|
120
|
|
|
|
|
|
|
type => HASHREF, |
|
121
|
|
|
|
|
|
|
default => {} |
|
122
|
|
|
|
|
|
|
} |
|
123
|
|
|
|
|
|
|
} |
|
124
|
|
|
|
|
|
|
); |
|
125
|
|
|
|
|
|
|
|
|
126
|
1
|
|
|
|
|
121
|
foreach my $key (keys %args) { |
|
127
|
3
|
|
|
|
|
162
|
$self->{$key} = $args{$key}; |
|
128
|
|
|
|
|
|
|
} |
|
129
|
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
} |
|
131
|
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
=head2 send |
|
133
|
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
Submit the specified model to the server. This function's return |
|
135
|
|
|
|
|
|
|
value is a list, the first of which indicates success or failure, |
|
136
|
|
|
|
|
|
|
and the second of which is an error string. |
|
137
|
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
=cut |
|
139
|
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
sub send { |
|
141
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
142
|
|
|
|
|
|
|
|
|
143
|
0
|
|
|
|
|
|
my $ua = LWP::UserAgent->new; |
|
144
|
0
|
|
|
|
|
|
$ua->agent( "Test-Chimps-Client/" . PROTO_VERSION ); |
|
145
|
0
|
|
|
|
|
|
$ua->env_proxy; |
|
146
|
|
|
|
|
|
|
|
|
147
|
0
|
|
|
|
|
|
my $resp = $ua->post( |
|
148
|
|
|
|
|
|
|
$self->server, |
|
149
|
|
|
|
|
|
|
Content_Type => 'form-data', |
|
150
|
|
|
|
|
|
|
Content => [ |
|
151
|
|
|
|
|
|
|
upload => 1, |
|
152
|
|
|
|
|
|
|
archive => [ "$self->{archive}" ], |
|
153
|
|
|
|
|
|
|
version => PROTO_VERSION |
|
154
|
|
|
|
|
|
|
], |
|
155
|
|
|
|
|
|
|
); |
|
156
|
|
|
|
|
|
|
|
|
157
|
0
|
0
|
|
|
|
|
if ( $resp->is_success ) { |
|
158
|
0
|
0
|
|
|
|
|
if ( $resp->content =~ /^ok/ ) { |
|
159
|
0
|
|
|
|
|
|
return ( 1, '' ); |
|
160
|
|
|
|
|
|
|
} else { |
|
161
|
0
|
|
|
|
|
|
return ( 0, $resp->content ); |
|
162
|
|
|
|
|
|
|
} |
|
163
|
|
|
|
|
|
|
} else { |
|
164
|
0
|
|
|
|
|
|
return ( 0, $resp->status_line ); |
|
165
|
|
|
|
|
|
|
} |
|
166
|
|
|
|
|
|
|
} |
|
167
|
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
=head1 ACCESSORS |
|
169
|
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
There are read-only accessors for model, report_variables, and server. |
|
171
|
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
=head1 AUTHOR |
|
173
|
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
Zev Benjamin, C<< >> |
|
175
|
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
=head1 BUGS |
|
177
|
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
Please report any bugs or feature requests to |
|
179
|
|
|
|
|
|
|
C, or through the web interface at |
|
180
|
|
|
|
|
|
|
L. |
|
181
|
|
|
|
|
|
|
I will be notified, and then you'll automatically be notified of progress on |
|
182
|
|
|
|
|
|
|
your bug as I make changes. |
|
183
|
|
|
|
|
|
|
|
|
184
|
|
|
|
|
|
|
=head1 SUPPORT |
|
185
|
|
|
|
|
|
|
|
|
186
|
|
|
|
|
|
|
You can find documentation for this module with the perldoc command. |
|
187
|
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
perldoc Test::Chimps::Client |
|
189
|
|
|
|
|
|
|
|
|
190
|
|
|
|
|
|
|
You can also look for information at: |
|
191
|
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
=over 4 |
|
193
|
|
|
|
|
|
|
|
|
194
|
|
|
|
|
|
|
=item * Mailing list |
|
195
|
|
|
|
|
|
|
|
|
196
|
|
|
|
|
|
|
Chimps has a mailman mailing list at |
|
197
|
|
|
|
|
|
|
L. You can subscribe via the web |
|
198
|
|
|
|
|
|
|
interface at |
|
199
|
|
|
|
|
|
|
L. |
|
200
|
|
|
|
|
|
|
|
|
201
|
|
|
|
|
|
|
=item * Repository |
|
202
|
|
|
|
|
|
|
|
|
203
|
|
|
|
|
|
|
L |
|
204
|
|
|
|
|
|
|
|
|
205
|
|
|
|
|
|
|
=item * AnnoCPAN: Annotated CPAN documentation |
|
206
|
|
|
|
|
|
|
|
|
207
|
|
|
|
|
|
|
L |
|
208
|
|
|
|
|
|
|
|
|
209
|
|
|
|
|
|
|
=item * CPAN Ratings |
|
210
|
|
|
|
|
|
|
|
|
211
|
|
|
|
|
|
|
L |
|
212
|
|
|
|
|
|
|
|
|
213
|
|
|
|
|
|
|
=item * RT: CPAN's request tracker |
|
214
|
|
|
|
|
|
|
|
|
215
|
|
|
|
|
|
|
L |
|
216
|
|
|
|
|
|
|
|
|
217
|
|
|
|
|
|
|
=item * Search CPAN |
|
218
|
|
|
|
|
|
|
|
|
219
|
|
|
|
|
|
|
L |
|
220
|
|
|
|
|
|
|
|
|
221
|
|
|
|
|
|
|
=back |
|
222
|
|
|
|
|
|
|
|
|
223
|
|
|
|
|
|
|
=head1 ACKNOWLEDGEMENTS |
|
224
|
|
|
|
|
|
|
|
|
225
|
|
|
|
|
|
|
Some code in this module is based on smokeserv-client.pl from the |
|
226
|
|
|
|
|
|
|
Pugs distribution. |
|
227
|
|
|
|
|
|
|
|
|
228
|
|
|
|
|
|
|
=head1 COPYRIGHT & LICENSE |
|
229
|
|
|
|
|
|
|
|
|
230
|
|
|
|
|
|
|
Copyright 2006-2009 Best Practical Solutions. |
|
231
|
|
|
|
|
|
|
Portions copyright 2005-2006 the Pugs project. |
|
232
|
|
|
|
|
|
|
|
|
233
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it |
|
234
|
|
|
|
|
|
|
under the same terms as Perl itself. |
|
235
|
|
|
|
|
|
|
|
|
236
|
|
|
|
|
|
|
=cut |
|
237
|
|
|
|
|
|
|
|
|
238
|
|
|
|
|
|
|
1; |
|
239
|
|
|
|
|
|
|
|