#!/import/archperf/ws/devtools/4/v8plus/bin/perl
eval 'exec /import/archperf/ws/devtools/4/v8plus/bin/perl -S $0 ${1+"$@"}'
if $running_under_some_shell;
# Allow cuddling the paths with the -I
@ARGV = map { /^(-I)(.+)/ ? ($1,$2) : $_ } @ARGV;
# Stick any default switches at the beginning, so they can be overridden
# by the command line switches.
unshift @ARGV, split( " ", $ENV{PROVE_SWITCHES} ) if defined $ENV{PROVE_SWITCHES};
Getopt::Long::Configure( "no_ignore_case" );
Getopt::Long::Configure( "bundling" );
'd|debug' => \$Test::Harness::debug,
'h|help|?' => sub {pod2usage({-verbose => 1}); exit},
'H|man' => sub {pod2usage({-verbose => 2}); exit},
'r|recurse' => \$recurse,
's|shuffle' => \$shuffle,
't' => sub { unshift @switches, "-t" }, # Always want -t up front
'T' => sub { unshift @switches, "-T" }, # Always want -T up front
'timer' => \$Test::Harness::Timer,
'v|verbose' => \$Test::Harness::verbose,
'V|version' => sub { print_version(); exit; },
$ENV{TEST_VERBOSE} = 1 if $Test::Harness::verbose;
# Build up extensions regex
@ext = map { split /,/ } @ext;
@ext = ("t") unless @ext;
my $ext_regex = join( "|", map { quotemeta } @ext );
$ext_regex = qr/\.($ext_regex)$/;
my @blibdirs = blibdirs();
unshift @includes, @blibdirs;
warn "No blib directories found.\n";
unshift @includes, "lib";
push( @switches, map { /\s/ && !/^".*"$/ ? qq["-I$_"] : "-I$_" } @includes );
$Test::Harness::Switches = join( " ", @switches );
print "# \$Test::Harness::Switches: $Test::Harness::Switches\n" if $Test::Harness::debug;
@ARGV = File::Spec->curdir unless @ARGV;
push( @tests, -d $_ ? all_in( $_ ) : $_ ) for map { glob } @ARGV;
shuffle(@tests) if $shuffle;
print join( "\n", @tests, "" );
print "# ", scalar @tests, " tests to run\n" if $Test::Harness::debug;
if ( opendir( DH, $start ) ) {
my @files = sort readdir DH;
for my $file ( @files ) {
next if $file eq File::Spec->updir || $file eq File::Spec->curdir;
my $currfile = File::Spec->catfile( $start, $file );
push( @hits, all_in( $currfile ) ) if $recurse;
push( @hits, $currfile ) if $currfile =~ $ext_regex;
printf( "prove v%s, using Test::Harness v%s and Perl v%vd\n",
$VERSION, $Test::Harness::VERSION, $^V );
# Stolen directly from blib.pm
my $dir = File::Spec->curdir;
($dir = VMS::Filespec::unixify($dir)) =~ s-/\z--;
# Double up the MP::A so that it's not used only once.
$archdir = $MacPerl::Architecture = $MacPerl::Architecture;
my $blib = File::Spec->catdir( $dir, "blib" );
my $blib_lib = File::Spec->catdir( $blib, "lib" );
my $blib_arch = File::Spec->catdir( $blib, $archdir );
if ( -d $blib && -d $blib_arch && -d $blib_lib ) {
return ($blib_arch,$blib_lib);
$dir = File::Spec->catdir($dir, File::Spec->updir);
warn "$0: Cannot find blib\n";
prove -- A command-line tool for running tests against Test::Harness
prove [options] [files/directories]
-b, --blib Adds blib/lib to the path for your tests, a la "use blib".
-d, --debug Includes extra debugging information.
-D, --dry Dry run: Show the tests to run, but don't run them.
--ext=x Extensions (defaults to .t)
-h, --help Display this help
-H, --man Longer manpage for prove
-I Add libraries to @INC, as Perl's -I
-l, --lib Add lib to the path for your tests.
-r, --recurse Recursively descend into directories.
-s, --shuffle Run the tests in a random order.
-T Enable tainting checks
-t Enable tainting warnings
--timer Print elapsed time after each test file
-v, --verbose Display standard output of test scripts while running them.
-V, --version Display version info
Single-character options may be stacked. Default options may be set by
specifying the PROVE_SWITCHES environment variable.
F<prove> is a command-line interface to the test-running functionality
of C<Test::Harness>. With no arguments, it will run all tests in the
Shell metacharacters may be used with command lines options and will be exanded
=head1 PROVE VS. "MAKE TEST"
F<prove> has a number of advantages over C<make test> when doing development.
=item * F<prove> is designed as a development tool
Perl users typically run the test harness through a makefile via
C<make test>. That's fine for module distributions, but it's
suboptimal for a test/code/debug development cycle.
=item * F<prove> is granular
F<prove> lets your run against only the files you want to check.
Running C<prove t/live/ t/master.t> checks every F<*.t> in F<t/live>,
=item * F<prove> has an easy verbose mode
F<prove> has a C<-v> option to see the raw output from the tests.
To do this with C<make test>, you must set C<HARNESS_VERBOSE=1> in
=item * F<prove> can run under taint mode
F<prove>'s C<-T> runs your tests under C<perl -T>, and C<-t> runs them
=item * F<prove> can shuffle tests
You can use F<prove>'s C<--shuffle> option to try to excite problems
that don't show up when tests are run in the same order every time.
=item * F<prove> doesn't rely on a make tool
Not everyone wants to write a makefile, or use L<ExtUtils::MakeMaker>
to do so. F<prove> has no external dependencies.
=item * Not everything is a module
More and more users are using Perl's testing tools outside the
context of a module distribution, and may not even use a makefile
=head1 COMMAND LINE OPTIONS
Adds blib/lib to the path for your tests, a la "use blib".
Include debug information about how F<prove> is being run. This
option doesn't show the output from the test scripts. That's handled
Dry run: Show the tests to run, but don't run them.
Specify extensions of the test files to run. By default, these are .t,
but you may have other non-.t test files, most likely .sh shell scripts.
Add libraries to @INC, as Perl's -I.
Add C<lib> to @INC. Equivalent to C<-Ilib>.
Descends into subdirectories of any directories specified, looking for tests.
Sometimes tests are accidentally dependent on tests that have been
run before. This switch will shuffle the tests to be run prior to
running them, thus ensuring that hidden dependencies in the test
order are likely to be revealed. The author hopes the run the
algorithm on the preceding sentence to see if he can produce something
Runs test programs under perl's -t taint warning mode.
Runs test programs under perl's -T taint mode.
Print elapsed time after each test file
Display standard output of test scripts while running them. Also sets
TEST_VERBOSE in case your tests rely on them.
Please use the CPAN bug ticketing system at L<http://rt.cpan.org/>.
You can also mail bugs, fixes and enhancements to
C<< <bug-test-harness@rt.cpan.org> >>.
Shuffled tests must be recreatable
Andy Lester C<< <andy@petdance.com> >>
Copyright 2005 by Andy Lester C<< <andy@petdance.com> >>.
This program is free software; you can redistribute it and/or
modify it under the same terms as Perl itself.
See L<http://www.perl.com/perl/misc/Artistic.html>.