| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Test::Against::Commit; |
|
2
|
2
|
|
|
2
|
|
384891
|
use strict; |
|
|
2
|
|
|
|
|
5
|
|
|
|
2
|
|
|
|
|
80
|
|
|
3
|
2
|
|
|
2
|
|
29
|
use 5.14.0; |
|
|
2
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
|
|
our $VERSION = '0.17'; |
|
5
|
|
|
|
|
|
|
# core modules |
|
6
|
2
|
|
|
2
|
|
1848
|
use Archive::Tar; |
|
|
2
|
|
|
|
|
276523
|
|
|
|
2
|
|
|
|
|
196
|
|
|
7
|
2
|
|
|
2
|
|
22
|
use Carp; |
|
|
2
|
|
|
|
|
5
|
|
|
|
2
|
|
|
|
|
131
|
|
|
8
|
2
|
|
|
2
|
|
17
|
use Cwd; |
|
|
2
|
|
|
|
|
7
|
|
|
|
2
|
|
|
|
|
126
|
|
|
9
|
2
|
|
|
2
|
|
12
|
use File::Path ( qw| make_path | ); |
|
|
2
|
|
|
|
|
5
|
|
|
|
2
|
|
|
|
|
118
|
|
|
10
|
2
|
|
|
2
|
|
13
|
use File::Spec; |
|
|
2
|
|
|
|
|
5
|
|
|
|
2
|
|
|
|
|
58
|
|
|
11
|
2
|
|
|
2
|
|
11
|
use File::Temp ( qw| tempfile | ); |
|
|
2
|
|
|
|
|
8
|
|
|
|
2
|
|
|
|
|
98
|
|
|
12
|
|
|
|
|
|
|
# non-core modules |
|
13
|
2
|
|
|
2
|
|
1785
|
use CPAN::cpanminus::reporter::RetainReports; |
|
|
2
|
|
|
|
|
835488
|
|
|
|
2
|
|
|
|
|
131
|
|
|
14
|
2
|
|
|
2
|
|
20
|
use Data::Dump ( qw| dd pp | ); |
|
|
2
|
|
|
|
|
6
|
|
|
|
2
|
|
|
|
|
148
|
|
|
15
|
2
|
|
|
2
|
|
12
|
use JSON; |
|
|
2
|
|
|
|
|
4
|
|
|
|
2
|
|
|
|
|
13
|
|
|
16
|
2
|
|
|
2
|
|
2610
|
use Path::Tiny; |
|
|
2
|
|
|
|
|
38416
|
|
|
|
2
|
|
|
|
|
234
|
|
|
17
|
2
|
|
|
2
|
|
2822
|
use Text::CSV_XS; |
|
|
2
|
|
|
|
|
41579
|
|
|
|
2
|
|
|
|
|
7090
|
|
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
=head1 NAME |
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
Test::Against::Commit - Test CPAN modules against Perl dev releases, branches or individual commits |
|
22
|
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
my $self = Test::Against::Commit->new( { |
|
26
|
|
|
|
|
|
|
application_dir => '/path/to/application', |
|
27
|
|
|
|
|
|
|
project => 'business_project', |
|
28
|
|
|
|
|
|
|
install => , |
|
29
|
|
|
|
|
|
|
} ); |
|
30
|
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
$self->prepare_testing_directories(); |
|
32
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
my $this_cpanm = $self->fetch_cpanm( { verbose => 1 } ); |
|
34
|
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
my $modules_ref = $self->process_modules( { |
|
36
|
|
|
|
|
|
|
module_file => '/path/to/cpan-river-file.txt', |
|
37
|
|
|
|
|
|
|
title => 'cpan-river-1000', |
|
38
|
|
|
|
|
|
|
verbose => 1, |
|
39
|
|
|
|
|
|
|
} ); |
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
42
|
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
=head2 Who Should Use This Library? |
|
44
|
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
This library should be used by anyone who wishes to assess the impact of |
|
46
|
|
|
|
|
|
|
day-to-day changes in the Perl 5 core distribution on the installability of |
|
47
|
|
|
|
|
|
|
libraries found on the Comprehensive Perl Archive Network (CPAN). This |
|
48
|
|
|
|
|
|
|
library supersedes the existing CPAN library |
|
49
|
|
|
|
|
|
|
L. |
|
50
|
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
=head2 The Problem Addressed by This Library |
|
52
|
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
In the development of Perl as a language we face a problem typically referred |
|
54
|
|
|
|
|
|
|
to as B (or B for short). Perl 5 undergoes an annual |
|
55
|
|
|
|
|
|
|
development cycle characterized by: |
|
56
|
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=over 4 |
|
58
|
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=item * |
|
60
|
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
Commits on a near daily basis to a L
|
|
62
|
|
|
|
|
|
|
repository|https://github.com/Perl/perl5>. |
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=item * |
|
65
|
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
Monthly development releases (tarballs) whose version numbers follow the |
|
67
|
|
|
|
|
|
|
convention of C<5.43.0>, C<5.43.1>, etc., where the middle digits are always |
|
68
|
|
|
|
|
|
|
odd numbers. |
|
69
|
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=item * |
|
71
|
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
Annual production releases and subsequent maintenance releases whose version |
|
73
|
|
|
|
|
|
|
numbers have even-numbered middle digits, I, C<5.44.0>, C<5.44.1>, etc. |
|
74
|
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=back |
|
76
|
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
A monthly development release is essentially a roll-up of a month's worth of |
|
78
|
|
|
|
|
|
|
commits to the master repository branch known as B (pronounced |
|
79
|
|
|
|
|
|
|
I<"bleed">). Changes in the Perl 5 code base have the potential to adversely |
|
80
|
|
|
|
|
|
|
impact the installability of existing CPAN libraries. Hence, various |
|
81
|
|
|
|
|
|
|
individuals have, over the years, developed ways of testing those libraries |
|
82
|
|
|
|
|
|
|
against blead and reporting problems to those people actively involved in the |
|
83
|
|
|
|
|
|
|
ongoing development of the Perl 5 core distribution. The latter are typically |
|
84
|
|
|
|
|
|
|
referred to as "core developers" or as the "Perl 5 Porters." |
|
85
|
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
This library is intended as a contribution to those efforts by enabling the |
|
87
|
|
|
|
|
|
|
Perl 5 Porters to assess the impact of changes in the Perl 5 core distribution |
|
88
|
|
|
|
|
|
|
CPAN libraries well in advance of production and maintenance releases. |
|
89
|
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=head2 The Approach Test-Against-Commit Takes |
|
91
|
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
Unlike other efforts, F does I depend on test reports |
|
93
|
|
|
|
|
|
|
sent to L. Hence, it should be |
|
94
|
|
|
|
|
|
|
unaffected by any technical problems which that site may face. As a |
|
95
|
|
|
|
|
|
|
consequence, however, a user of this library must be willing to maintain more |
|
96
|
|
|
|
|
|
|
of her own local infrastructure than a typical CPANtester would maintain. |
|
97
|
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
While this library could, in principle, be used to test the entirety of CPAN, |
|
99
|
|
|
|
|
|
|
it is probably better suited for testing selected subsets of CPAN libraries |
|
100
|
|
|
|
|
|
|
which the user deems important to her individual or organizational needs. |
|
101
|
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
Unlike its ancestor F, this library is designed to test CPAN |
|
103
|
|
|
|
|
|
|
libraries against either Perl 5 monthly development releases or against |
|
104
|
|
|
|
|
|
|
individual commits to any branch of any GH repository holding the Perl 5 core |
|
105
|
|
|
|
|
|
|
distribution. I
|
|
106
|
|
|
|
|
|
|
build a F executable and how to run the core distribution's test suite. |
|
107
|
|
|
|
|
|
|
This library leaves the configuration, build and installation of a F |
|
108
|
|
|
|
|
|
|
executable to the user.> The scope of this library's activity begins at the |
|
109
|
|
|
|
|
|
|
point that a F has been installed on disk, continues through |
|
110
|
|
|
|
|
|
|
installation of libraries needed for testing CPAN libraries against that |
|
111
|
|
|
|
|
|
|
executable to analysis of the results of that testing and presentation of |
|
112
|
|
|
|
|
|
|
those results in a usable form. |
|
113
|
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
While this library is currently focused on Perl 5 libraries publicly available |
|
115
|
|
|
|
|
|
|
on CPAN, it could in principle be extended to test an organization's private |
|
116
|
|
|
|
|
|
|
libraries as well. This functionality, however, has not yet been implemented |
|
117
|
|
|
|
|
|
|
or tested. |
|
118
|
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
=head2 Terminology |
|
120
|
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
Here are some terms which we use in a specific way in this library: |
|
122
|
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
=over 4 |
|
124
|
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
=item * B |
|
126
|
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
A directory to which the user has write-privileges and which holds the input |
|
128
|
|
|
|
|
|
|
and output for one or more I. I C. |
|
129
|
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
=item * B |
|
131
|
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
A short-hand description of the focus of a particular investigation using |
|
133
|
|
|
|
|
|
|
Test-Against-Commit. I C could describe an investigation of |
|
134
|
|
|
|
|
|
|
the impact of fatalization of certain uses of the Perl C function on |
|
135
|
|
|
|
|
|
|
CPAN libraries. |
|
136
|
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
=item * B |
|
138
|
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
A subdirectory of the I which holds the input and |
|
140
|
|
|
|
|
|
|
output data for one I. I C. |
|
141
|
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
=item * B |
|
143
|
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
An installation of one F executable, the libraries that get installed |
|
145
|
|
|
|
|
|
|
with the core distribution, CPAN libraries whose installability we tested |
|
146
|
|
|
|
|
|
|
against that F and data gathered to analyze that installability and |
|
147
|
|
|
|
|
|
|
answer questions for the business purpose of the I. |
|
148
|
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
An installation will be built either from a particular checkout, tag or branch |
|
150
|
|
|
|
|
|
|
from a F repository of the Perl 5 source code (C<23ae7f95ea>, C, |
|
151
|
|
|
|
|
|
|
C) or from a Perl 5 development, production or maintenance release in |
|
152
|
|
|
|
|
|
|
tarball form (C). |
|
153
|
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
A I will consist of at least one installation but will probably hold |
|
155
|
|
|
|
|
|
|
two or three installations: the first will be used to determine a baseline |
|
156
|
|
|
|
|
|
|
state, the second will be used to assess the impact of a proposed change in |
|
157
|
|
|
|
|
|
|
the Perl 5 core distribution on installability of CPAN libraries. |
|
158
|
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
=item * B |
|
160
|
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
A subdirectory of the I holding one installation. I |
|
162
|
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
/path-to-application/ # <-- application directory |
|
164
|
|
|
|
|
|
|
/path-to-application/goto-fatal/ # <-- project directory |
|
165
|
|
|
|
|
|
|
/path-to-application/goto-fatal/23ae7f95ea/ # <-- installation directory |
|
166
|
|
|
|
|
|
|
/path-to-application/goto-fatal/v5.43.3/ # <-- another installation directory |
|
167
|
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
Each installation directory will have exactly two subdirectories: C |
|
169
|
|
|
|
|
|
|
and C. (See next two items.) |
|
170
|
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
=item * B |
|
172
|
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
A subdirectory of an I which in turn initially holds |
|
174
|
|
|
|
|
|
|
two subdirectories, C and C. |
|
175
|
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
The C directory holds the F, F, F and other |
|
177
|
|
|
|
|
|
|
executable when a particular F is built for the project. The C |
|
178
|
|
|
|
|
|
|
directory holds all modules installed either initially with the executable or |
|
179
|
|
|
|
|
|
|
subsequently, including those whose functionality we are assessing as part of |
|
180
|
|
|
|
|
|
|
the project's business purpose. Test-Against-Commit methods will create other |
|
181
|
|
|
|
|
|
|
subdirectories next to C and C, some of which are hidden, as part |
|
182
|
|
|
|
|
|
|
of the testing progress. |
|
183
|
|
|
|
|
|
|
|
|
184
|
|
|
|
|
|
|
/path-to-application/goto-fatal/23ae7f95ea/ # <-- installation directory |
|
185
|
|
|
|
|
|
|
/path-to-application/goto-fatal/23ae7f95ea/testing/ # <-- testing directory |
|
186
|
|
|
|
|
|
|
/path-to-application/goto-fatal/23ae7f95ea/testing/bin/ # <-- bin directory |
|
187
|
|
|
|
|
|
|
/path-to-application/goto-fatal/23ae7f95ea/testing/lib/ # <-- lib directory |
|
188
|
|
|
|
|
|
|
|
|
189
|
|
|
|
|
|
|
The data in the I can be thought of as the project's |
|
190
|
|
|
|
|
|
|
I data. |
|
191
|
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
=item * B |
|
193
|
|
|
|
|
|
|
|
|
194
|
|
|
|
|
|
|
A subdirectory of an I which holds the data created by |
|
195
|
|
|
|
|
|
|
running a program using Test::Against::Commit methods. This directory will in turn |
|
196
|
|
|
|
|
|
|
hold two subdirectories: C and C. |
|
197
|
|
|
|
|
|
|
|
|
198
|
|
|
|
|
|
|
/path-to-application/goto-fatal/23ae7f95ea/ # <-- installation directory |
|
199
|
|
|
|
|
|
|
/path-to-application/goto-fatal/23ae7f95ea/testing/ # <-- testing directory |
|
200
|
|
|
|
|
|
|
... |
|
201
|
|
|
|
|
|
|
/path-to-application/goto-fatal/23ae7f95ea/results/ # <-- results directory |
|
202
|
|
|
|
|
|
|
/path-to-application/goto-fatal/23ae7f95ea/results/analysis/ |
|
203
|
|
|
|
|
|
|
/path-to-application/goto-fatal/23ae7f95ea/results/storage/ |
|
204
|
|
|
|
|
|
|
|
|
205
|
|
|
|
|
|
|
The data in the I can be thought of as the project's |
|
206
|
|
|
|
|
|
|
I |
|
207
|
|
|
|
|
|
|
|
|
208
|
|
|
|
|
|
|
=item * B |
|
209
|
|
|
|
|
|
|
|
|
210
|
|
|
|
|
|
|
A I is an instance of (i) testing a set of one or more CPAN libraries |
|
211
|
|
|
|
|
|
|
against a given I and (ii) the recording of data from that |
|
212
|
|
|
|
|
|
|
instance of testing. |
|
213
|
|
|
|
|
|
|
|
|
214
|
|
|
|
|
|
|
=item * B |
|
215
|
|
|
|
|
|
|
|
|
216
|
|
|
|
|
|
|
The way one calls F when building Perl 5 from source, : |
|
217
|
|
|
|
|
|
|
|
|
218
|
|
|
|
|
|
|
sh ./Configure -des -Dusedevel |
|
219
|
|
|
|
|
|
|
|
|
220
|
|
|
|
|
|
|
or: |
|
221
|
|
|
|
|
|
|
|
|
222
|
|
|
|
|
|
|
sh ./Configure -des -Dusedevel \ |
|
223
|
|
|
|
|
|
|
-Duseithreads \ |
|
224
|
|
|
|
|
|
|
-Doptimize="-O2 -pipe -fstack-protector -fno-strict-aliasing" |
|
225
|
|
|
|
|
|
|
|
|
226
|
|
|
|
|
|
|
Once you begin to use Test-Against-Commit for a particular I, you |
|
227
|
|
|
|
|
|
|
should use the same configuration for each I over the life of |
|
228
|
|
|
|
|
|
|
that project. For instance, you should not configure without threads in one |
|
229
|
|
|
|
|
|
|
run but with threads in the next. Nor should you switch from regular to |
|
230
|
|
|
|
|
|
|
debugging builds between I. Otherwise, the results may reflect changes |
|
231
|
|
|
|
|
|
|
in that configuration rather than changes in Perl 5 core distribution code or |
|
232
|
|
|
|
|
|
|
changes in the targeted CPAN libraries. |
|
233
|
|
|
|
|
|
|
|
|
234
|
|
|
|
|
|
|
=back |
|
235
|
|
|
|
|
|
|
|
|
236
|
|
|
|
|
|
|
=head2 What Is the Result Produced by This Library? |
|
237
|
|
|
|
|
|
|
|
|
238
|
|
|
|
|
|
|
Our objective is to be able to compare output data recorded in one I for |
|
239
|
|
|
|
|
|
|
a given I with data recorded in a different I for a different |
|
240
|
|
|
|
|
|
|
(presumably subsequent) installation within the same I. To return to |
|
241
|
|
|
|
|
|
|
the example of the I project, let's assume we have two different |
|
242
|
|
|
|
|
|
|
installations, the first of which sets our baseline (which CPAN libraries |
|
243
|
|
|
|
|
|
|
currently C and which currently C) and a second which determines |
|
244
|
|
|
|
|
|
|
the impact of applying a pull request. |
|
245
|
|
|
|
|
|
|
|
|
246
|
|
|
|
|
|
|
/path-to-application/goto-fatal/ # <-- project directory |
|
247
|
|
|
|
|
|
|
/path-to-application/goto-fatal/23ae7f95ea/ # <-- first installation directory |
|
248
|
|
|
|
|
|
|
/path-to-application/goto-fatal/v5.43.3/ # <-- second installation directory |
|
249
|
|
|
|
|
|
|
|
|
250
|
|
|
|
|
|
|
We will end up comparing data stored in these installations' respective |
|
251
|
|
|
|
|
|
|
C subdirectories. |
|
252
|
|
|
|
|
|
|
|
|
253
|
|
|
|
|
|
|
/path-to-application/goto-fatal/23ae7f95ea/results/analysis/ |
|
254
|
|
|
|
|
|
|
/path-to-application/goto-fatal/v5.43.3/results/analysis/ |
|
255
|
|
|
|
|
|
|
|
|
256
|
|
|
|
|
|
|
=head2 What Preparations Are Needed to Use This Library? |
|
257
|
|
|
|
|
|
|
|
|
258
|
|
|
|
|
|
|
=over 4 |
|
259
|
|
|
|
|
|
|
|
|
260
|
|
|
|
|
|
|
=item * Platform |
|
261
|
|
|
|
|
|
|
|
|
262
|
|
|
|
|
|
|
The user should select a machine/platform which is likely to be reasonably |
|
263
|
|
|
|
|
|
|
stable over one Perl 5 annual development cycle. We presume that the |
|
264
|
|
|
|
|
|
|
platform's system administrator will be updating system libraries for security |
|
265
|
|
|
|
|
|
|
and other reasons over time. But it would be a hassle to run this software on |
|
266
|
|
|
|
|
|
|
a machine scheduled for a complete major version update of its operating |
|
267
|
|
|
|
|
|
|
system. |
|
268
|
|
|
|
|
|
|
|
|
269
|
|
|
|
|
|
|
=item * Perl 5 Configuration |
|
270
|
|
|
|
|
|
|
|
|
271
|
|
|
|
|
|
|
The user must decide on a Perl 5 configuration for a given I and then |
|
272
|
|
|
|
|
|
|
must refrain from changing configurations over the course of the project's |
|
273
|
|
|
|
|
|
|
existence. See item under L above. |
|
274
|
|
|
|
|
|
|
|
|
275
|
|
|
|
|
|
|
=item * F Executable Installation Location |
|
276
|
|
|
|
|
|
|
|
|
277
|
|
|
|
|
|
|
As noted above, this library leaves to the user the choice of a I
|
|
278
|
|
|
|
|
|
|
the Perl source code> and the decision of I an individual |
|
279
|
|
|
|
|
|
|
F executable. It also leaves to the user, with one caveat, the decision |
|
280
|
|
|
|
|
|
|
of I to install that executable on disk. That caveat is that the |
|
281
|
|
|
|
|
|
|
I should reside in a directory named F which in turn |
|
282
|
|
|
|
|
|
|
sits underneath a directory which we'll refer to as the I
|
|
283
|
|
|
|
|
|
|
directory>. The user will have to manually create the I
|
|
284
|
|
|
|
|
|
|
directory>, the I, the I and the |
|
285
|
|
|
|
|
|
|
I and then use the I as the value for |
|
286
|
|
|
|
|
|
|
the I<-Dprefix> option in the invocation of F. |
|
287
|
|
|
|
|
|
|
|
|
288
|
|
|
|
|
|
|
In terms of the directory structure discussed above, that the user would |
|
289
|
|
|
|
|
|
|
create a directory structure something like this: |
|
290
|
|
|
|
|
|
|
|
|
291
|
|
|
|
|
|
|
$ cd ~/tmp |
|
292
|
|
|
|
|
|
|
$ export TESTINGDIR=`pwd`/all-tad-projects/goto-fatal/23ae7f95ea/testing |
|
293
|
|
|
|
|
|
|
$ echo $TESTINGDIR |
|
294
|
|
|
|
|
|
|
.../tmp/all-tad-projects/goto-fatal/23ae7f95ea/testing |
|
295
|
|
|
|
|
|
|
$ mkdir -p $TESTINGDIR |
|
296
|
|
|
|
|
|
|
$ ls -l $TESTINGDIR |
|
297
|
|
|
|
|
|
|
total 0 |
|
298
|
|
|
|
|
|
|
|
|
299
|
|
|
|
|
|
|
$ cd |
|
300
|
|
|
|
|
|
|
|
|
301
|
|
|
|
|
|
|
The user would then invoke F in a way something like this: |
|
302
|
|
|
|
|
|
|
|
|
303
|
|
|
|
|
|
|
$ sh ./Configure -des -Dusedevel -Dprefix=$TESTINGDIR \ |
|
304
|
|
|
|
|
|
|
-Uversiononly -Dman1dir=none -Dman3dir=none |
|
305
|
|
|
|
|
|
|
$ make install |
|
306
|
|
|
|
|
|
|
|
|
307
|
|
|
|
|
|
|
The user could then confirm installation with this: |
|
308
|
|
|
|
|
|
|
|
|
309
|
|
|
|
|
|
|
$ $TESTINGDIR/bin/perl -v | head -2 | tail -1 |
|
310
|
|
|
|
|
|
|
This is perl 5, version 43, subversion 3 (v5.43.3 (v5.43.2-343-g5fdb3e501b)) built for x86_64-linux |
|
311
|
|
|
|
|
|
|
|
|
312
|
|
|
|
|
|
|
Note that at this point we have not yet created the I ... |
|
313
|
|
|
|
|
|
|
|
|
314
|
|
|
|
|
|
|
$ cd ~/tmp |
|
315
|
|
|
|
|
|
|
$ ls -l ./all-tad-projects/goto-fatal/23ae7f95ea/results |
|
316
|
|
|
|
|
|
|
... No such file or directory |
|
317
|
|
|
|
|
|
|
|
|
318
|
|
|
|
|
|
|
... but no worries; Test-Against-Commit methods will handle that. |
|
319
|
|
|
|
|
|
|
|
|
320
|
|
|
|
|
|
|
=item * Selection of CPAN Libraries for Testing |
|
321
|
|
|
|
|
|
|
|
|
322
|
|
|
|
|
|
|
B |
|
323
|
|
|
|
|
|
|
|
|
324
|
|
|
|
|
|
|
When you use this library, you are in effect saying: I
|
|
325
|
|
|
|
|
|
|
modules important enough to me that I don't want to see them begin to break in |
|
326
|
|
|
|
|
|
|
the course of Perl's annual development cycle. (If they do break, then the |
|
327
|
|
|
|
|
|
|
Perl 5 Porters and the modules' authors/maintainers must address how to handle |
|
328
|
|
|
|
|
|
|
the breakage.) To keep track of the problem, I'm going to build F from |
|
329
|
|
|
|
|
|
|
a starting point where those modules are working proprerly and assess their |
|
330
|
|
|
|
|
|
|
installability at later points.> |
|
331
|
|
|
|
|
|
|
|
|
332
|
|
|
|
|
|
|
Hence, once you decide to track a certain CPAN library, you should continue to |
|
333
|
|
|
|
|
|
|
include it in your list of modules to be tracked for the balance of that year's |
|
334
|
|
|
|
|
|
|
development cycle. You can, it is true, B additional modules to your |
|
335
|
|
|
|
|
|
|
list part way through the development cycle. You simply won't have the same |
|
336
|
|
|
|
|
|
|
baseline data that you have for the modules you selected at the very |
|
337
|
|
|
|
|
|
|
beginning. |
|
338
|
|
|
|
|
|
|
|
|
339
|
|
|
|
|
|
|
Here are some approaches that come to mind: |
|
340
|
|
|
|
|
|
|
|
|
341
|
|
|
|
|
|
|
=over 4 |
|
342
|
|
|
|
|
|
|
|
|
343
|
|
|
|
|
|
|
=item * CPAN river |
|
344
|
|
|
|
|
|
|
|
|
345
|
|
|
|
|
|
|
The CPAN river is a concept developed by Neil Bowers and other participants in |
|
346
|
|
|
|
|
|
|
the Perl Toolchain Gang and Perl QA Hackathons and Summits. The concept |
|
347
|
|
|
|
|
|
|
starts from the premise that CPAN libraries upon which many other CPAN |
|
348
|
|
|
|
|
|
|
libraries depend are more important than those upon which few other libraries |
|
349
|
|
|
|
|
|
|
depend. That's a useful definition of importance even if it is far from strictly |
|
350
|
|
|
|
|
|
|
true. Modules "way upstream" feed modules and real-world code "farther |
|
351
|
|
|
|
|
|
|
downstream." Hence, if Perl 5's development branch changes in a way such that |
|
352
|
|
|
|
|
|
|
"upstream" modules start to fail to configure, build, test and install |
|
353
|
|
|
|
|
|
|
correctly, then we have a potentially serious problem. |
|
354
|
|
|
|
|
|
|
|
|
355
|
|
|
|
|
|
|
=item * Organizational dependencies |
|
356
|
|
|
|
|
|
|
|
|
357
|
|
|
|
|
|
|
Many organizations use technologies such as F and F to keep |
|
358
|
|
|
|
|
|
|
track of their dependencies on CPAN libraries. The lists compiled by such |
|
359
|
|
|
|
|
|
|
applications could very easily be translated into a list of modules tested |
|
360
|
|
|
|
|
|
|
once a month against a Perl development release. |
|
361
|
|
|
|
|
|
|
|
|
362
|
|
|
|
|
|
|
=item * What repeatedly breaks |
|
363
|
|
|
|
|
|
|
|
|
364
|
|
|
|
|
|
|
Certain CPAN libraries get broken relatively frequently. While this can |
|
365
|
|
|
|
|
|
|
happen because of sub-standard coding practices in those libraries, it more |
|
366
|
|
|
|
|
|
|
often happens because these libraries, in order to do what they want to do, |
|
367
|
|
|
|
|
|
|
reach down deep into the Perl 5 guts and use features of the Perl-to-C API. |
|
368
|
|
|
|
|
|
|
|
|
369
|
|
|
|
|
|
|
=back |
|
370
|
|
|
|
|
|
|
|
|
371
|
|
|
|
|
|
|
=back |
|
372
|
|
|
|
|
|
|
|
|
373
|
|
|
|
|
|
|
=head1 METHODS |
|
374
|
|
|
|
|
|
|
|
|
375
|
|
|
|
|
|
|
=head2 C |
|
376
|
|
|
|
|
|
|
|
|
377
|
|
|
|
|
|
|
=over 4 |
|
378
|
|
|
|
|
|
|
|
|
379
|
|
|
|
|
|
|
=item * Purpose |
|
380
|
|
|
|
|
|
|
|
|
381
|
|
|
|
|
|
|
Test::Against::Commit constructor. Guarantees that the top-level directory for |
|
382
|
|
|
|
|
|
|
the application (C) already exists, then creates two |
|
383
|
|
|
|
|
|
|
directories thereunder: F and F. |
|
384
|
|
|
|
|
|
|
|
|
385
|
|
|
|
|
|
|
=item * Arguments |
|
386
|
|
|
|
|
|
|
|
|
387
|
|
|
|
|
|
|
my $self = Test::Against::Commit->new( { |
|
388
|
|
|
|
|
|
|
application_dir => '/path/to/application', |
|
389
|
|
|
|
|
|
|
project => 'goto-fatal' |
|
390
|
|
|
|
|
|
|
install => '23ae7f95ea', |
|
391
|
|
|
|
|
|
|
} ); |
|
392
|
|
|
|
|
|
|
|
|
393
|
|
|
|
|
|
|
Takes a hash reference with the following elements: |
|
394
|
|
|
|
|
|
|
|
|
395
|
|
|
|
|
|
|
=over 4 |
|
396
|
|
|
|
|
|
|
|
|
397
|
|
|
|
|
|
|
=item * C |
|
398
|
|
|
|
|
|
|
|
|
399
|
|
|
|
|
|
|
String holding path to the directory which will serve as the top level for all |
|
400
|
|
|
|
|
|
|
projects using Test-Against-Commit technology. |
|
401
|
|
|
|
|
|
|
|
|
402
|
|
|
|
|
|
|
=item * C |
|
403
|
|
|
|
|
|
|
|
|
404
|
|
|
|
|
|
|
String holding a short name for your current business project. |
|
405
|
|
|
|
|
|
|
|
|
406
|
|
|
|
|
|
|
=item * C |
|
407
|
|
|
|
|
|
|
|
|
408
|
|
|
|
|
|
|
String holding a name for the specific I of F against which you |
|
409
|
|
|
|
|
|
|
will be attempting to install CPAN modules. If you have built F from |
|
410
|
|
|
|
|
|
|
a F checkout, this should be the F commit ID (SHA), F tag or |
|
411
|
|
|
|
|
|
|
F branch name from which you are starting. If you are building F |
|
412
|
|
|
|
|
|
|
from a release tarball, consider using a string such as C from |
|
413
|
|
|
|
|
|
|
the tarball's basename. |
|
414
|
|
|
|
|
|
|
|
|
415
|
|
|
|
|
|
|
=back |
|
416
|
|
|
|
|
|
|
|
|
417
|
|
|
|
|
|
|
=item * Return Value |
|
418
|
|
|
|
|
|
|
|
|
419
|
|
|
|
|
|
|
Test::Against::Commit object. |
|
420
|
|
|
|
|
|
|
|
|
421
|
|
|
|
|
|
|
=item * Comment |
|
422
|
|
|
|
|
|
|
|
|
423
|
|
|
|
|
|
|
The constructor merely verifies the existence of certain directories on your |
|
424
|
|
|
|
|
|
|
machine. It does not install a F executable. That is the user's |
|
425
|
|
|
|
|
|
|
responsibility. The user will subsequently have to call the |
|
426
|
|
|
|
|
|
|
C and perhaps C to be fully ready |
|
427
|
|
|
|
|
|
|
to test. |
|
428
|
|
|
|
|
|
|
|
|
429
|
|
|
|
|
|
|
=back |
|
430
|
|
|
|
|
|
|
|
|
431
|
|
|
|
|
|
|
=cut |
|
432
|
|
|
|
|
|
|
|
|
433
|
|
|
|
|
|
|
sub new { |
|
434
|
8
|
|
|
8
|
1
|
590209
|
my ($class, $args) = @_; |
|
435
|
|
|
|
|
|
|
|
|
436
|
8
|
100
|
|
|
|
622
|
croak "Argument to constructor must be hashref" |
|
437
|
|
|
|
|
|
|
unless ref($args) eq 'HASH'; |
|
438
|
|
|
|
|
|
|
croak "Hash ref must contain 'application_dir' element" |
|
439
|
6
|
100
|
|
|
|
241
|
unless $args->{application_dir}; |
|
440
|
|
|
|
|
|
|
croak "Hash ref must contain 'install' element" |
|
441
|
5
|
100
|
|
|
|
239
|
unless $args->{install}; |
|
442
|
|
|
|
|
|
|
croak "Could not locate application directory $args->{application_dir}" |
|
443
|
4
|
100
|
|
|
|
361
|
unless (-d $args->{application_dir}); |
|
444
|
|
|
|
|
|
|
croak "Must supply name for project" |
|
445
|
3
|
100
|
|
|
|
181
|
unless length($args->{project}); |
|
446
|
|
|
|
|
|
|
|
|
447
|
2
|
|
|
|
|
9
|
my %verified = (); |
|
448
|
2
|
|
|
|
|
48
|
my $project_dir = File::Spec->catdir($args->{application_dir}, $args->{project}); |
|
449
|
2
|
100
|
|
|
|
86
|
unless (-d $project_dir) { make_path($project_dir, { mode => 0755 }); } |
|
|
1
|
|
|
|
|
237
|
|
|
450
|
2
|
|
|
|
|
48
|
$verified{project_dir} = $project_dir; |
|
451
|
2
|
|
|
|
|
32
|
my $install_dir = File::Spec->catdir($project_dir, $args->{install}); |
|
452
|
2
|
100
|
|
|
|
70
|
unless (-d $install_dir) { make_path($install_dir, { mode => 0755 }); } |
|
|
1
|
|
|
|
|
202
|
|
|
453
|
2
|
|
|
|
|
20
|
$verified{install_dir} = $install_dir; |
|
454
|
|
|
|
|
|
|
|
|
455
|
2
|
|
|
|
|
19
|
for my $dir (qw| testing results |) { |
|
456
|
4
|
|
|
|
|
47
|
my $fdir = File::Spec->catdir($install_dir, $dir); |
|
457
|
4
|
100
|
|
|
|
109
|
unless (-d $fdir) { make_path($fdir, { mode => 0755 }); } |
|
|
2
|
|
|
|
|
462
|
|
|
458
|
4
|
|
|
|
|
24
|
my $k = $dir . '_dir'; |
|
459
|
4
|
|
|
|
|
34
|
$verified{$k} = $fdir; |
|
460
|
|
|
|
|
|
|
} |
|
461
|
|
|
|
|
|
|
|
|
462
|
2
|
|
|
|
|
6
|
my $data; |
|
463
|
2
|
|
|
|
|
8
|
for my $k (keys %{$args}) { |
|
|
2
|
|
|
|
|
14
|
|
|
464
|
6
|
|
|
|
|
22
|
$data->{$k} = $args->{$k}; |
|
465
|
|
|
|
|
|
|
} |
|
466
|
2
|
|
|
|
|
15
|
for my $k (keys %verified) { |
|
467
|
8
|
|
|
|
|
23
|
$data->{$k} = $verified{$k}; |
|
468
|
|
|
|
|
|
|
} |
|
469
|
|
|
|
|
|
|
|
|
470
|
2
|
|
|
|
|
20
|
return bless $data, $class; |
|
471
|
|
|
|
|
|
|
} |
|
472
|
|
|
|
|
|
|
|
|
473
|
|
|
|
|
|
|
=head2 C |
|
474
|
|
|
|
|
|
|
|
|
475
|
|
|
|
|
|
|
=over 4 |
|
476
|
|
|
|
|
|
|
|
|
477
|
|
|
|
|
|
|
=item * Purpose |
|
478
|
|
|
|
|
|
|
|
|
479
|
|
|
|
|
|
|
Methods which simply return the path to relevant directories (along with |
|
480
|
|
|
|
|
|
|
I of their name): |
|
481
|
|
|
|
|
|
|
|
|
482
|
|
|
|
|
|
|
=over 4 |
|
483
|
|
|
|
|
|
|
|
|
484
|
|
|
|
|
|
|
=item * application directory (I) |
|
485
|
|
|
|
|
|
|
|
|
486
|
|
|
|
|
|
|
The top-level directory for all code and data implemented by |
|
487
|
|
|
|
|
|
|
Test-Against-Commit. It will typically hold 1 subdirectory for each business |
|
488
|
|
|
|
|
|
|
project using Test-Against-Commit technology. |
|
489
|
|
|
|
|
|
|
|
|
490
|
|
|
|
|
|
|
=item * project directory (I) |
|
491
|
|
|
|
|
|
|
|
|
492
|
|
|
|
|
|
|
TK |
|
493
|
|
|
|
|
|
|
|
|
494
|
|
|
|
|
|
|
=item * install directory (I) |
|
495
|
|
|
|
|
|
|
|
|
496
|
|
|
|
|
|
|
TK |
|
497
|
|
|
|
|
|
|
|
|
498
|
|
|
|
|
|
|
=item * testing directory (I) |
|
499
|
|
|
|
|
|
|
|
|
500
|
|
|
|
|
|
|
A directory which holds one or more subdirectories, each of which contains an |
|
501
|
|
|
|
|
|
|
installation of a perl executable. That installation will start off with |
|
502
|
|
|
|
|
|
|
C and C subdirectories and C<./bin/perl -Ilib -v> will be called |
|
503
|
|
|
|
|
|
|
to demonstrate the presence of a viable F. |
|
504
|
|
|
|
|
|
|
|
|
505
|
|
|
|
|
|
|
=item * results directory (I) |
|
506
|
|
|
|
|
|
|
|
|
507
|
|
|
|
|
|
|
The directory under which all data created by runs of programs using |
|
508
|
|
|
|
|
|
|
Test::Against::Commit will be placed. This will include data in JSON and |
|
509
|
|
|
|
|
|
|
pipe-separated-value (PSV) formats. |
|
510
|
|
|
|
|
|
|
|
|
511
|
|
|
|
|
|
|
=back |
|
512
|
|
|
|
|
|
|
|
|
513
|
|
|
|
|
|
|
=item * Arguments |
|
514
|
|
|
|
|
|
|
|
|
515
|
|
|
|
|
|
|
$application_dir = $self->get_application_dir(); |
|
516
|
|
|
|
|
|
|
|
|
517
|
|
|
|
|
|
|
$project_dir = $self->get_project_dir(); |
|
518
|
|
|
|
|
|
|
|
|
519
|
|
|
|
|
|
|
$install_dir = $self->get_install_dir(); |
|
520
|
|
|
|
|
|
|
|
|
521
|
|
|
|
|
|
|
$testing_dir = $self->get_testing_dir(); |
|
522
|
|
|
|
|
|
|
|
|
523
|
|
|
|
|
|
|
$results_dir = $self->get_results_dir(); |
|
524
|
|
|
|
|
|
|
|
|
525
|
|
|
|
|
|
|
=item * Return Value |
|
526
|
|
|
|
|
|
|
|
|
527
|
|
|
|
|
|
|
String holding a path to the named directory. |
|
528
|
|
|
|
|
|
|
|
|
529
|
|
|
|
|
|
|
=item * Comment |
|
530
|
|
|
|
|
|
|
|
|
531
|
|
|
|
|
|
|
These methods become available once a F executable has been installed |
|
532
|
|
|
|
|
|
|
and C has been run. |
|
533
|
|
|
|
|
|
|
|
|
534
|
|
|
|
|
|
|
=back |
|
535
|
|
|
|
|
|
|
|
|
536
|
|
|
|
|
|
|
=cut |
|
537
|
|
|
|
|
|
|
|
|
538
|
|
|
|
|
|
|
sub get_application_dir { |
|
539
|
2
|
|
|
2
|
1
|
2229
|
my $self = shift; |
|
540
|
2
|
|
|
|
|
13
|
return $self->{application_dir}; |
|
541
|
|
|
|
|
|
|
} |
|
542
|
|
|
|
|
|
|
|
|
543
|
|
|
|
|
|
|
sub get_project_dir { |
|
544
|
2
|
|
|
2
|
1
|
2300
|
my $self = shift; |
|
545
|
2
|
|
|
|
|
17
|
return $self->{project_dir}; |
|
546
|
|
|
|
|
|
|
} |
|
547
|
|
|
|
|
|
|
|
|
548
|
|
|
|
|
|
|
sub get_install_dir { |
|
549
|
2
|
|
|
2
|
1
|
928
|
my $self = shift; |
|
550
|
2
|
|
|
|
|
13
|
return $self->{install_dir}; |
|
551
|
|
|
|
|
|
|
} |
|
552
|
|
|
|
|
|
|
|
|
553
|
|
|
|
|
|
|
sub get_testing_dir { |
|
554
|
2
|
|
|
2
|
1
|
983
|
my $self = shift; |
|
555
|
2
|
|
|
|
|
11
|
return $self->{testing_dir}; |
|
556
|
|
|
|
|
|
|
} |
|
557
|
|
|
|
|
|
|
|
|
558
|
|
|
|
|
|
|
sub get_results_dir { |
|
559
|
2
|
|
|
2
|
1
|
914
|
my $self = shift; |
|
560
|
2
|
|
|
|
|
10
|
return $self->{results_dir}; |
|
561
|
|
|
|
|
|
|
} |
|
562
|
|
|
|
|
|
|
|
|
563
|
|
|
|
|
|
|
=head2 C |
|
564
|
|
|
|
|
|
|
|
|
565
|
|
|
|
|
|
|
=over 4 |
|
566
|
|
|
|
|
|
|
|
|
567
|
|
|
|
|
|
|
=item * Purpose |
|
568
|
|
|
|
|
|
|
|
|
569
|
|
|
|
|
|
|
Each F installed underneath C needs a unique name. If we |
|
570
|
|
|
|
|
|
|
build this F from a F checkout, this should be one of the commit ID |
|
571
|
|
|
|
|
|
|
(SHA), tag or branch name of the checkout. |
|
572
|
|
|
|
|
|
|
|
|
573
|
|
|
|
|
|
|
=item * Arguments |
|
574
|
|
|
|
|
|
|
|
|
575
|
|
|
|
|
|
|
my $install = $self->get_install(); |
|
576
|
|
|
|
|
|
|
|
|
577
|
|
|
|
|
|
|
=item * Return Value |
|
578
|
|
|
|
|
|
|
|
|
579
|
|
|
|
|
|
|
String holding a F commit ID, tag or branch name. |
|
580
|
|
|
|
|
|
|
|
|
581
|
|
|
|
|
|
|
=item * Comment |
|
582
|
|
|
|
|
|
|
|
|
583
|
|
|
|
|
|
|
Since C is one of the key-value pairs we are handing to C, this |
|
584
|
|
|
|
|
|
|
method essentially just gives us back what we already told it. However, we |
|
585
|
|
|
|
|
|
|
will use it internally later to derive the path to the installed F |
|
586
|
|
|
|
|
|
|
against which we are trying to install modules. |
|
587
|
|
|
|
|
|
|
|
|
588
|
|
|
|
|
|
|
TK: What about when we're building from a tarball? |
|
589
|
|
|
|
|
|
|
|
|
590
|
|
|
|
|
|
|
=back |
|
591
|
|
|
|
|
|
|
|
|
592
|
|
|
|
|
|
|
=cut |
|
593
|
|
|
|
|
|
|
|
|
594
|
|
|
|
|
|
|
sub get_install { |
|
595
|
2
|
|
|
2
|
1
|
889
|
my $self = shift; |
|
596
|
2
|
|
|
|
|
29
|
return $self->{install}; |
|
597
|
|
|
|
|
|
|
} |
|
598
|
|
|
|
|
|
|
|
|
599
|
|
|
|
|
|
|
=head2 C |
|
600
|
|
|
|
|
|
|
|
|
601
|
|
|
|
|
|
|
=over 4 |
|
602
|
|
|
|
|
|
|
|
|
603
|
|
|
|
|
|
|
=item * Purpose |
|
604
|
|
|
|
|
|
|
|
|
605
|
|
|
|
|
|
|
Determines whether the F executable has been installed -- I
|
|
606
|
|
|
|
|
|
|
the user's responsibility to install it> -- and whether this application has |
|
607
|
|
|
|
|
|
|
the correct directory structure. |
|
608
|
|
|
|
|
|
|
|
|
609
|
|
|
|
|
|
|
=item * Arguments |
|
610
|
|
|
|
|
|
|
|
|
611
|
|
|
|
|
|
|
$self->prepare_testing_directory() |
|
612
|
|
|
|
|
|
|
|
|
613
|
|
|
|
|
|
|
=item * Return Value |
|
614
|
|
|
|
|
|
|
|
|
615
|
|
|
|
|
|
|
Returns the Test::Against::Commit object, which now holds additional data. |
|
616
|
|
|
|
|
|
|
|
|
617
|
|
|
|
|
|
|
=item * Comment |
|
618
|
|
|
|
|
|
|
|
|
619
|
|
|
|
|
|
|
TK |
|
620
|
|
|
|
|
|
|
|
|
621
|
|
|
|
|
|
|
=back |
|
622
|
|
|
|
|
|
|
|
|
623
|
|
|
|
|
|
|
=cut |
|
624
|
|
|
|
|
|
|
|
|
625
|
|
|
|
|
|
|
sub prepare_testing_directory { |
|
626
|
1
|
|
|
1
|
1
|
9
|
my $self = shift; |
|
627
|
|
|
|
|
|
|
|
|
628
|
1
|
|
|
|
|
4
|
for my $dir (qw| bin lib|) { |
|
629
|
1
|
|
|
|
|
17
|
my $subdir = File::Spec->catdir($self->{testing_dir}, $dir); |
|
630
|
1
|
50
|
|
|
|
75
|
if (-d $subdir) { |
|
631
|
0
|
|
|
|
|
0
|
my $this = $dir . '_dir'; |
|
632
|
0
|
|
|
|
|
0
|
$self->{$this} = $subdir; |
|
633
|
|
|
|
|
|
|
} |
|
634
|
|
|
|
|
|
|
else { |
|
635
|
1
|
|
|
|
|
324
|
croak "Could not locate $subdir; have you built and installed a perl executable?"; |
|
636
|
|
|
|
|
|
|
} |
|
637
|
|
|
|
|
|
|
} |
|
638
|
0
|
|
|
|
|
0
|
my $lib_dir = $self->get_lib_dir(); |
|
639
|
0
|
|
|
|
|
0
|
my $this_perl = File::Spec->catfile($self->get_bin_dir, 'perl'); |
|
640
|
0
|
|
|
|
|
0
|
my $invoke = "$this_perl -I$lib_dir"; |
|
641
|
0
|
0
|
|
|
|
0
|
my $rv = system(qq{$invoke -v | head -n 2 | tail -n 1}) |
|
642
|
|
|
|
|
|
|
and croak "Could not run perl executable at $this_perl"; |
|
643
|
0
|
|
|
|
|
0
|
$self->{this_perl} = $this_perl; |
|
644
|
|
|
|
|
|
|
|
|
645
|
0
|
|
|
|
|
0
|
my $this_cpan = File::Spec->catfile($self->get_bin_dir, 'cpan'); |
|
646
|
0
|
|
|
|
|
0
|
$invoke = "$this_cpan -v"; |
|
647
|
0
|
0
|
|
|
|
0
|
$rv = system(qq{$invoke}) |
|
648
|
|
|
|
|
|
|
and croak "Could not run cpan executable at $this_cpan"; |
|
649
|
0
|
|
|
|
|
0
|
$self->{this_cpan} = $this_cpan; |
|
650
|
|
|
|
|
|
|
|
|
651
|
0
|
|
|
|
|
0
|
return $self; |
|
652
|
|
|
|
|
|
|
} |
|
653
|
|
|
|
|
|
|
|
|
654
|
|
|
|
|
|
|
=head2 C |
|
655
|
|
|
|
|
|
|
|
|
656
|
|
|
|
|
|
|
=over 4 |
|
657
|
|
|
|
|
|
|
|
|
658
|
|
|
|
|
|
|
=item * Purpose |
|
659
|
|
|
|
|
|
|
|
|
660
|
|
|
|
|
|
|
Once C has been run, two additional methods |
|
661
|
|
|
|
|
|
|
become available to help the code determine where it is. |
|
662
|
|
|
|
|
|
|
|
|
663
|
|
|
|
|
|
|
=over 4 |
|
664
|
|
|
|
|
|
|
|
|
665
|
|
|
|
|
|
|
=item * bin directory (I) |
|
666
|
|
|
|
|
|
|
|
|
667
|
|
|
|
|
|
|
The directory underneath an individual C directory holding installed |
|
668
|
|
|
|
|
|
|
executables such as F, F and F. |
|
669
|
|
|
|
|
|
|
|
|
670
|
|
|
|
|
|
|
=item * lib directory (I) |
|
671
|
|
|
|
|
|
|
|
|
672
|
|
|
|
|
|
|
The directory underneath an individual C directory holding the |
|
673
|
|
|
|
|
|
|
libraries supporting the installed executables found in the C. |
|
674
|
|
|
|
|
|
|
|
|
675
|
|
|
|
|
|
|
=back |
|
676
|
|
|
|
|
|
|
|
|
677
|
|
|
|
|
|
|
=item * Arguments |
|
678
|
|
|
|
|
|
|
|
|
679
|
|
|
|
|
|
|
$bin_dir = $self->get_bin_dir(); |
|
680
|
|
|
|
|
|
|
|
|
681
|
|
|
|
|
|
|
$lib_dir = $self->get_lib_dir(); |
|
682
|
|
|
|
|
|
|
|
|
683
|
|
|
|
|
|
|
=item * Return Value |
|
684
|
|
|
|
|
|
|
|
|
685
|
|
|
|
|
|
|
String holding a path to the named directory. |
|
686
|
|
|
|
|
|
|
|
|
687
|
|
|
|
|
|
|
=item * Comment |
|
688
|
|
|
|
|
|
|
|
|
689
|
|
|
|
|
|
|
If the F executable has not yet been installed, these methods will |
|
690
|
|
|
|
|
|
|
throw exceptions. |
|
691
|
|
|
|
|
|
|
|
|
692
|
|
|
|
|
|
|
=back |
|
693
|
|
|
|
|
|
|
|
|
694
|
|
|
|
|
|
|
=cut |
|
695
|
|
|
|
|
|
|
|
|
696
|
|
|
|
|
|
|
sub get_bin_dir { |
|
697
|
4
|
|
|
4
|
1
|
943
|
my $self = shift; |
|
698
|
4
|
50
|
|
|
|
56
|
if (! defined $self->{bin_dir}) { |
|
699
|
4
|
|
|
|
|
611
|
croak "bin directory has not yet been defined; have you installed perl?"; |
|
700
|
|
|
|
|
|
|
} |
|
701
|
|
|
|
|
|
|
else { |
|
702
|
0
|
|
|
|
|
0
|
return $self->{bin_dir}; |
|
703
|
|
|
|
|
|
|
} |
|
704
|
|
|
|
|
|
|
} |
|
705
|
|
|
|
|
|
|
|
|
706
|
|
|
|
|
|
|
sub get_lib_dir { |
|
707
|
2
|
|
|
2
|
1
|
1715
|
my $self = shift; |
|
708
|
2
|
50
|
|
|
|
16
|
if (! defined $self->{lib_dir}) { |
|
709
|
2
|
|
|
|
|
254
|
croak "lib directory has not yet been defined; have you installed perl?"; |
|
710
|
|
|
|
|
|
|
} |
|
711
|
|
|
|
|
|
|
else { |
|
712
|
0
|
|
|
|
|
0
|
return $self->{lib_dir}; |
|
713
|
|
|
|
|
|
|
} |
|
714
|
|
|
|
|
|
|
} |
|
715
|
|
|
|
|
|
|
|
|
716
|
|
|
|
|
|
|
=head2 C |
|
717
|
|
|
|
|
|
|
|
|
718
|
|
|
|
|
|
|
=over 4 |
|
719
|
|
|
|
|
|
|
|
|
720
|
|
|
|
|
|
|
=item * Purpose |
|
721
|
|
|
|
|
|
|
|
|
722
|
|
|
|
|
|
|
Identify the location of the F executable file being tested. |
|
723
|
|
|
|
|
|
|
|
|
724
|
|
|
|
|
|
|
=item * Arguments |
|
725
|
|
|
|
|
|
|
|
|
726
|
|
|
|
|
|
|
$this_perl = $self->get_this_perl() |
|
727
|
|
|
|
|
|
|
|
|
728
|
|
|
|
|
|
|
=item * Return Value |
|
729
|
|
|
|
|
|
|
|
|
730
|
|
|
|
|
|
|
String holding the path to the F executable being tested. |
|
731
|
|
|
|
|
|
|
|
|
732
|
|
|
|
|
|
|
=item * Comment |
|
733
|
|
|
|
|
|
|
|
|
734
|
|
|
|
|
|
|
Will throw an exception if such a F executable has not yet been installed. |
|
735
|
|
|
|
|
|
|
|
|
736
|
|
|
|
|
|
|
=back |
|
737
|
|
|
|
|
|
|
|
|
738
|
|
|
|
|
|
|
=cut |
|
739
|
|
|
|
|
|
|
|
|
740
|
|
|
|
|
|
|
sub get_this_perl { |
|
741
|
2
|
|
|
2
|
1
|
1693
|
my $self = shift; |
|
742
|
2
|
50
|
|
|
|
14
|
if ($self->{this_perl}) { |
|
743
|
0
|
|
|
|
|
0
|
return $self->{this_perl}; |
|
744
|
|
|
|
|
|
|
} |
|
745
|
|
|
|
|
|
|
else { |
|
746
|
2
|
|
|
|
|
10
|
local $@; |
|
747
|
2
|
|
|
|
|
9
|
my $this_perl; |
|
748
|
2
|
|
|
|
|
7
|
eval { |
|
749
|
2
|
|
|
|
|
9
|
$this_perl = File::Spec->catfile($self->get_bin_dir, 'perl'); |
|
750
|
|
|
|
|
|
|
}; |
|
751
|
2
|
50
|
|
|
|
17
|
if ($@) { |
|
|
|
0
|
|
|
|
|
|
|
752
|
2
|
|
|
|
|
193
|
croak $@; |
|
753
|
|
|
|
|
|
|
} |
|
754
|
|
|
|
|
|
|
elsif (-e $this_perl) { |
|
755
|
0
|
|
|
|
|
0
|
$self->{this_perl} = $this_perl; |
|
756
|
0
|
|
|
|
|
0
|
return $self->{this_perl}; |
|
757
|
|
|
|
|
|
|
} |
|
758
|
|
|
|
|
|
|
else { |
|
759
|
0
|
|
|
|
|
0
|
croak "No executable perl found at: $this_perl"; |
|
760
|
|
|
|
|
|
|
} |
|
761
|
|
|
|
|
|
|
} |
|
762
|
|
|
|
|
|
|
} |
|
763
|
|
|
|
|
|
|
|
|
764
|
|
|
|
|
|
|
=head2 C |
|
765
|
|
|
|
|
|
|
|
|
766
|
|
|
|
|
|
|
=over 4 |
|
767
|
|
|
|
|
|
|
|
|
768
|
|
|
|
|
|
|
=item * Purpose |
|
769
|
|
|
|
|
|
|
|
|
770
|
|
|
|
|
|
|
Identify the location of the F executable file. |
|
771
|
|
|
|
|
|
|
|
|
772
|
|
|
|
|
|
|
=item * Arguments |
|
773
|
|
|
|
|
|
|
|
|
774
|
|
|
|
|
|
|
$this_cpan = $self->get_this_cpan() |
|
775
|
|
|
|
|
|
|
|
|
776
|
|
|
|
|
|
|
=item * Return Value |
|
777
|
|
|
|
|
|
|
|
|
778
|
|
|
|
|
|
|
String holding the path to the F executable being tested. |
|
779
|
|
|
|
|
|
|
|
|
780
|
|
|
|
|
|
|
=item * Comment |
|
781
|
|
|
|
|
|
|
|
|
782
|
|
|
|
|
|
|
Will throw an exception if such a F executable has not yet been installed. We will use F to subsequently install F. |
|
783
|
|
|
|
|
|
|
|
|
784
|
|
|
|
|
|
|
=back |
|
785
|
|
|
|
|
|
|
|
|
786
|
|
|
|
|
|
|
=cut |
|
787
|
|
|
|
|
|
|
|
|
788
|
|
|
|
|
|
|
sub get_this_cpan { |
|
789
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
|
790
|
0
|
0
|
|
|
|
0
|
if ($self->{this_cpan}) { |
|
791
|
0
|
|
|
|
|
0
|
return $self->{this_cpan}; |
|
792
|
|
|
|
|
|
|
} |
|
793
|
|
|
|
|
|
|
else { |
|
794
|
0
|
|
|
|
|
0
|
local $@; |
|
795
|
0
|
|
|
|
|
0
|
my $this_cpan; |
|
796
|
0
|
|
|
|
|
0
|
eval { |
|
797
|
0
|
|
|
|
|
0
|
$this_cpan = File::Spec->catfile($self->get_bin_dir, 'cpan'); |
|
798
|
|
|
|
|
|
|
}; |
|
799
|
0
|
0
|
|
|
|
0
|
if ($@) { |
|
|
|
0
|
|
|
|
|
|
|
800
|
0
|
|
|
|
|
0
|
croak $@; |
|
801
|
|
|
|
|
|
|
} |
|
802
|
|
|
|
|
|
|
elsif (-e $this_cpan) { |
|
803
|
0
|
|
|
|
|
0
|
$self->{this_cpan} = $this_cpan; |
|
804
|
0
|
|
|
|
|
0
|
return $self->{this_cpan}; |
|
805
|
|
|
|
|
|
|
} |
|
806
|
|
|
|
|
|
|
else { |
|
807
|
0
|
|
|
|
|
0
|
croak "No executable cpan found at: $this_cpan"; |
|
808
|
|
|
|
|
|
|
} |
|
809
|
|
|
|
|
|
|
} |
|
810
|
|
|
|
|
|
|
} |
|
811
|
|
|
|
|
|
|
|
|
812
|
|
|
|
|
|
|
=head2 C |
|
813
|
|
|
|
|
|
|
|
|
814
|
|
|
|
|
|
|
=over 4 |
|
815
|
|
|
|
|
|
|
|
|
816
|
|
|
|
|
|
|
=item * Purpose |
|
817
|
|
|
|
|
|
|
|
|
818
|
|
|
|
|
|
|
Determine whether F has been installed. If it has not, install |
|
819
|
|
|
|
|
|
|
F and the F executable against the installed F. |
|
820
|
|
|
|
|
|
|
|
|
821
|
|
|
|
|
|
|
=item * Arguments |
|
822
|
|
|
|
|
|
|
|
|
823
|
|
|
|
|
|
|
my $rv = $self->fetch_cpanm(); |
|
824
|
|
|
|
|
|
|
|
|
825
|
|
|
|
|
|
|
None. All information is already inside the object. No C output. |
|
826
|
|
|
|
|
|
|
|
|
827
|
|
|
|
|
|
|
=item * Return Value |
|
828
|
|
|
|
|
|
|
|
|
829
|
|
|
|
|
|
|
Returns the Test::Against::Commit object, which now holds additional data. |
|
830
|
|
|
|
|
|
|
|
|
831
|
|
|
|
|
|
|
=item * Comment |
|
832
|
|
|
|
|
|
|
|
|
833
|
|
|
|
|
|
|
The F executable's location can subsequently be accessed by calling |
|
834
|
|
|
|
|
|
|
C<$self->get_this_cpanm()>. The method also guarantees the existence of a |
|
835
|
|
|
|
|
|
|
F<.cpanm> directory underneath the install directory, I side-by-side |
|
836
|
|
|
|
|
|
|
with C and C. This directory can subsequently be accessed by |
|
837
|
|
|
|
|
|
|
calling C<$self->get_cpanm_dir()>. |
|
838
|
|
|
|
|
|
|
|
|
839
|
|
|
|
|
|
|
=back |
|
840
|
|
|
|
|
|
|
|
|
841
|
|
|
|
|
|
|
=cut |
|
842
|
|
|
|
|
|
|
|
|
843
|
|
|
|
|
|
|
sub fetch_cpanm { |
|
844
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
|
845
|
|
|
|
|
|
|
|
|
846
|
0
|
|
|
|
|
0
|
my $cpanm_dir = File::Spec->catdir($self->get_testing_dir(), '.cpanm'); |
|
847
|
0
|
0
|
|
|
|
0
|
unless (-d $cpanm_dir) { make_path($cpanm_dir, { mode => 0755 }); } |
|
|
0
|
|
|
|
|
0
|
|
|
848
|
0
|
0
|
|
|
|
0
|
croak "Could not locate $cpanm_dir" unless (-d $cpanm_dir); |
|
849
|
0
|
|
|
|
|
0
|
$self->{cpanm_dir} = $cpanm_dir; |
|
850
|
|
|
|
|
|
|
|
|
851
|
0
|
|
|
|
|
0
|
my $bin_dir = $self->get_bin_dir(); |
|
852
|
0
|
|
|
|
|
0
|
my $this_cpan = File::Spec->catfile($bin_dir, 'cpan'); |
|
853
|
0
|
|
|
|
|
0
|
$self->{this_cpan} = $this_cpan; |
|
854
|
0
|
0
|
|
|
|
0
|
system(qq| $this_cpan -v 1>/dev/null |) and croak "Unable to call 'cpan -v'"; |
|
855
|
0
|
0
|
|
|
|
0
|
system(qq| $this_cpan App::cpanminus 1>/dev/null |) |
|
856
|
|
|
|
|
|
|
and croak "Unable to use cpan to install App::cpanminus"; |
|
857
|
0
|
|
|
|
|
0
|
my $this_cpanm = File::Spec->catfile($bin_dir, 'cpanm'); |
|
858
|
0
|
0
|
|
|
|
0
|
system(qq| $this_cpanm -V 1>/dev/null |) and croak "Unable to call 'cpanm -V'"; |
|
859
|
0
|
|
|
|
|
0
|
$self->{this_cpanm} = $this_cpanm; |
|
860
|
|
|
|
|
|
|
|
|
861
|
0
|
|
|
|
|
0
|
return $self; |
|
862
|
|
|
|
|
|
|
} |
|
863
|
|
|
|
|
|
|
|
|
864
|
|
|
|
|
|
|
sub get_this_cpanm { |
|
865
|
2
|
|
|
2
|
1
|
1660
|
my $self = shift; |
|
866
|
2
|
50
|
|
|
|
16
|
if (! defined $self->{this_cpanm}) { |
|
867
|
2
|
|
|
|
|
267
|
croak "location of cpanm has not yet been defined; run fetch_cpanm()"; |
|
868
|
|
|
|
|
|
|
} |
|
869
|
|
|
|
|
|
|
else { |
|
870
|
0
|
|
|
|
|
0
|
return $self->{this_cpanm}; |
|
871
|
|
|
|
|
|
|
} |
|
872
|
|
|
|
|
|
|
} |
|
873
|
|
|
|
|
|
|
|
|
874
|
|
|
|
|
|
|
sub get_cpanm_dir { |
|
875
|
2
|
|
|
2
|
1
|
1663
|
my $self = shift; |
|
876
|
2
|
50
|
|
|
|
14
|
if (! defined $self->{cpanm_dir}) { |
|
877
|
2
|
|
|
|
|
268
|
croak "cpanm directory has not yet been defined; run fetch_cpanm()"; |
|
878
|
|
|
|
|
|
|
} |
|
879
|
|
|
|
|
|
|
else { |
|
880
|
0
|
|
|
|
|
|
return $self->{cpanm_dir}; |
|
881
|
|
|
|
|
|
|
} |
|
882
|
|
|
|
|
|
|
} |
|
883
|
|
|
|
|
|
|
|
|
884
|
|
|
|
|
|
|
=head2 C |
|
885
|
|
|
|
|
|
|
|
|
886
|
|
|
|
|
|
|
=over 4 |
|
887
|
|
|
|
|
|
|
|
|
888
|
|
|
|
|
|
|
=item * Purpose |
|
889
|
|
|
|
|
|
|
|
|
890
|
|
|
|
|
|
|
Use F to install selected Perl modules against the F built for |
|
891
|
|
|
|
|
|
|
testing purposes. |
|
892
|
|
|
|
|
|
|
|
|
893
|
|
|
|
|
|
|
=item * Arguments |
|
894
|
|
|
|
|
|
|
|
|
895
|
|
|
|
|
|
|
Two mutually exclusive interfaces: |
|
896
|
|
|
|
|
|
|
|
|
897
|
|
|
|
|
|
|
=over 4 |
|
898
|
|
|
|
|
|
|
|
|
899
|
|
|
|
|
|
|
=item * Modules provided in a list |
|
900
|
|
|
|
|
|
|
|
|
901
|
|
|
|
|
|
|
my $modules_ref = $self->process_modules( { |
|
902
|
|
|
|
|
|
|
module_list => [ 'DateTime', 'AnyEvent' ], |
|
903
|
|
|
|
|
|
|
title => 'two-important-libraries', |
|
904
|
|
|
|
|
|
|
verbose => 1, |
|
905
|
|
|
|
|
|
|
} ); |
|
906
|
|
|
|
|
|
|
|
|
907
|
|
|
|
|
|
|
=item * Modules listed in a file |
|
908
|
|
|
|
|
|
|
|
|
909
|
|
|
|
|
|
|
my $modules_ref = $self->process_modules( { |
|
910
|
|
|
|
|
|
|
module_file => '/path/to/cpan-river-file.txt', |
|
911
|
|
|
|
|
|
|
title => 'cpan-river-1000', |
|
912
|
|
|
|
|
|
|
verbose => 1, |
|
913
|
|
|
|
|
|
|
} ); |
|
914
|
|
|
|
|
|
|
|
|
915
|
|
|
|
|
|
|
=back |
|
916
|
|
|
|
|
|
|
|
|
917
|
|
|
|
|
|
|
Each interface takes a hash reference with the following elements: |
|
918
|
|
|
|
|
|
|
|
|
919
|
|
|
|
|
|
|
=over 4 |
|
920
|
|
|
|
|
|
|
|
|
921
|
|
|
|
|
|
|
=item * C B C |
|
922
|
|
|
|
|
|
|
|
|
923
|
|
|
|
|
|
|
Mutually exclusive; you may use one or the other but not both. |
|
924
|
|
|
|
|
|
|
|
|
925
|
|
|
|
|
|
|
The value of C must be an array reference holding a list of |
|
926
|
|
|
|
|
|
|
modules for which you wish to assess the impact of changes in the Perl 5 core |
|
927
|
|
|
|
|
|
|
distribution. |
|
928
|
|
|
|
|
|
|
|
|
929
|
|
|
|
|
|
|
The value of C must be an absolute path to a file which holds a |
|
930
|
|
|
|
|
|
|
list of modules, one module per line. Lines in such a file that start with a |
|
931
|
|
|
|
|
|
|
'C<#>' (hash-mark or sharp) be treated as a comment and no module listed on |
|
932
|
|
|
|
|
|
|
that line will be processed. |
|
933
|
|
|
|
|
|
|
|
|
934
|
|
|
|
|
|
|
In either case the module names are spelled in C format -- |
|
935
|
|
|
|
|
|
|
I, double-colons -- rather than in C format |
|
936
|
|
|
|
|
|
|
(hyphens). |
|
937
|
|
|
|
|
|
|
|
|
938
|
|
|
|
|
|
|
=item * C |
|
939
|
|
|
|
|
|
|
|
|
940
|
|
|
|
|
|
|
String which will be used to compose the name of project-specific output |
|
941
|
|
|
|
|
|
|
files. Required. |
|
942
|
|
|
|
|
|
|
|
|
943
|
|
|
|
|
|
|
=item * C |
|
944
|
|
|
|
|
|
|
|
|
945
|
|
|
|
|
|
|
Extra information provided on STDOUT. Optional; defaults to being off; |
|
946
|
|
|
|
|
|
|
provide a Perl-true value to turn it on. Scope is limited to this method. |
|
947
|
|
|
|
|
|
|
|
|
948
|
|
|
|
|
|
|
=item * C |
|
949
|
|
|
|
|
|
|
|
|
950
|
|
|
|
|
|
|
Optional; defaults to being off. Program runs only as far as determining |
|
951
|
|
|
|
|
|
|
modules which the user will attempt to load, prints number of modules being |
|
952
|
|
|
|
|
|
|
attempted, then C returns an undefined value (which would |
|
953
|
|
|
|
|
|
|
prevent subsequent methods from running correctly). |
|
954
|
|
|
|
|
|
|
|
|
955
|
|
|
|
|
|
|
=back |
|
956
|
|
|
|
|
|
|
|
|
957
|
|
|
|
|
|
|
=item * Return Value |
|
958
|
|
|
|
|
|
|
|
|
959
|
|
|
|
|
|
|
Default: Single array reference holding a list of all modules that |
|
960
|
|
|
|
|
|
|
C at least attempted to process. |
|
961
|
|
|
|
|
|
|
|
|
962
|
|
|
|
|
|
|
With true-value for C: Undefined value. |
|
963
|
|
|
|
|
|
|
|
|
964
|
|
|
|
|
|
|
=item * Comment |
|
965
|
|
|
|
|
|
|
|
|
966
|
|
|
|
|
|
|
The method creates or confirms the existence of several directories underneath the |
|
967
|
|
|
|
|
|
|
I directory discussed above. These are illustrated as follows: |
|
968
|
|
|
|
|
|
|
|
|
969
|
|
|
|
|
|
|
/path-to-application/ # <-- application directory |
|
970
|
|
|
|
|
|
|
/path-to-application/goto-fatal/ # <-- project directory |
|
971
|
|
|
|
|
|
|
/path-to-application/goto-fatal/23ae7f95ea/ # <-- installation directory |
|
972
|
|
|
|
|
|
|
/path-to-application/goto-fatal/23ae7f95ea/testing/ # <-- testing directory |
|
973
|
|
|
|
|
|
|
/path-to-application/goto-fatal/23ae7f95ea/results/ # <-- results directory |
|
974
|
|
|
|
|
|
|
/path-to-application/goto-fatal/23ae7f95ea/results/analysis/ # <-- analysis directory |
|
975
|
|
|
|
|
|
|
/path-to-application/goto-fatal/23ae7f95ea/results/storage/ # <-- storage directory |
|
976
|
|
|
|
|
|
|
|
|
977
|
|
|
|
|
|
|
=back |
|
978
|
|
|
|
|
|
|
|
|
979
|
|
|
|
|
|
|
=cut |
|
980
|
|
|
|
|
|
|
|
|
981
|
|
|
|
|
|
|
sub process_modules { |
|
982
|
0
|
|
|
0
|
1
|
|
my ($self, $args) = @_; |
|
983
|
0
|
0
|
0
|
|
|
|
croak "process_modules: Must supply hash ref as argument" |
|
984
|
|
|
|
|
|
|
unless ( ( defined $args ) and ( ref($args) eq 'HASH' ) ); |
|
985
|
|
|
|
|
|
|
|
|
986
|
0
|
|
0
|
|
|
|
my $verbose = delete $args->{verbose} || ''; |
|
987
|
0
|
|
0
|
|
|
|
my $dryrun = delete $args->{dryrun} || ''; |
|
988
|
0
|
|
|
|
|
|
my %eligible_args = map { $_ => 1 } ( qw| |
|
|
0
|
|
|
|
|
|
|
|
989
|
|
|
|
|
|
|
module_file module_list title |
|
990
|
|
|
|
|
|
|
| ); |
|
991
|
0
|
|
|
|
|
|
for my $k (keys %$args) { |
|
992
|
|
|
|
|
|
|
croak "process_modules: '$k' is not a valid element" |
|
993
|
0
|
0
|
|
|
|
|
unless $eligible_args{$k}; |
|
994
|
|
|
|
|
|
|
} |
|
995
|
|
|
|
|
|
|
|
|
996
|
0
|
0
|
0
|
|
|
|
unless (defined $args->{title} and length $args->{title}) { |
|
997
|
0
|
|
|
|
|
|
croak "Must supply value for 'title' element"; |
|
998
|
|
|
|
|
|
|
} |
|
999
|
0
|
|
|
|
|
|
$self->{title} = $args->{title}; |
|
1000
|
|
|
|
|
|
|
|
|
1001
|
0
|
0
|
0
|
|
|
|
if (exists $args->{module_file} and exists $args->{module_list}) { |
|
1002
|
0
|
|
|
|
|
|
croak "process_modules: Supply either a file for 'module_file' or an array ref for 'module_list' but not both"; |
|
1003
|
|
|
|
|
|
|
} |
|
1004
|
0
|
0
|
0
|
|
|
|
if (! (exists $args->{module_file} or exists $args->{module_list}) ) { |
|
1005
|
0
|
|
|
|
|
|
croak "process_modules: Must supply one of 'module_file' or 'module_list'"; |
|
1006
|
|
|
|
|
|
|
} |
|
1007
|
0
|
0
|
|
|
|
|
if ($args->{module_file}) { |
|
1008
|
|
|
|
|
|
|
croak "process_modules: Could not locate '$args->{module_file}'" |
|
1009
|
0
|
0
|
|
|
|
|
unless (-f $args->{module_file}); |
|
1010
|
|
|
|
|
|
|
} |
|
1011
|
0
|
0
|
|
|
|
|
if ($args->{module_list}) { |
|
1012
|
|
|
|
|
|
|
croak "process_modules: Must supply array ref for 'module_list'" |
|
1013
|
0
|
0
|
|
|
|
|
unless ref($args->{module_list}) eq 'ARRAY'; |
|
1014
|
|
|
|
|
|
|
} |
|
1015
|
|
|
|
|
|
|
|
|
1016
|
0
|
|
|
|
|
|
$self->setup_results_directories(); |
|
1017
|
|
|
|
|
|
|
|
|
1018
|
0
|
0
|
|
|
|
|
say "cpanm_dir: ", $self->get_cpanm_dir() if $verbose; |
|
1019
|
0
|
|
|
|
|
|
local $ENV{PERL_CPANM_HOME} = $self->get_cpanm_dir(); |
|
1020
|
|
|
|
|
|
|
|
|
1021
|
0
|
|
|
|
|
|
my @modules = (); |
|
1022
|
0
|
0
|
|
|
|
|
if ($args->{module_list}) { |
|
1023
|
0
|
|
|
|
|
|
@modules = @{$args->{module_list}}; |
|
|
0
|
|
|
|
|
|
|
|
1024
|
|
|
|
|
|
|
} |
|
1025
|
|
|
|
|
|
|
else { |
|
1026
|
|
|
|
|
|
|
open my $IN, '<', $args->{module_file} |
|
1027
|
0
|
0
|
|
|
|
|
or croak "Could not open $args->{module_file} for reading"; |
|
1028
|
0
|
|
|
|
|
|
while (my $m = <$IN>) { |
|
1029
|
0
|
|
|
|
|
|
chomp $m; |
|
1030
|
0
|
0
|
|
|
|
|
next if $m =~ m/^#/; # Skip lines that are commented out |
|
1031
|
0
|
|
|
|
|
|
push @modules, $m; |
|
1032
|
|
|
|
|
|
|
} |
|
1033
|
0
|
0
|
|
|
|
|
close $IN or croak "Could not close $args->{module_file} after reading"; |
|
1034
|
|
|
|
|
|
|
} |
|
1035
|
0
|
0
|
|
|
|
|
if ($dryrun) { |
|
1036
|
0
|
|
|
|
|
|
say "Planning to process ", scalar(@modules), " modules"; |
|
1037
|
0
|
0
|
|
|
|
|
if ($verbose) { |
|
1038
|
0
|
|
|
|
|
|
dd(\@modules); |
|
1039
|
|
|
|
|
|
|
} |
|
1040
|
0
|
|
|
|
|
|
return; |
|
1041
|
|
|
|
|
|
|
} |
|
1042
|
|
|
|
|
|
|
|
|
1043
|
0
|
|
|
|
|
|
my $libdir = $self->get_lib_dir(); |
|
1044
|
|
|
|
|
|
|
|
|
1045
|
0
|
|
|
|
|
|
for my $m (@modules) { |
|
1046
|
|
|
|
|
|
|
|
|
1047
|
|
|
|
|
|
|
# Formulate the system call |
|
1048
|
0
|
|
|
|
|
|
my @cmd = ( |
|
1049
|
|
|
|
|
|
|
$self->get_this_perl(), |
|
1050
|
|
|
|
|
|
|
"-I$libdir", |
|
1051
|
|
|
|
|
|
|
$self->get_this_cpanm(), |
|
1052
|
|
|
|
|
|
|
$m, |
|
1053
|
|
|
|
|
|
|
); |
|
1054
|
|
|
|
|
|
|
# Execute the system call |
|
1055
|
|
|
|
|
|
|
{ |
|
1056
|
0
|
|
|
|
|
|
local $@; |
|
|
0
|
|
|
|
|
|
|
|
1057
|
0
|
|
|
|
|
|
my $rv; |
|
1058
|
0
|
|
|
|
|
|
eval { $rv = system(@cmd); }; |
|
|
0
|
|
|
|
|
|
|
|
1059
|
0
|
0
|
|
|
|
|
say "<$@>" if $@; |
|
1060
|
0
|
0
|
|
|
|
|
say $self->get_this_cpanm(), " exited with ", $rv >> 8 |
|
1061
|
|
|
|
|
|
|
if ($verbose); |
|
1062
|
|
|
|
|
|
|
} |
|
1063
|
0
|
|
|
|
|
|
my $this_buildlog_link = |
|
1064
|
|
|
|
|
|
|
File::Spec->catfile($self->get_cpanm_dir(), 'build.log'); |
|
1065
|
0
|
0
|
|
|
|
|
croak "$this_buildlog_link is not a symlink" unless (-l $this_buildlog_link); |
|
1066
|
0
|
|
|
|
|
|
my $this_buildlog = readlink($this_buildlog_link); |
|
1067
|
0
|
0
|
|
|
|
|
croak "$this_buildlog not found" unless (-f $this_buildlog); |
|
1068
|
|
|
|
|
|
|
|
|
1069
|
0
|
|
|
|
|
|
$self->process_one_report($this_buildlog); |
|
1070
|
|
|
|
|
|
|
} |
|
1071
|
|
|
|
|
|
|
|
|
1072
|
|
|
|
|
|
|
# End of loop. |
|
1073
|
|
|
|
|
|
|
# This should lead to 100s of .json files in the analysis_dir. |
|
1074
|
|
|
|
|
|
|
|
|
1075
|
0
|
|
|
|
|
|
return [ @modules ]; |
|
1076
|
|
|
|
|
|
|
} |
|
1077
|
|
|
|
|
|
|
|
|
1078
|
|
|
|
|
|
|
sub setup_results_directories { |
|
1079
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
1080
|
0
|
|
|
|
|
|
my $results_dir = $self->get_results_dir(); |
|
1081
|
0
|
|
|
|
|
|
my $analysis_dir = File::Spec->catdir($results_dir, 'analysis'); |
|
1082
|
0
|
|
|
|
|
|
my $storage_dir = File::Spec->catdir($results_dir, 'storage'); |
|
1083
|
0
|
|
|
|
|
|
my @created = make_path( $analysis_dir, $storage_dir, |
|
1084
|
|
|
|
|
|
|
{ mode => 0755 }); |
|
1085
|
0
|
0
|
|
|
|
|
for my $dir (@created) { croak "$dir not found" unless -d $dir; } |
|
|
0
|
|
|
|
|
|
|
|
1086
|
0
|
|
|
|
|
|
$self->{analysis_dir} = $analysis_dir; |
|
1087
|
0
|
|
|
|
|
|
$self->{storage_dir} = $storage_dir; |
|
1088
|
0
|
|
|
|
|
|
return scalar(@created); |
|
1089
|
|
|
|
|
|
|
} |
|
1090
|
|
|
|
|
|
|
|
|
1091
|
|
|
|
|
|
|
sub process_one_report { |
|
1092
|
0
|
|
|
0
|
0
|
|
my ($self, $this_buildlog) = @_; |
|
1093
|
0
|
|
|
|
|
|
my $reporter = CPAN::cpanminus::reporter::RetainReports->new( |
|
1094
|
|
|
|
|
|
|
force => 1, # ignore mtime check on build.log |
|
1095
|
|
|
|
|
|
|
build_logfile => $this_buildlog, |
|
1096
|
|
|
|
|
|
|
build_dir => $self->get_cpanm_dir(), |
|
1097
|
|
|
|
|
|
|
'ignore-versions' => 1, |
|
1098
|
|
|
|
|
|
|
); |
|
1099
|
0
|
0
|
|
|
|
|
croak "Unable to create new reporter for $this_buildlog" |
|
1100
|
|
|
|
|
|
|
unless defined $reporter; |
|
1101
|
2
|
|
|
2
|
|
21
|
no warnings 'redefine'; |
|
|
2
|
|
|
|
|
4
|
|
|
|
2
|
|
|
|
|
3950
|
|
|
1102
|
0
|
|
|
0
|
|
|
local *CPAN::cpanminus::reporter::RetainReports::_check_cpantesters_config_data = sub { 1 }; |
|
|
0
|
|
|
|
|
|
|
|
1103
|
0
|
|
|
|
|
|
$reporter->set_report_dir($self->get_analysis_dir()); |
|
1104
|
0
|
|
|
|
|
|
$reporter->run; |
|
1105
|
0
|
|
|
|
|
|
return 1; |
|
1106
|
|
|
|
|
|
|
} |
|
1107
|
|
|
|
|
|
|
|
|
1108
|
|
|
|
|
|
|
=head2 C |
|
1109
|
|
|
|
|
|
|
|
|
1110
|
|
|
|
|
|
|
=over 4 |
|
1111
|
|
|
|
|
|
|
|
|
1112
|
|
|
|
|
|
|
=item * Purpose |
|
1113
|
|
|
|
|
|
|
|
|
1114
|
|
|
|
|
|
|
Once C has been run, two additional methods become available to |
|
1115
|
|
|
|
|
|
|
help code determine where output data are located. |
|
1116
|
|
|
|
|
|
|
|
|
1117
|
|
|
|
|
|
|
=over 4 |
|
1118
|
|
|
|
|
|
|
|
|
1119
|
|
|
|
|
|
|
=item * analysis directory (I) |
|
1120
|
|
|
|
|
|
|
|
|
1121
|
|
|
|
|
|
|
The directory underneath the I holding files representing |
|
1122
|
|
|
|
|
|
|
the parsed content of the build log of the most recent run. These files are |
|
1123
|
|
|
|
|
|
|
in C<.json> format. |
|
1124
|
|
|
|
|
|
|
|
|
1125
|
|
|
|
|
|
|
=item * storage directory (I) |
|
1126
|
|
|
|
|
|
|
|
|
1127
|
|
|
|
|
|
|
The directory underneath the I holding final output results. |
|
1128
|
|
|
|
|
|
|
|
|
1129
|
|
|
|
|
|
|
=back |
|
1130
|
|
|
|
|
|
|
|
|
1131
|
|
|
|
|
|
|
=item * Arguments |
|
1132
|
|
|
|
|
|
|
|
|
1133
|
|
|
|
|
|
|
$storage_dir = $self->get_storage_dir(); |
|
1134
|
|
|
|
|
|
|
|
|
1135
|
|
|
|
|
|
|
=item * Return Value |
|
1136
|
|
|
|
|
|
|
|
|
1137
|
|
|
|
|
|
|
String holding a path to the named directory. |
|
1138
|
|
|
|
|
|
|
|
|
1139
|
|
|
|
|
|
|
=item * Comment |
|
1140
|
|
|
|
|
|
|
|
|
1141
|
|
|
|
|
|
|
These directories are only confirmed to exist once internal method |
|
1142
|
|
|
|
|
|
|
C has been executed. (That method is called |
|
1143
|
|
|
|
|
|
|
within C.) Otherwise, these methods will throw exceptions. |
|
1144
|
|
|
|
|
|
|
|
|
1145
|
|
|
|
|
|
|
=back |
|
1146
|
|
|
|
|
|
|
|
|
1147
|
|
|
|
|
|
|
=cut |
|
1148
|
|
|
|
|
|
|
|
|
1149
|
|
|
|
|
|
|
sub get_analysis_dir { |
|
1150
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
1151
|
0
|
0
|
|
|
|
|
if (! defined $self->{analysis_dir}) { |
|
1152
|
0
|
|
|
|
|
|
croak "analysis directory has not yet been defined"; |
|
1153
|
|
|
|
|
|
|
} |
|
1154
|
|
|
|
|
|
|
else { |
|
1155
|
0
|
|
|
|
|
|
return $self->{analysis_dir}; |
|
1156
|
|
|
|
|
|
|
} |
|
1157
|
|
|
|
|
|
|
} |
|
1158
|
|
|
|
|
|
|
|
|
1159
|
|
|
|
|
|
|
sub get_storage_dir { |
|
1160
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
1161
|
0
|
0
|
|
|
|
|
if (! defined $self->{storage_dir}) { |
|
1162
|
0
|
|
|
|
|
|
croak "storage directory has not yet been defined"; |
|
1163
|
|
|
|
|
|
|
} |
|
1164
|
|
|
|
|
|
|
else { |
|
1165
|
0
|
|
|
|
|
|
return $self->{storage_dir}; |
|
1166
|
|
|
|
|
|
|
} |
|
1167
|
|
|
|
|
|
|
} |
|
1168
|
|
|
|
|
|
|
|
|
1169
|
|
|
|
|
|
|
=head2 C |
|
1170
|
|
|
|
|
|
|
|
|
1171
|
|
|
|
|
|
|
=over 4 |
|
1172
|
|
|
|
|
|
|
|
|
1173
|
|
|
|
|
|
|
=item * Purpose |
|
1174
|
|
|
|
|
|
|
|
|
1175
|
|
|
|
|
|
|
Create a character-delimited-values file summarizing the results of a given |
|
1176
|
|
|
|
|
|
|
run. The delimiter defaults to a pipe (C<|>), thereby creating a |
|
1177
|
|
|
|
|
|
|
pipe-separated values file (C<.psv>), but you may select a comma (C<,>), |
|
1178
|
|
|
|
|
|
|
generating a comma-separated-values file (C<.csv>) as well. |
|
1179
|
|
|
|
|
|
|
|
|
1180
|
|
|
|
|
|
|
=item * Arguments |
|
1181
|
|
|
|
|
|
|
|
|
1182
|
|
|
|
|
|
|
my $fcdvfile = $self->analyze_json_logs( { verbose => 1, sep_char => '|' } ); |
|
1183
|
|
|
|
|
|
|
|
|
1184
|
|
|
|
|
|
|
Hash reference with these elements: |
|
1185
|
|
|
|
|
|
|
|
|
1186
|
|
|
|
|
|
|
=over 4 |
|
1187
|
|
|
|
|
|
|
|
|
1188
|
|
|
|
|
|
|
=item * C |
|
1189
|
|
|
|
|
|
|
|
|
1190
|
|
|
|
|
|
|
Extra information provided on STDOUT. Optional; defaults to being off; |
|
1191
|
|
|
|
|
|
|
provide a Perl-true value to turn it on. Scope is limited to this method. |
|
1192
|
|
|
|
|
|
|
|
|
1193
|
|
|
|
|
|
|
=item * C |
|
1194
|
|
|
|
|
|
|
|
|
1195
|
|
|
|
|
|
|
Delimiter character. Optional; defaults to pipe (C<|>), but comma (C<,>) may |
|
1196
|
|
|
|
|
|
|
also be chosen. |
|
1197
|
|
|
|
|
|
|
|
|
1198
|
|
|
|
|
|
|
=back |
|
1199
|
|
|
|
|
|
|
|
|
1200
|
|
|
|
|
|
|
=item * Return Value |
|
1201
|
|
|
|
|
|
|
|
|
1202
|
|
|
|
|
|
|
String holding absolute path to the C<.psv> or C<.csv> file created. |
|
1203
|
|
|
|
|
|
|
|
|
1204
|
|
|
|
|
|
|
=item * Comment |
|
1205
|
|
|
|
|
|
|
|
|
1206
|
|
|
|
|
|
|
As a precaution, the function creates a tarball to archive the F<.log.json> |
|
1207
|
|
|
|
|
|
|
files for a given run. |
|
1208
|
|
|
|
|
|
|
|
|
1209
|
|
|
|
|
|
|
=back |
|
1210
|
|
|
|
|
|
|
|
|
1211
|
|
|
|
|
|
|
=cut |
|
1212
|
|
|
|
|
|
|
|
|
1213
|
|
|
|
|
|
|
sub analyze_json_logs { |
|
1214
|
0
|
|
|
0
|
1
|
|
my ($self, $args) = @_; |
|
1215
|
|
|
|
|
|
|
# TODO: If we don't have an $args supplied at all, that's okay provided we |
|
1216
|
|
|
|
|
|
|
# can ensure that we will have a default sep_char set |
|
1217
|
|
|
|
|
|
|
# Test this method with hash ref but lacking 'verbose' |
|
1218
|
|
|
|
|
|
|
# Test this method with hash ref but lacking 'sep_char' |
|
1219
|
|
|
|
|
|
|
# Test this method with hash ref but both KVPs |
|
1220
|
|
|
|
|
|
|
# Test this method with no arg |
|
1221
|
0
|
0
|
0
|
|
|
|
croak "analyze_json_logs: Must supply hash ref as argument" |
|
1222
|
|
|
|
|
|
|
unless ( ( defined $args ) and ( ref($args) eq 'HASH' ) ); |
|
1223
|
0
|
|
0
|
|
|
|
my $verbose = delete $args->{verbose} || ''; |
|
1224
|
0
|
|
0
|
|
|
|
my $sep_char = delete $args->{sep_char} || '|'; |
|
1225
|
0
|
0
|
0
|
|
|
|
croak "analyze_json_logs: Currently only pipe ('|') and comma (',') are supported as delimiter characters" |
|
1226
|
|
|
|
|
|
|
unless ($sep_char eq '|' or $sep_char eq ','); |
|
1227
|
|
|
|
|
|
|
|
|
1228
|
|
|
|
|
|
|
# Locate our log.json files |
|
1229
|
0
|
|
|
|
|
|
my $json_log_files = $self->_list_log_files(); |
|
1230
|
|
|
|
|
|
|
# Test without verbose |
|
1231
|
0
|
0
|
|
|
|
|
dd($json_log_files) if $verbose; |
|
1232
|
|
|
|
|
|
|
|
|
1233
|
|
|
|
|
|
|
# As a precaution, we archive those log.json files. |
|
1234
|
0
|
|
|
|
|
|
$self->_archive_log_files( { |
|
1235
|
|
|
|
|
|
|
json_log_files => $json_log_files, |
|
1236
|
|
|
|
|
|
|
# $verbose: ensure that it is initialized, if only to '' |
|
1237
|
|
|
|
|
|
|
verbose => $verbose, |
|
1238
|
|
|
|
|
|
|
} ); |
|
1239
|
|
|
|
|
|
|
|
|
1240
|
|
|
|
|
|
|
# Having archived our log.json files, we now proceed to read them and to |
|
1241
|
|
|
|
|
|
|
# write a pipe- (or comma-) separated-values file summarizing the run. |
|
1242
|
0
|
|
|
|
|
|
my %data = (); |
|
1243
|
0
|
|
|
|
|
|
for my $log (@{$json_log_files}) { |
|
|
0
|
|
|
|
|
|
|
|
1244
|
0
|
|
|
|
|
|
my $flog = File::Spec->catfile($self->{results_dir}, $log); |
|
1245
|
0
|
|
|
|
|
|
my %this = (); |
|
1246
|
0
|
|
|
|
|
|
my $f = Path::Tiny::path($flog); |
|
1247
|
0
|
|
|
|
|
|
my $decoded; |
|
1248
|
|
|
|
|
|
|
{ |
|
1249
|
0
|
|
|
|
|
|
local $@; |
|
|
0
|
|
|
|
|
|
|
|
1250
|
0
|
|
|
|
|
|
eval { $decoded = decode_json($f->slurp_utf8); }; |
|
|
0
|
|
|
|
|
|
|
|
1251
|
0
|
0
|
|
|
|
|
if ($@) { |
|
1252
|
0
|
|
|
|
|
|
warn "JSON decoding problem in $flog: <$@>"; |
|
1253
|
0
|
|
|
|
|
|
eval { $decoded = JSON->new->decode($f->slurp_utf8); }; |
|
|
0
|
|
|
|
|
|
|
|
1254
|
|
|
|
|
|
|
} |
|
1255
|
|
|
|
|
|
|
} |
|
1256
|
0
|
|
|
|
|
|
map { $this{$_} = $decoded->{$_} } ( qw| author distname grade | ); |
|
|
0
|
|
|
|
|
|
|
|
1257
|
0
|
|
|
|
|
|
$data{$decoded->{dist}} = \%this; |
|
1258
|
|
|
|
|
|
|
} |
|
1259
|
|
|
|
|
|
|
|
|
1260
|
|
|
|
|
|
|
# Now we create a CSV file (really ... a PSV) |
|
1261
|
0
|
|
|
|
|
|
my $fcdvfile = $self->_create_csv_file( { |
|
1262
|
|
|
|
|
|
|
# $verbose: ensure that it is initialized, if only to '' |
|
1263
|
|
|
|
|
|
|
sep_char => $sep_char, |
|
1264
|
|
|
|
|
|
|
data => \%data, |
|
1265
|
|
|
|
|
|
|
# $verbose: ensure that it is initialized, if only to '' |
|
1266
|
|
|
|
|
|
|
verbose => $verbose, |
|
1267
|
|
|
|
|
|
|
} ); |
|
1268
|
|
|
|
|
|
|
|
|
1269
|
0
|
|
|
|
|
|
return $fcdvfile; |
|
1270
|
|
|
|
|
|
|
} |
|
1271
|
|
|
|
|
|
|
|
|
1272
|
|
|
|
|
|
|
sub _list_log_files { |
|
1273
|
0
|
|
|
0
|
|
|
my $self = shift; |
|
1274
|
0
|
|
|
|
|
|
my $analysis_dir = $self->{analysis_dir}; |
|
1275
|
0
|
0
|
|
|
|
|
opendir my $DIRH, $analysis_dir or croak "Unable to open $analysis_dir for reading"; |
|
1276
|
0
|
|
|
|
|
|
my @json_log_files = sort map { File::Spec->catfile('analysis', $_) } |
|
1277
|
0
|
|
|
|
|
|
grep { m/\.log\.json$/ } readdir $DIRH; |
|
|
0
|
|
|
|
|
|
|
|
1278
|
0
|
0
|
|
|
|
|
closedir $DIRH or croak "Unable to close $analysis_dir after reading"; |
|
1279
|
0
|
|
|
|
|
|
return \@json_log_files; |
|
1280
|
|
|
|
|
|
|
} |
|
1281
|
|
|
|
|
|
|
|
|
1282
|
|
|
|
|
|
|
sub _archive_log_files { |
|
1283
|
0
|
|
|
0
|
|
|
my ($self, $args) = @_; |
|
1284
|
|
|
|
|
|
|
# TODO: Is this file name self-documenting enough? Need datestamp? |
|
1285
|
|
|
|
|
|
|
my $output = join('.' => ( |
|
1286
|
|
|
|
|
|
|
$self->{title}, |
|
1287
|
|
|
|
|
|
|
$self->{install}, |
|
1288
|
0
|
|
|
|
|
|
'log', |
|
1289
|
|
|
|
|
|
|
'json', |
|
1290
|
|
|
|
|
|
|
'tar', |
|
1291
|
|
|
|
|
|
|
'gz' |
|
1292
|
|
|
|
|
|
|
) ); |
|
1293
|
0
|
|
|
|
|
|
my $foutput = File::Spec->catfile($self->{storage_dir}, $output); |
|
1294
|
|
|
|
|
|
|
# Test this without $args->{verbose} |
|
1295
|
0
|
0
|
|
|
|
|
say "Output will be: $foutput" if $args->{verbose}; |
|
1296
|
0
|
|
|
|
|
|
my $versioned_results_dir = $self->{results_dir}; |
|
1297
|
0
|
|
|
|
|
|
my $previous_cwd = cwd(); |
|
1298
|
0
|
0
|
|
|
|
|
chdir $self->{results_dir} or croak "Unable to chdir to $self->{results_dir}"; |
|
1299
|
|
|
|
|
|
|
# Test this without $args->{verbose} |
|
1300
|
0
|
0
|
|
|
|
|
say "Now in $self->{results_dir}" if $args->{verbose}; |
|
1301
|
0
|
|
|
|
|
|
my $tar = Archive::Tar->new; |
|
1302
|
0
|
|
|
|
|
|
$tar->add_files(@{$args->{json_log_files}}); |
|
|
0
|
|
|
|
|
|
|
|
1303
|
0
|
|
|
|
|
|
$tar->write($foutput, COMPRESS_GZIP); |
|
1304
|
0
|
0
|
|
|
|
|
croak "$foutput not created" unless (-f $foutput); |
|
1305
|
|
|
|
|
|
|
# Test this without $args->{verbose} |
|
1306
|
0
|
0
|
|
|
|
|
say "Created archive $foutput" if $args->{verbose}; |
|
1307
|
0
|
0
|
|
|
|
|
chdir $previous_cwd or croak "Unable to change back to $previous_cwd"; |
|
1308
|
0
|
|
|
|
|
|
return 1; |
|
1309
|
|
|
|
|
|
|
} |
|
1310
|
|
|
|
|
|
|
|
|
1311
|
|
|
|
|
|
|
sub _create_csv_file { |
|
1312
|
0
|
|
|
0
|
|
|
my ($self, $args) = @_; |
|
1313
|
|
|
|
|
|
|
|
|
1314
|
|
|
|
|
|
|
my $cdvfile = join('.' => ( |
|
1315
|
|
|
|
|
|
|
$self->{title}, |
|
1316
|
|
|
|
|
|
|
$self->{install}, |
|
1317
|
0
|
0
|
|
|
|
|
(($args->{sep_char} eq ',') ? 'csv' : 'psv'), |
|
1318
|
|
|
|
|
|
|
) ); |
|
1319
|
0
|
|
|
|
|
|
my $fcdvfile = File::Spec->catfile($self->{storage_dir}, $cdvfile); |
|
1320
|
|
|
|
|
|
|
# Test this without $args->{verbose} |
|
1321
|
0
|
0
|
|
|
|
|
say "Output will be: $fcdvfile" if $args->{verbose}; |
|
1322
|
|
|
|
|
|
|
|
|
1323
|
0
|
|
|
|
|
|
my @fields = ( qw| author distname grade | ); |
|
1324
|
0
|
|
|
|
|
|
my $install = $self->{install}; |
|
1325
|
0
|
|
|
|
|
|
my $columns = [ |
|
1326
|
|
|
|
|
|
|
'dist', |
|
1327
|
|
|
|
|
|
|
@fields, |
|
1328
|
|
|
|
|
|
|
]; |
|
1329
|
|
|
|
|
|
|
my $psv = Text::CSV_XS->new({ |
|
1330
|
|
|
|
|
|
|
binary => 1, |
|
1331
|
|
|
|
|
|
|
auto_diag => 1, |
|
1332
|
|
|
|
|
|
|
sep_char => $args->{sep_char}, |
|
1333
|
0
|
|
|
|
|
|
eol => $/, |
|
1334
|
|
|
|
|
|
|
}); |
|
1335
|
0
|
0
|
|
|
|
|
open my $OUT, ">:encoding(utf8)", $fcdvfile |
|
1336
|
|
|
|
|
|
|
or croak "Unable to open $fcdvfile for writing"; |
|
1337
|
0
|
0
|
|
|
|
|
$psv->print($OUT, $columns), "\n" or $psv->error_diag; |
|
1338
|
0
|
|
|
|
|
|
for my $dist (sort keys %{$args->{data}}) { |
|
|
0
|
|
|
|
|
|
|
|
1339
|
|
|
|
|
|
|
$psv->print($OUT, [ |
|
1340
|
|
|
|
|
|
|
$dist, |
|
1341
|
0
|
0
|
|
|
|
|
@{$args->{data}->{$dist}}{@fields}, |
|
|
0
|
|
|
|
|
|
|
|
1342
|
|
|
|
|
|
|
]) or $psv->error_diag; |
|
1343
|
|
|
|
|
|
|
} |
|
1344
|
0
|
0
|
|
|
|
|
close $OUT or croak "Unable to close $fcdvfile after writing"; |
|
1345
|
0
|
0
|
|
|
|
|
croak "$fcdvfile not created" unless (-f $fcdvfile); |
|
1346
|
|
|
|
|
|
|
# Test this without $args->{verbose} |
|
1347
|
|
|
|
|
|
|
say "Examine ", |
|
1348
|
|
|
|
|
|
|
(($args->{sep_char} eq ',') ? 'comma' : 'pipe'), |
|
1349
|
|
|
|
|
|
|
"-separated values in $fcdvfile" |
|
1350
|
0
|
0
|
|
|
|
|
if $args->{verbose}; |
|
|
|
0
|
|
|
|
|
|
|
1351
|
0
|
|
|
|
|
|
return $fcdvfile; |
|
1352
|
|
|
|
|
|
|
} |
|
1353
|
|
|
|
|
|
|
|
|
1354
|
|
|
|
|
|
|
1; |
|
1355
|
|
|
|
|
|
|
|
|
1356
|
|
|
|
|
|
|
=head1 LIMITATIONS |
|
1357
|
|
|
|
|
|
|
|
|
1358
|
|
|
|
|
|
|
This library has a fair number of direct and indirect dependencies on other |
|
1359
|
|
|
|
|
|
|
CPAN libraries. Consequently, the library may experience problems if there |
|
1360
|
|
|
|
|
|
|
are major changes in those libraries. In particular, the code is indirectly |
|
1361
|
|
|
|
|
|
|
dependent upon F, which in turn is dependent upon |
|
1362
|
|
|
|
|
|
|
F. (Nonetheless, this software could never have been written without |
|
1363
|
|
|
|
|
|
|
those two libraries by Breno G. de Oliveira and Tatsuhiko Miyagawa, |
|
1364
|
|
|
|
|
|
|
respectively.) |
|
1365
|
|
|
|
|
|
|
|
|
1366
|
|
|
|
|
|
|
This library has been developed in a Unix programming environment and is |
|
1367
|
|
|
|
|
|
|
unlikely to work in its current form on Windows, Cygwin or VMS. |
|
1368
|
|
|
|
|
|
|
|
|
1369
|
|
|
|
|
|
|
=head1 AUTHOR |
|
1370
|
|
|
|
|
|
|
|
|
1371
|
|
|
|
|
|
|
James E Keenan |
|
1372
|
|
|
|
|
|
|
CPAN ID: JKEENAN |
|
1373
|
|
|
|
|
|
|
jkeenan@cpan.org |
|
1374
|
|
|
|
|
|
|
http://thenceforward.net/perl |
|
1375
|
|
|
|
|
|
|
|
|
1376
|
|
|
|
|
|
|
=head1 SUPPORT |
|
1377
|
|
|
|
|
|
|
|
|
1378
|
|
|
|
|
|
|
Please report any bugs in our GitHub Issues queue at |
|
1379
|
|
|
|
|
|
|
L. |
|
1380
|
|
|
|
|
|
|
|
|
1381
|
|
|
|
|
|
|
=head1 COPYRIGHT |
|
1382
|
|
|
|
|
|
|
|
|
1383
|
|
|
|
|
|
|
This program is free software; you can redistribute |
|
1384
|
|
|
|
|
|
|
it and/or modify it under the same terms as Perl itself. |
|
1385
|
|
|
|
|
|
|
|
|
1386
|
|
|
|
|
|
|
The full text of the license can be found in the |
|
1387
|
|
|
|
|
|
|
LICENSE file included with this module. |
|
1388
|
|
|
|
|
|
|
|
|
1389
|
|
|
|
|
|
|
Copyright James E Keenan 2017-2025. All rights reserved. |
|
1390
|
|
|
|
|
|
|
|
|
1391
|
|
|
|
|
|
|
=head1 ACKNOWLEDGEMENTS |
|
1392
|
|
|
|
|
|
|
|
|
1393
|
|
|
|
|
|
|
This library's ancestor, Test-Against-Dev, emerged in the wake of the author's |
|
1394
|
|
|
|
|
|
|
participation in the Perl 5 Core Hackathon held in Amsterdam, Netherlands, in |
|
1395
|
|
|
|
|
|
|
October 2017. The author thanks the lead organizers of that event, Sawyer X |
|
1396
|
|
|
|
|
|
|
and Todd Rinaldo, for the invitation to the hackathon. The event could not |
|
1397
|
|
|
|
|
|
|
have happened without the generous contributions from the following companies: |
|
1398
|
|
|
|
|
|
|
|
|
1399
|
|
|
|
|
|
|
=over 4 |
|
1400
|
|
|
|
|
|
|
|
|
1401
|
|
|
|
|
|
|
=item * L |
|
1402
|
|
|
|
|
|
|
|
|
1403
|
|
|
|
|
|
|
=item * L |
|
1404
|
|
|
|
|
|
|
|
|
1405
|
|
|
|
|
|
|
=item * L |
|
1406
|
|
|
|
|
|
|
|
|
1407
|
|
|
|
|
|
|
=item * L |
|
1408
|
|
|
|
|
|
|
|
|
1409
|
|
|
|
|
|
|
=item * L |
|
1410
|
|
|
|
|
|
|
|
|
1411
|
|
|
|
|
|
|
=item * L |
|
1412
|
|
|
|
|
|
|
|
|
1413
|
|
|
|
|
|
|
=back |
|
1414
|
|
|
|
|
|
|
|
|
1415
|
|
|
|
|
|
|
=head2 Additional Contributors |
|
1416
|
|
|
|
|
|
|
|
|
1417
|
|
|
|
|
|
|
=over 4 |
|
1418
|
|
|
|
|
|
|
|
|
1419
|
|
|
|
|
|
|
=item * Mohammad S Anwar |
|
1420
|
|
|
|
|
|
|
|
|
1421
|
|
|
|
|
|
|
=back |
|
1422
|
|
|
|
|
|
|
|
|
1423
|
|
|
|
|
|
|
=head1 SEE ALSO |
|
1424
|
|
|
|
|
|
|
|
|
1425
|
|
|
|
|
|
|
perl(1). CPAN::cpanminus::reporter::RetainReports(3). |
|
1426
|
|
|
|
|
|
|
App::cpanminus::reporter(3). cpanm(3). |
|
1427
|
|
|
|
|
|
|
|
|
1428
|
|
|
|
|
|
|
L<2017 Perl 5 Core Hackathon Discussion on Testing|https://github.com/p5h/2017/wiki/What-Do-We-Want-and-Need-from-Smoke-Testing%3F>. |
|
1429
|
|
|
|
|
|
|
|
|
1430
|
|
|
|
|
|
|
L. |
|
1431
|
|
|
|
|
|
|
|
|
1432
|
|
|
|
|
|
|
=cut |
|
1433
|
|
|
|
|
|
|
|