Skip to content
runtests.pl 28 KiB
Newer Older
# 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);
    $TESTCASES=""; # start with no test cases

    # cut off everything but the digits 
    }
    # the the numbers from low to high
    for(sort { $a <=> $b } @cmds) {
#######################################################################
# Start the command line log
#
open(CMDLOG, ">$CURLLOG") ||
    print "can't log command lines to $CURLLOG\n";

#######################################################################
# The main test-loop
#

Daniel Stenberg's avatar
Daniel Stenberg committed
my $testnum;
foreach $testnum (split(" ", $TESTCASES)) {

    my $serverproblem = serverfortest($testnum);

    if($serverproblem) {
        # there's a problem with the server, don't run
        # this particular server, but count it as "skipped"
        $skipped++;
        next;
    }

    my $error = singletest($testnum);
    if(-1 != $error) {
        # valid test case number
        $total++;
    }
        $failed.= "$testnum ";
        if(!$anyway) {
            # a test failed, abort
            print "\n - abort tests\n";
            last;
        }
#######################################################################
# Close command log
#
close(CMDLOG);

#######################################################################
# Tests done, stop the servers
for(keys %run) {
    stopserver($run{$_}); # the pid file is in the hash table
}
    printf("$ok tests out of $total reported OK: %d%%\n",
           $ok/$total*100);

    if($ok != $total) {
        print "These test cases failed: $failed\n";
    }
if($skipped) {
    print "$skipped tests were skipped due to restraints\n";
if($total && ($ok != $total)) {
    exit 1;
}