Newer
Older
#######################################################################
# Output curl version and host info being tested
#
if(!$listonly) {
displaydata();
}
#######################################################################
# clear and create logging directory:
cleardir($LOGDIR);
mkdir($LOGDIR, 0777);
#######################################################################
# If 'all' tests are requested, find out all test numbers
#
if ( $TESTCASES eq "all") {
# Get all commands and find out their test numbers
opendir(DIR, $TESTDIR) || die "can't opendir $TESTDIR: $!";
my @cmds = grep { /^test([0-9]+)$/ && -f "$TESTDIR/$_" } readdir(DIR);
closedir DIR;
$TESTCASES=""; # start with no test cases
# cut off everything but the digits
for(@cmds) {
$_ =~ s/[a-z\/\.]*//g;
}
# the the numbers from low to high
for(sort { $a <=> $b } @cmds) {
$TESTCASES .= " $_";
}
#######################################################################
# Start the command line log
#
open(CMDLOG, ">$CURLLOG") ||
print "can't log command lines to $CURLLOG\n";
#######################################################################
# The main test-loop
#
my $ok=0;
my $total=0;
foreach $testnum (split(" ", $TESTCASES)) {
my $error = singletest($testnum);
if(-1 == $error) {
# not a test we can run
$total++; # number of tests we've run
if($error>0) {
if(!$anyway) {
# a test failed, abort
print "\n - abort tests\n";
last;
}
elsif(!$error) {
$ok++; # successful test counter
#######################################################################
# Close command log
#
close(CMDLOG);
#######################################################################
# Tests done, stop the servers
for(keys %run) {
stopserver($run{$_}); # the pid file is in the hash table
}
if($total) {
printf("TESTDONE: $ok tests out of $total reported OK: %d%%\n",
if($ok != $total) {
print "TESTFAIL: These test cases failed: $failed\n";
}
else {
print "TESTFAIL: No tests were performed!\n";
print "TESTINFO: $skipped tests were skipped due to restraints\n";
if($total && ($ok != $total)) {
exit 1;
}