tests: limit return code of unit tests and lib tests

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
This commit is contained in:
Dan Fandrich 2023-03-30 19:13:38 -07:00
parent 9fa018dbf7
commit 2dd471d577

View 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;
}