#!/usr/bin/perl -w use strict; use Test::Harness; use Getopt::Long; use Pod::Usage; my (@exclude,@include); GetOptions( 'help|?' => sub { pod2usage(-verbose => 2); exit }, 'verbose!' => \$Test::Harness::verbose, 'quiet' => sub { $Test::Harness::verbose = 0 }, 'include=s' => \@include, 'exclude=s' => \@exclude ); @include = map { glob } @include; @exclude = map { glob } @exclude; BEGIN { chdir 't' if -d 't'; } my @files = @include; unless (@files) { @files = glob "*.t"; } my @tests; foreach my $file ( sort @files ) { push @tests => $file unless grep { /\Q$file\E/ } @exclude; } runtests( @tests ); __END__ =head1 NAME testall -- A test harness utility =head1 SYNOPSIS B for more information testall [options] Options: --help Display POD --? Same as --help --verbose Display standard output of test scripts while running them. --noverbose Turn off --verbose (default Test::Harness behavior) --quiet Same as --noverbose --include Tests to include --exclude Tests to exclude =head1 OVERVIEW This program uses C to run the results of a test suite. With no arguments, it will run all tests in the current directory (assumes test have a C<.t> extension). Shell metacharacters may be used with command lines options and will be exanded via C. =head1 COMMAND LINE OPTIONS Note that all options may be specified with a single dash and the first letter of the option. =head2 --include Use this to specify which files will be run as tests. If used, only files specified with C<--include> will be run. testall -i 02saleitem.t -i 02saletax.t -i 02saletender.t The above may be written as (note the quotes): testall -i '02sale*.t' =head2 --exclude Use this switch to specify which files will not be run as tests. If used, the program assumes all files ending in C<.t> are tests and will skip those that match C<--exclude>. To run all tests but exclude the tests used in the previous example: testall -e 02saleitem.t -e 02saletax.t -e 02saletender.t The above may be written as: testall -e '02sale*' The C<--exclude> and C<--include> options may be combined. To run all tests containing the word 'product' in the filename, but skip 'productfinal.t': testall -i '*product*.t' -e productfinal.t