]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
tests: limit return code of unit tests and lib tests
authorDan Fandrich <dan@coneharvesters.com>
Fri, 31 Mar 2023 02:13:38 +0000 (19:13 -0700)
committerDan Fandrich <dan@coneharvesters.com>
Fri, 31 Mar 2023 02:16:40 +0000 (19:16 -0700)
Values greater than 125 have special meanings, so cap it there.  Unit
tests and lib tests use the number of failures as the return code, so a
large number of failures (such as test 2601 as a torture test) can
exceed this causing the test to be erroneously reported as having
failed.

Ref: #10720

tests/libtest/first.c

index 932d5bb654aa472930034f32376405ad010d1a65..334ccd92745c6d619a38bdbf7f739af63a988e47 100644 (file)
@@ -188,5 +188,7 @@ int main(int argc, char **argv)
   _flushall();
 #endif
 
-  return result;
+  /* Regular program status codes are limited to 0..127 and 126 and 127 have
+   * special meanings by the shell, so limit a normal return code to 125 */
+  return result <= 125 ? result : 125;
 }