-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug: Abuse of the exit code #1146
Comments
There are basically three points in this
This one I agree with, but because of backward compatibility is very likely here to stay.
This one I don't agree with. Tests failing is an error. If you care that you cannot tell whether you have XYZ failing tests or are leaking memory, you care about the wrong problem.
Blame POSIX. Both Anyway, 1) and 2) can be easily solved by defining your own main function, that returns different exit codes. |
FTR I agree with everything @horenmar says. WRT (1) it was a case of "seemed like a good idea at the time". And finally I'll add that (3) can also be addressed by providing your own |
Returning nonzero when tests fail is very useful (I'd say required) when running tests from a build system. |
The return value is clamped to 255 - so if 256 tests fail the return value will be 255. It won't look like success. |
- don't warn on zero return code of --list-reporters - previously return code was the number of reporters (catchorg#1410, catchorg#1146) - as of 2c06ee9 return code is zero on success
I agree with the thread starter. For me, I run the tests in a powershell script, which ofc should handle exceptions of other calls. A failed test case is not the same a failed execution error (e.g. calling the catch2 with an invalid argument). However, as far as I noticed, a script error will always return exit code 255? If so, I have to hope that there is no unit test with 255 test cases. |
Description
It is nasty to abuse exit codes in environment where exit codes are specifically for errors.
It doesn't compose or play well with every other command line tools.
If you need to count things, have '--count' flag (e.g, git) that reports to stdout.
It doesn't seem to be documented currently,
but exit codes are limited in range to MaxExitCode (=255).
This is just another smell.
Steps to reproduce
or
Extra information
The text was updated successfully, but these errors were encountered: