Upgrade Notice

The CPAN Testers Wiki site has been upgraded since you last accessed the site. Please press the F5 key or CTRL-R to refresh your browser cache to use the latest javascript and CSS files.

CPAN::Reporter::Smoker (Detailed Guide)

CPAN-Reporter-Smoker is a new smoke test program built upon CPAN and CPAN::Reporter that offers near-turnkey smoke testing. For a quick setup, please see the Quick Guide, however, this guide looks at building the environment and configuring CPAN-Reporter-Smoker in a little more detail. This guide was written by JJ, published with permission.

CPAN Testers setup with Perl 5.8.2

The Environment

Output of "perl -V":

Summary of my perl5 (revision 5.0 version 8 subversion 2) configuration:
  Platform:
    osname=darwin, osvers=7.9.0, archname=darwin-2level
    uname='darwin peladon.local 7.9.0 darwin kernel version 7.9.0: wed mar 30 20:11:17 pst 2005; 
           root:xnuxnu-517.12.7.obj~1release_ppc power macintosh powerpc '
    config_args='-de -Dprefix=/Users/jj/perl/perl-5.8.2'
    hint=recommended, useposix=true, d_sigaction=define
    usethreads=undef use5005threads=undef useithreads=undef usemultiplicity=undef
    useperlio=define d_sfio=undef uselargefiles=define usesocks=undef
    use64bitint=undef use64bitall=undef uselongdouble=undef
    usemymalloc=n, bincompat5005=undef
  Compiler:
    cc='cc', ccflags ='-pipe -fno-common -DPERL_DARWIN -no-cpp-precomp -fno-strict-aliasing',
    optimize='-Os',
    cppflags='-no-cpp-precomp -pipe -fno-common -DPERL_DARWIN -no-cpp-precomp -fno-strict-aliasing'
    ccversion='', gccversion='3.3 20030304 (Apple Computer, Inc. build 1666)', gccosandvers=''
    intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=4321
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=8
    ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
    alignbytes=8, prototype=define
  Linker and Libraries:
    ld='env MACOSX_DEPLOYMENT_TARGET=10.3 cc', ldflags =''
    libpth=/usr/lib
    libs=-ldbm -ldl -lm -lc
    perllibs=-ldl -lm -lc
    libc=/usr/lib/libc.dylib, so=dylib, useshrplib=false, libperl=libperl.a
    gnulibc_version=''
  Dynamic Linking:
    dlsrc=dl_dyld.xs, dlext=bundle, d_dlsymun=undef, ccdlflags=' '
    cccdlflags=' ', lddlflags=' -bundle -undefined dynamic_lookup'

Characteristics of this binary (from libperl):

Compile-time options: USE_LARGE_FILES
Built under darwin
Compiled at May  6 2008 13:13:15
@INC:
  /Users/jj/perl/perl-5.8.2/lib/5.8.2/darwin-2level
  /Users/jj/perl/perl-5.8.2/lib/5.8.2
  /Users/jj/perl/perl-5.8.2/lib/site_perl/5.8.2/darwin-2level
  /Users/jj/perl/perl-5.8.2/lib/site_perl/5.8.2
  /Users/jj/perl/perl-5.8.2/lib/site_perl
  .

Installation Steps

  • Create CPAN build directory
peladon:~ jj$ mkdir /Users/jj/perl/perl-5.8.2/cpan
  • Run CPAN.pm setup
peladon:~ jj$ /Users/jj/perl/perl-5.8.2/bin/perl -MCPAN -eshell
  • Accept all defaults apart from the following:
 CPAN build and cache directory? [/Users/jj/.cpan] /Users/jj/perl/perl-5.8.2/cpan
  • Set CPAN URL to local mirror (note this needs to be a CPAN::Mini::Devel mirror to include development versions of modules):
 cpan> o conf urllist = file:///Users/jj/cpan

cpan> o conf commit commit: wrote /Users/jj/perl/perl-5.8.2/lib/5.8.2/CPAN/Config.pm
  • QUIT AND RESTART CPAN
  • Install latest version of CPAN
cpan> install CPAN
  • QUIT AND RESTART CPAN

CPAN will ask some new configuration questions - accept the defaults and commit the new config

cpan[1]> o conf commit
commit: wrote '/Users/jj/perl/perl-5.8.2/lib/5.8.2/CPAN/Config.pm'
  • Install toolchain modules
cpan[1]> install ExtUtils::CBuilder
cpan[2]> install Module::Build
cpan[3]> install Archive::Tar
cpan[4]> install YAML
cpan[5]> install YAML::Syck
cpan[6]> install Test::Pod
cpan[7]> install Test::Pod::Coverage
cpan[8]> install Digest::SHA
cpan[9]> install version
  • Install Task::CPAN::Reporter and CPAN::Reporter::Smoker
cpan[12]> install Task::CPAN::Reporter 
cpan[13]> install CPAN::Reporter::Smoker
  • Set CPAN prefs directory
cpan[15]> o conf init prefs_dir

The following questions are intended to help you with the configuration. The CPAN module needs a directory of its own to cache important index files and maybe keep a temporary mirror of CPAN files. This may be a site-wide or a personal directory.
CPAN.pm can store customized build environments based on regular expressions for distribution names. These are YAML files where the default options for CPAN.pm and the environment can be overridden and dialog sequences can be stored that can later be executed by an Expect.pm object. The CPAN.pm distribution comes with some prefab YAML files that cover sample distributions that can be used as blueprints to store one own prefs. Please check out the distroprefs/ directory of the CPAN.pm distribution to get a quick start into the prefs system.
<prefs_dir> Directory where to store default options/environment/dialogs for building modules that need some customization? [/Users/jj/perl/perl-5.8.2/cpan/prefs]
Please remember to call 'o conf commit' to make the config permanent!
cpan[16]> o conf commit commit: wrote '/Users/jj/perl/perl-5.8.2/lib/5.8.2/CPAN/Config.pm'

Configuration Steps

  • Configure CPAN::Reporter
cpan[20]> o conf init test_report

Email test reports if CPAN::Reporter is installed (yes/no)? [no] yes
cpan[22]> o conf commit commit: wrote '/Users/jj/perl/perl-5.8.2/lib/5.8.2/CPAN/Config.pm'
peladon:~/perl/perl-5.8.2 jj$ vi ~/.cpanreporter/config.ini cc_author=default:no fail:yes command_timeout=1000 edit_report=default:ask/no pass/na:no email_from="JJ" send_report=default:ask/yes pass/na:yes fail:yes
  • Create CPAN prefs directory
peladon:~ jj$ mkdir /Users/jj/perl/perl-5.8.2/cpan/prefs
  • Create disabled.yml in prefs dir (~/perl-5.8.2/cpan/prefs/disabled.yml)
  • Start CPAN::Reporter::Smoker
peladon:~/perl/perl-5.8.2 jj$ nohup /Users/jj/perl/perl-5.8.2/bin/perl -MCPAN::Reporter::Smoker -e start & [1] 16042
peladon:~/perl/perl-5.8.2 jj$ sending output to nohup.out

peladon:~/perl/perl-5.8.2 jj$ tail -f nohup.out Starting CPAN::Reporter::Smoker

Conclusion

In many instances the turnkey approach should work for existing environments, however if you have a fresh build, or get stuck with anything, the above guide will hopefully provide you with a means to iron out any installation or configuration issues.

Comments

Great write up! I want to add a comment about distroprefs. One of the more annoying parts of automated smoke testing is periodically having to break out of some test that hung. Adding those things to distroprefs prevents them from hanging things up the next time.

My philosophy has been to just disable everything that hangs, prompts, or whatever. (A more sophisticated approach would use distroprefs to answer prompts and so on.) If the disabling approach seems useful, I publish my distroprefs in a git repository and people are welcome to use it. I disable a lot of stuff, so this approach may not be for everyone.

-- dagolden