modified the test case success reporting, added "test N out of Y" and

"remaining: [time]" outputs to hint users about what to expect
This commit is contained in:
Daniel Stenberg
2005-04-22 11:51:06 +00:00
parent 78a76dc905
commit b8d7a13ea3

View File

@@ -89,6 +89,7 @@ my $memanalyze="./memanalyze.pl";
my $stunnel = checkcmd("stunnel"); my $stunnel = checkcmd("stunnel");
my $valgrind = checkcmd("valgrind"); my $valgrind = checkcmd("valgrind");
my $start;
my $valgrind_tool; my $valgrind_tool;
if($valgrind) { if($valgrind) {
@@ -959,7 +960,7 @@ sub fixarray {
# #
sub singletest { sub singletest {
my $testnum=$_[0]; my ($testnum, $count, $total)=@_;
my @what; my @what;
my $why; my $why;
@@ -1312,7 +1313,7 @@ sub singletest {
my @err = getpart("verify", "errorcode"); my @err = getpart("verify", "errorcode");
my $errorcode = $err[0] || "0"; my $errorcode = $err[0] || "0";
my $ok="";
my $res; my $res;
if (@validstdout) { if (@validstdout) {
# verify redirected stdout # verify redirected stdout
@@ -1322,9 +1323,10 @@ sub singletest {
if($res) { if($res) {
return 1; return 1;
} }
if(!$short) { $ok .= "s";
print " stdout OK"; }
} else {
$ok .= "-"; # stdout not checked
} }
my %replyattr = getpartattr("reply", "data"); my %replyattr = getpartattr("reply", "data");
@@ -1335,9 +1337,10 @@ sub singletest {
if ($res) { if ($res) {
return 1; return 1;
} }
if(!$short) { $ok .= "d";
print " data OK"; }
} else {
$ok .= "-"; # data not checked
} }
if(@upload) { if(@upload) {
@@ -1347,9 +1350,10 @@ sub singletest {
if ($res) { if ($res) {
return 1; return 1;
} }
if(!$short) { $ok .= "u";
print " upload OK"; }
} else {
$ok .= "-"; # upload not checked
} }
if(@protocol) { if(@protocol) {
@@ -1405,9 +1409,12 @@ sub singletest {
if($res) { if($res) {
return 1; return 1;
} }
if(!$short) {
print " protocol OK"; $ok .= "p";
}
}
else {
$ok .= "-"; # protocol not checked
} }
my @outfile=getpart("verify", "file"); my @outfile=getpart("verify", "file");
@@ -1436,9 +1443,11 @@ sub singletest {
if($res) { if($res) {
return 1; return 1;
} }
if(!$short) {
print " output OK"; $ok .= "o";
} }
else {
$ok .= "-"; # output not checked
} }
# accept multiple comma-separated error codes # accept multiple comma-separated error codes
@@ -1457,9 +1466,7 @@ sub singletest {
if($verbose) { if($verbose) {
print " received exitcode $cmdres OK"; print " received exitcode $cmdres OK";
} }
elsif(!$short) { $ok .= "e";
print " exit OK";
}
} }
else { else {
if(!$short) { if(!$short) {
@@ -1502,12 +1509,14 @@ sub singletest {
return 1; return 1;
} }
else { else {
if(!$short) { $ok .= "m";
print " memory OK";
}
} }
} }
} }
else {
$ok .= "-"; # memory not checked
}
if($valgrind) { if($valgrind) {
# this is the valid protocol blurb curl should generate # this is the valid protocol blurb curl should generate
my @disable= getpart("verify", "valgrind"); my @disable= getpart("verify", "valgrind");
@@ -1536,20 +1545,28 @@ sub singletest {
print @e; print @e;
return 1; return 1;
} }
elsif(!$short) { $ok .= "v";
printf " valgrind OK";
}
} }
else { else {
if(!$short) { if(!$short) {
print " valgrind SKIPPED"; print " valgrind SKIPPED";
} }
$ok .= "-"; # skipped
} }
} }
if($short) { else {
print "OK"; $ok .= "-"; # valgrind not checked
} }
print "\n";
print "$ok " if(!$short);
my $sofar= time()-$start;
my $esttotal = $sofar/$count * $total;
my $estleft = $esttotal - $sofar;
my $left=sprintf("remaining: %dm%ds",
$estleft/60,
$estleft%60);
printf "OK ($count out of $total, %s)\n", $left;
# the test succeeded, remove all log files # the test succeeded, remove all log files
if(!$keepoutfiles) { if(!$keepoutfiles) {
@@ -1936,12 +1953,17 @@ my $testnum;
my $ok=0; my $ok=0;
my $total=0; my $total=0;
my $lasttest; my $lasttest;
my @at = split(" ", $TESTCASES);
my $count;
foreach $testnum (split(" ", $TESTCASES)) { $start = time();
foreach $testnum (@at) {
$lasttest = $testnum if($testnum > $lasttest); $lasttest = $testnum if($testnum > $lasttest);
$count++;
my $error = singletest($testnum); my $error = singletest($testnum, $count, scalar(@at));
if($error < 0) { if($error < 0) {
# not a test we can run # not a test we can run
next; next;
@@ -1992,7 +2014,8 @@ else {
} }
if($all) { if($all) {
print "TESTDONE: $all tests were considered.\n"; my $sofar = time()-$start;
print "TESTDONE: $all tests were considered during $sofar seconds.\n";
} }
if($skipped) { if($skipped) {