summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFabian Keil <fk@fabiankeil.de>2012-11-15 15:57:29 +0100
committerDaniel Stenberg <daniel@haxx.se>2021-02-09 00:28:29 +0100
commite6d55f647d0fb11fcd5b7b3de3591e2d7afc9525 (patch)
tree3b28dab800a466342cdc404b4e697b02bf285a17
parent3f0bef2b5303fec1a4b483e65d767205efd481b7 (diff)
downloadcurl-e6d55f647d0fb11fcd5b7b3de3591e2d7afc9525.tar.gz
runtests.pl: cleanups
- show the summarized test result in the last line of the report - do not use $_ after mapping it to a named variable Doing that makes the code harder to follow. - log the restraints sorted by the number of their occurrences - fix language when logging restraints that only occured once - let runhttpserver() use $TESTDIR instead of $srcdir ... so it works if a non-default $TESTDIR is being used.
-rwxr-xr-xtests/runtests.pl63
1 files changed, 36 insertions, 27 deletions
diff --git a/tests/runtests.pl b/tests/runtests.pl
index 8af6bfa97..70eb867cd 100755
--- a/tests/runtests.pl
+++ b/tests/runtests.pl
@@ -1583,7 +1583,7 @@ sub runhttpserver {
} else {
$flags .= "--ipv$ipvnum --port 0 ";
}
- $flags .= "--srcdir \"$srcdir\"";
+ $flags .= "--srcdir \"$TESTDIR/..\"";
my $cmd = "$exe $flags";
my ($httppid, $pid2) = startnew($cmd, $pidfile, 15, 0);
@@ -5957,25 +5957,6 @@ my $all = $total + $skipped;
runtimestats($lasttest);
-if($total) {
- logmsg sprintf("TESTDONE: $ok tests out of $total reported OK: %d%%\n",
- $ok/$total*100);
-
- if($ok != $total) {
- logmsg "\nTESTFAIL: These test cases failed: $failed\n\n";
- }
-}
-else {
- logmsg "\nTESTFAIL: No tests were performed\n\n";
- if(scalar(keys %enabled_keywords)) {
- logmsg "TESTFAIL: Nothing matched these keywords: ";
- for(keys %enabled_keywords) {
- logmsg "$_ ";
- }
- logmsg "\n";
- }
-}
-
if($all) {
logmsg "TESTDONE: $all tests were considered during ".
sprintf("%.0f", $sofar) ." seconds.\n";
@@ -5983,30 +5964,58 @@ if($all) {
if($skipped && !$short) {
my $s=0;
+ # Temporary hash to print the restraints sorted by the number
+ # of their occurences
+ my %restraints;
logmsg "TESTINFO: $skipped tests were skipped due to these restraints:\n";
for(keys %skipped) {
my $r = $_;
- printf "TESTINFO: \"%s\" %d times (", $r, $skipped{$_};
+ my $skip_count = $skipped{$r};
+ my $log_line = sprintf("TESTINFO: \"%s\" %d time%s (", $r, $skip_count,
+ ($skip_count == 1) ? "" : "s");
- # now show all test case numbers that had this reason for being
+ # now gather all test case numbers that had this reason for being
# skipped
my $c=0;
my $max = 9;
for(0 .. scalar @teststat) {
my $t = $_;
- if($teststat[$_] && ($teststat[$_] eq $r)) {
+ if($teststat[$t] && ($teststat[$t] eq $r)) {
if($c < $max) {
- logmsg ", " if($c);
- logmsg $_;
+ $log_line .= ", " if($c);
+ $log_line .= $t;
}
$c++;
}
}
if($c > $max) {
- logmsg " and ".($c-$max)." more";
+ $log_line .= " and ".($c-$max)." more";
}
- logmsg ")\n";
+ $log_line .= ")\n";
+ $restraints{$log_line} = $skip_count;
+ }
+ foreach my $log_line (sort {$restraints{$b} <=> $restraints{$a}} keys %restraints) {
+ logmsg $log_line;
+ }
+}
+
+if($total) {
+ logmsg sprintf("TESTDONE: $ok tests out of $total reported OK: %d%%\n",
+ $ok/$total*100);
+
+ if($ok != $total) {
+ logmsg "\nTESTFAIL: These test cases failed: $failed\n\n";
+ }
+}
+else {
+ logmsg "\nTESTFAIL: No tests were performed\n\n";
+ if(scalar(keys %enabled_keywords)) {
+ logmsg "TESTFAIL: Nothing matched these keywords: ";
+ for(keys %enabled_keywords) {
+ logmsg "$_ ";
+ }
+ logmsg "\n";
}
}