Add a new method to t/lib/WebGUI/Test.pm to return the path to the test

collateral.
Update all tests to use the new method.
Change testCodebase.pl to run long tests by default.  To disable the
long tests, use the --noLongTests switch.
This commit is contained in:
Colin Kuskie 2006-12-15 23:17:22 +00:00
parent 40e3967b19
commit 9d0894b674
6 changed files with 55 additions and 29 deletions

View file

@ -20,11 +20,13 @@ my $configFile;
my $help;
my $verbose;
my $perlBase;
my $noLongTests;
GetOptions(
'verbose'=>\$verbose,
'configFile=s'=>\$configFile,
'perl-base=s'=>\$perlBase,
'noLongTests'=>\$noLongTests,
'help'=>\$help,
);
@ -43,26 +45,31 @@ my $helpmsg=<<STOP;
use. Defaults to the perl installation in your
PATH.
--noLongTests Prevent long tests from being run
STOP
my $verboseFlag = "-v" if ($verbose);
$perlBase .= '/bin/' if ($perlBase);
if ( $configFile ) {
if (! -e $configFile) {
##Probably given the name of the config file with no path, prepend
##the path to it.
$configFile = File::Spec->canonpath($FindBin::Bin.'/../etc/'.$configFile);
}
if (-e $configFile) {
system("WEBGUI_CONFIG=".$configFile." ".$perlBase."prove ".$verboseFlag." -r ../t");
}
else {
die "Unable to use $configFile as a WebGUI config file\n";
}
} elsif ( defined @ENV{WEBGUI_CONFIG} ) {
system($perlBase."prove ".$verboseFlag." -r ../t");
} else {
print $helpmsg;
##Defaults to command-line switch
$configFile ||= $ENV{WEBGUI_CONFIG};
if (! -e $configFile) {
##Probably given the name of the config file with no path,
##attempt to prepend the path to it.
$configFile = File::Spec->canonpath($FindBin::Bin.'/../etc/'.$configFile);
}
die "Unable to use $configFile as a WebGUI config file\n"
unless(-e $configFile and -f _);
my $prefix = "WEBGUI_CONFIG=".$configFile;
##Run all tests unless explicitly forbidden
$prefix .= " CODE_COP=1" unless $noLongTests;
print(join ' ', $prefix, $perlBase."prove", $verboseFlag, '-r ../t'); print "\n";
system(join ' ', $prefix, $perlBase."prove", $verboseFlag, '-r ../t');