The document provides a brief history of testing on CPAN from 1987 to the present. It discusses the development of the Test Anything Protocol (TAP) and CPAN Testers for testing Perl modules. It then proposes the idea of CPANci, a continuous integration system for all of CPAN that would test each distribution in isolation on virtualized environments to avoid issues with CPAN Testers. The document outlines an approach using perlbrew and cpanminus to test each distribution on fresh Perl installations of different versions.
14. The Test Anything Protocol
1..42
ok 1 the thing looks good!
ok 2
ok 3 $beer isa $drink
not ok 4 too much $beer
not ok 5 $me->vomit( 'now' )
...
Tuesday, June 4, 13
73. Stupid Question No. 3
How can we test CPAN without the
disadvantages of CPAN Testers?
Tuesday, June 4, 13
74. Postulate:
Every CPAN distribution must be tested in isolation, on a
virgin Perl installation untouched by human hands.
Tuesday, June 4, 13
75. Postulate:
Every CPAN distribution must be tested in isolation, on a
virgin Perl installation untouched by human hands.
So how do we do that?
Tuesday, June 4, 13
83. •Create an EC2 image
•Put perlbrew on it
Tuesday, June 4, 13
84. •Create an EC2 image
•Put perlbrew on it
•Install every Perl locally
Tuesday, June 4, 13
85. •Create an EC2 image
•Put perlbrew on it
•Install every Perl locally
•Boot an instance for every uploaded
distribution
Tuesday, June 4, 13
86. •Create an EC2 image
•Put perlbrew on it
•Install every Perl locally
•Boot an instance for every uploaded
distribution
•Install needed dependencies for the
distribution
Tuesday, June 4, 13
87. •Create an EC2 image
•Put perlbrew on it
•Install every Perl locally
•Boot an instance for every uploaded
distribution
•Install needed dependencies for the
distribution
•Run the tests and report the results
Tuesday, June 4, 13
88. •Create an EC2 image
•Put perlbrew on it
•Install every Perl locally
•Boot an instance for every uploaded
distribution
•Install needed dependencies for the
distribution
•Run the tests and report the results
•Shut down the instance
Tuesday, June 4, 13
100. App::cpanminus
That means the same cpanm can be run by any perl
perlbrew switch master
curl -L http://cpanmin.us/ | perl - App::cpanminus
ln -s ~/perl5/perlbrew/perls/master/bin/cpanm ./cpanm
~/perl5/perlbrew/perls/perl-5.8.9/bin/perl cpanm
~/perl5/perlbrew/perls/perl-5.10.1/bin/perl cpanm
~/perl5/perlbrew/perls/perl-5.12.5/bin/perl cpanm
~/perl5/perlbrew/perls/perl-5.14.4/bin/perl cpanm
~/perl5/perlbrew/perls/perl-5.16.3/bin/perl cpanm
~/perl5/perlbrew/perls/perl-5.18.0/bin/perl cpanm
~/perl5/perlbrew/perls/perl-5.19.0/bin/perl cpanm
Tuesday, June 4, 13
103. •Use perlbrew to install a "master" perl
•Use it again to install "virgin" perls of every
major version
Tuesday, June 4, 13
104. •Use perlbrew to install a "master" perl
•Use it again to install "virgin" perls of every
major version
•Use the master perl to install everything
from CPAN that makes CPANci work
Tuesday, June 4, 13
105. •Use perlbrew to install a "master" perl
•Use it again to install "virgin" perls of every
major version
•Use the master perl to install everything
from CPAN that makes CPANci work
•For each distribution, create a temp
directory
Tuesday, June 4, 13
106. •Use perlbrew to install a "master" perl
•Use it again to install "virgin" perls of every
major version
•Use the master perl to install everything
from CPAN that makes CPANci work
•For each distribution, create a temp
directory
•Tell cpanminus to install dependencies
there, as if for local::lib
Tuesday, June 4, 13
107. •Use perlbrew to install a "master" perl
•Use it again to install "virgin" perls of every
major version
•Use the master perl to install everything
from CPAN that makes CPANci work
•For each distribution, create a temp
directory
•Tell cpanminus to install dependencies
there, as if for local::lib
•Run tests and report results
Tuesday, June 4, 13
108. •Use perlbrew to install a "master" perl
•Use it again to install "virgin" perls of every
major version
•Use the master perl to install everything
from CPAN that makes CPANci work
•For each distribution, create a temp
directory
•Tell cpanminus to install dependencies
there, as if for local::lib
•Run tests and report results
•Delete temp directory, leaving each perl
untouched!
Tuesday, June 4, 13
109. What does that look like?
The "fetcher" grabs the latest distribution URLs from
MetaCPAN's RSS feed.
Tuesday, June 4, 13
110. What does that look like?
We retrieve the distribution metadata from
the MetaCPAN JSON API and saved it to
MongoDB.
Then we start the Installer.
Tuesday, June 4, 13
111. What does that look like?
We download the distribution tarball to a temp file.
Then the fun stuff starts to happen.
Tuesday, June 4, 13
112. What does that look like?
We extract the archive in a specific "work" directory
for each perl.
Then create a temp directory for building and installing
dependencies.
Tuesday, June 4, 13
113. What does that look like?
Use a specific perl binary to run cpanm and
install dependencies, with no tests, to the temp
directory.
Then we parse the cpanm log on stderr
Tuesday, June 4, 13
114. What does that look like?
"deps" : {
"log" : [
{
"indent" : 0,
"type" : "working-on",
"line" : "--> Working on .n"
},
{
"line" : "Configuring Lingua-EN-NamedEntity-1.92 ... OKn",
"type" : "config",
"indent" : 1
},
{
"type" : "found-deps",
"indent" : 1,
"line" : "==> Found dependencies: Lingua::Stem::En, DB_File, LWP::Simplen"
},
{
"indent" : 1,
"type" : "working-on",
"line" : "--> Working on Lingua::Stem::Enn"
},
{
"indent" : 2,
"type" : "fetch",
"line" : "Fetching http://www.cpan.org/authors/id/S/SN/SNOWHARE/Lingua-
Stem-0.84.tar.gz ... OKn"
},
Tuesday, June 4, 13
115. What does that look like?
Use a specific perl to run each test file,
save the TAP output and any errors, and
use the exit status to determine if it passed.
Tuesday, June 4, 13
116. What does that look like?
Parse the TAP output of each test into a
structure which can be saved in MongoDB
Tuesday, June 4, 13
127. The future?
•Integration with Pinto
•Integration with Stratopan
•All kinds of cool statistics on the website
Tuesday, June 4, 13
128. The future?
•Integration with Pinto
•Integration with Stratopan
•All kinds of cool statistics on the website
•Organizations using CPANci for their
internal DarkPANs
Tuesday, June 4, 13