Skip to content

Instantly share code, notes, and snippets.

@Woody2143
Created November 13, 2012 18:57
Show Gist options
  • Save Woody2143/4067672 to your computer and use it in GitHub Desktop.
Save Woody2143/4067672 to your computer and use it in GitHub Desktop.
Devel::Cover, Testing and Taint Mode
[user@host dev]$ cover -test
Deleting database /var/www/html/dev/cover_db
cover: running make test "OPTIMIZE=-O0 -fprofile-arcs -ftest-coverage" "OTHERLDFLAGS=-fprofile-arcs -ftest-coverage"
PERL_DL_NONLAZY=1 /opt/perlbrew/perls/cgitools/bin/perl "-MExtUtils::Command::MM" "-e" "test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
t/taint.t .. Devel::Cover: Error getting @INC: Insecure dependency in `` while running with -T switch at /opt/perlbrew/perls/cgitools/lib/site_perl/5.14.2/x86_64-linux/Devel/Cover.pm line 125.
Reverting to default value for Inc.
t/taint.t .. ok
All tests successful.
Files=1, Tests=2, 0 wallclock secs ( 0.03 usr 0.01 sys + 0.28 cusr 0.02 csys = 0.34 CPU)
Result: PASS
Reading database from /var/www/html/dev/cover_db
---------------------------- ------ ------ ------ ------ ------ ------ ------
File stmt bran cond sub pod time total
---------------------------- ------ ------ ------ ------ ------ ------ ------
Total n/a n/a n/a n/a n/a n/a n/a
---------------------------- ------ ------ ------ ------ ------ ------ ------
HTML output written to /var/www/html/dev/cover_db/coverage.html
done.
[user@host dev]$
[user@host dev]$ perl -V
Summary of my perl5 (revision 5 version 14 subversion 2) configuration:
Platform:
osname=linux, osvers=2.6.18-194.3.1.el5, archname=x86_64-linux
uname='linux host 2.6.18-194.3.1.el5 #1 smp thu may 13 13:08:30 edt 2010 x86_64 x86_64 x86_64 gnulinux '
config_args='-de -Dprefix=/opt/perlbrew/perls/cdrtools'
hint=recommended, useposix=true, d_sigaction=define
useithreads=undef, usemultiplicity=undef
useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef
use64bitint=define, use64bitall=define, uselongdouble=undef
usemymalloc=n, bincompat5005=undef
Compiler:
cc='cc', ccflags ='-fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64',
optimize='-O2',
cppflags='-fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include'
ccversion='', gccversion='4.1.2 20080704 (Red Hat 4.1.2-48)', gccosandvers=''
intsize=4, longsize=8, ptrsize=8, doublesize=8, byteorder=12345678
d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16
ivtype='long', ivsize=8, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
alignbytes=8, prototype=define
Linker and Libraries:
ld='cc', ldflags =' -fstack-protector -L/usr/local/lib'
libpth=/usr/local/lib /lib /usr/lib /lib64 /usr/lib64 /usr/local/lib64
libs=-lnsl -ldl -lm -lcrypt -lutil -lc
perllibs=-lnsl -ldl -lm -lcrypt -lutil -lc
libc=/lib/libc-2.5.so, so=so, useshrplib=false, libperl=libperl.a
gnulibc_version='2.5'
Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E'
cccdlflags='-fPIC', lddlflags='-shared -O2 -L/usr/local/lib -fstack-protector'
Characteristics of this binary (from libperl):
Compile-time options: PERL_DONT_CREATE_GVSV PERL_MALLOC_WRAP
PERL_PRESERVE_IVUV USE_64_BIT_ALL USE_64_BIT_INT
USE_LARGE_FILES USE_PERLIO USE_PERL_ATOF
Built under linux
Compiled at Oct 21 2011 00:07:22
%ENV:
PERLBREW_BASHRC_VERSION="0.30"
PERLBREW_HOME="/home/user/.perlbrew"
PERLBREW_PATH="/opt/perlbrew/bin:/opt/perlbrew/perls/cgitools/bin"
PERLBREW_PERL="cgitools"
PERLBREW_ROOT="/opt/perlbrew"
PERLBREW_VERSION="0.30"
@INC:
/opt/perlbrew/perls/cgitools/lib/site_perl/5.14.2/x86_64-linux
/opt/perlbrew/perls/cgitools/lib/site_perl/5.14.2
/opt/perlbrew/perls/cgitools/lib/5.14.2/x86_64-linux
/opt/perlbrew/perls/cgitools/lib/5.14.2
.
[user@host dev]$ prove -Tv t/taint.t
t/taint.t ..
1..2
ok 1 - Taint Checking Enabled
ok 2 - $date is tainted!
ok
All tests successful.
Files=1, Tests=2, 0 wallclock secs ( 0.04 usr 0.01 sys + 0.02 cusr 0.00 csys = 0.07 CPU)
Result: PASS
#!/opt/perlbrew/perls/cgitools/bin/perl -T
use Modern::Perl;
use Test::More tests => 2;
use Test::Taint;
taint_checking_ok('Taint Checking Enabled');
# Verify that taint checking works
my $date = '2012-11-12';
taint( $date );
tainted_ok( $date, '$date is tainted!' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment