From 86742e83345512be14b7ec1f726dc2888e3d862a Mon Sep 17 00:00:00 2001
From: Daniel Stenberg <daniel@haxx.se>
Date: Mon, 27 Jan 2003 13:51:35 +0000
Subject: [PATCH] tests that were not run due to restraints (the netrc-tests)
 were counted as skipped twice, and thus the total number of tests appeared
 wrong

---
 tests/runtests.pl | 29 ++++++++++++++++-------------
 1 file changed, 16 insertions(+), 13 deletions(-)

diff --git a/tests/runtests.pl b/tests/runtests.pl
index 46a7b5c1d0..1e84a5d69f 100755
--- a/tests/runtests.pl
+++ b/tests/runtests.pl
@@ -445,6 +445,15 @@ sub singletest {
         return -1;
     }
 
+    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++;
+        return -1;
+    }
+
     {
         my %hash = getpartattr("client");
         my $requires = $hash{'requires'};
@@ -460,7 +469,7 @@ sub singletest {
             }else {
                 print "$testnum requires $requires, which is not set; skipping\n";
                 $skipped++;
-                return 0;  # look successful
+                return -1;  # return test-not-run
             }
         }
     }
@@ -1042,20 +1051,14 @@ my $total=0;
 
 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++;
+    my $error = singletest($testnum);
+    if(-1 == $error) {
+        # not a test we can run
         next;
     }
 
-    my $error = singletest($testnum);
-    if(-1 != $error) {
-        # valid test case number
-        $total++;
-    }
+    $total++; # number of tests we've run
+
     if($error>0) {
         $failed.= "$testnum ";
         if(!$anyway) {
@@ -1065,7 +1068,7 @@ foreach $testnum (split(" ", $TESTCASES)) {
         }
     }
     elsif(!$error) {
-        $ok++;
+        $ok++; # successful test counter
     }
 
     # loop for next test
-- 
GitLab