runner_stopservers
runner_test_preprocess
runner_test_run
- setlogfunc
+ stderrfilename
+ stdoutfilename
$DBGCURL
$gdb
$gdbthis
my $defpostcommanddelay = 0; # delay between command and postcheck sections
+# redirected stdout/stderr to these files
+sub stdoutfilename {
+ my ($logdir, $testnum)=@_;
+ return "$logdir/stdout$testnum";
+}
+
+sub stderrfilename {
+ my ($logdir, $testnum)=@_;
+ return "$logdir/stderr$testnum";
+}
+
#######################################################################
# Check for a command in the PATH of the machine running curl.
#
}
}
- # redirected stdout/stderr to these files
- $STDOUT="$LOGDIR/stdout$testnum";
- $STDERR="$LOGDIR/stderr$testnum";
-
my @codepieces = getpart("client", "tool");
my $tool="";
if(@codepieces) {
}
else {
$cmdargs = " $cmd"; # $cmd is the command line for the test file
- $CURLOUT = $STDOUT; # sends received data to stdout
+ $CURLOUT = stdoutfilename($LOGDIR, $testnum); # sends received data to stdout
# Default the tool to a unit test with the same name as the test spec
if($keywords{"unittest"} && !$tool) {
$CMDLINE = "$valgrindcmd $CMDLINE";
}
- $CMDLINE .= "$cmdargs >$STDOUT 2>$STDERR";
+ $CMDLINE .= "$cmdargs > " . stdoutfilename($LOGDIR, $testnum) .
+ " 2> " . stderrfilename($LOGDIR, $testnum);
if($verbose) {
logmsg "$CMDLINE\n";
if(!$short) {
logmsg "\n $testnum: $subject FAILED:\n";
- logmsg showdiff($LOGDIR, $firstref, $secondref);
+ my $logdir = getlogdir($testnum);
+ logmsg showdiff($logdir, $firstref, $secondref);
}
elsif(!$automakestyle) {
logmsg "FAILED\n";
}
+#######################################################################
+# Return the log directory for the given test
+# There is only one directory for the moment
+sub getlogdir {
+ my $testnum = $_[0];
+ return $LOGDIR;
+}
+
+
#######################################################################
# Verify that this test case should be run
sub singletest_shouldrun {
return -2;
}
+ my $logdir = getlogdir($testnum);
my @err = getpart("verify", "errorcode");
my $errorcode = $err[0] || "0";
my $ok="";
my @validstdout = getpart("verify", "stdout");
if (@validstdout) {
# verify redirected stdout
- my @actual = loadarray($STDOUT);
+ my @actual = loadarray(stdoutfilename($logdir, $testnum));
foreach my $strip (@stripfile) {
chomp $strip;
my @validstderr = getpart("verify", "stderr");
if (@validstderr) {
# verify redirected stderr
- my @actual = loadarray($STDERR);
+ my @actual = loadarray(stderrfilename($logdir, $testnum));
foreach my $strip (@stripfile) {
chomp $strip;
}
# verify uploaded data
- my @out = loadarray("$LOGDIR/upload.$testnum");
+ my @out = loadarray("$logdir/upload.$testnum");
for my $strip (@strippart) {
chomp $strip;
for(@out) {
if($valgrind) {
if($usedvalgrind) {
- if(!opendir(DIR, "$LOGDIR")) {
- logmsg "ERROR: unable to read $LOGDIR\n";
+ if(!opendir(DIR, "$logdir")) {
+ logmsg "ERROR: unable to read $logdir\n";
# timestamp test result verification end
$timevrfyend{$testnum} = Time::HiRes::time();
return -1;
$timevrfyend{$testnum} = Time::HiRes::time();
return -1;
}
- my @e = valgrindparse("$LOGDIR/$vgfile");
+ my @e = valgrindparse("$logdir/$vgfile");
if(@e && $e[0]) {
if($automakestyle) {
logmsg "FAIL: $testnum - $testname - valgrind\n";
sub singletest {
my ($testnum, $count, $total)=@_;
+ my $logdir = getlogdir($testnum);
+
# first, remove all lingering log files
- if(!cleardir($LOGDIR) && $clearlocks) {
- my $logs = runner_clearlocks($LOGDIR);
+ if(!cleardir($logdir) && $clearlocks) {
+ my $logs = runner_clearlocks($logdir);
logmsg $logs;
- cleardir($LOGDIR);
+ cleardir($logdir);
}
###################################################################
sub displaylogs {
my ($testnum)=@_;
- opendir(DIR, "$LOGDIR") ||
+ my $logdir = getlogdir($testnum);
+ opendir(DIR, "$logdir") ||
die "can't open dir: $!";
my @logs = readdir(DIR);
closedir(DIR);
- logmsg "== Contents of files in the $LOGDIR/ dir after test $testnum\n";
+ logmsg "== Contents of files in the $logdir/ dir after test $testnum\n";
foreach my $log (sort @logs) {
if($log =~ /\.(\.|)$/) {
next; # skip "." and ".."
if(($log eq "memdump") || ($log eq "core")) {
next; # skip "memdump" and "core"
}
- if((-d "$LOGDIR/$log") || (! -s "$LOGDIR/$log")) {
+ if((-d "$logdir/$log") || (! -s "$logdir/$log")) {
next; # skip directory and empty files
}
if(($log =~ /^stdout\d+/) && ($log !~ /^stdout$testnum/)) {
next; # skip test$testnum since it can be very big
}
logmsg "=== Start of file $log\n";
- displaylogcontent("$LOGDIR/$log");
+ displaylogcontent("$logdir/$log");
logmsg "=== End of file $log\n";
}
}