Skip to content
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

Exit status can’t be used to distinguish between tests not passing and other errors #603

Open
Rinzwind opened this issue Aug 6, 2023 · 3 comments

Comments

@Rinzwind
Copy link
Contributor

Rinzwind commented Aug 6, 2023

The exit status of ‘smalltalkci’ is 1 when tests don’t pass:

$ smalltalkci --smalltalk Pharo64-stable .smalltalk.ston; echo Status: $?
[…]
  Executed 64 Tests with 1 Failures and 0 Errors in 0.17s.
[…]
Status: 1

But also when there is some other error, for example:

$ smalltalkci --smalltalk Pharo64-stable .smalltalk.ston; echo Status: $?
[…]
Downloading Pharo64-stable image...
[…]
curl: (6) Could not resolve host: get.pharo.org
curl failed to download get.pharo.org/64/stable […]
Status: 1

So the status can’t be used in scripts to distinguish between these cases. It would be useful to have a status that specifically means the tests didn’t pass.

@fniephaus
Copy link
Member

Good suggestion! Are you aware of any testing framework encoding failure kinds with exit codes? It'd be nice if we could just follow what others have worked out already 🙂

@Rinzwind
Copy link
Contributor Author

Rinzwind commented Aug 6, 2023

I’m not aware of any convention for testing frameworks in particular. More generally, one convention is to use 1 through n for warnings, and anything above n for errors, another is to use 1 for an unspecified failure and anything above for specific failures. Following the first, the status of ‘smalltalkci’ could be 1 to warn that the tests did not pass, and following the second, the status could be 2 to specify its failure is due to the tests not passing.

I’m not sure whether it’d be useful for the status to also distinguish between the tests not passing due to failures, errors, unexpected passes or some combination of these, and whether it would make sense to also use a non-zero status to warn that the tests passed but that some of them were skipped or declared as an expected failure. The latter would probably have to be introduced as an option to ‘smalltalkci’ to not break existing uses. The status could be say 6 or greater if there was an error in ‘smalltalkci’ itself, else 5 if some tests had an error, else 4 if some tests failed, else 3 if some unexpectedly passed, else 2 if some were declared as expected failures, else 1 if some were skipped, else 0.

@fniephaus
Copy link
Member

Yes, something like this sounds reasonable. Maybe we leave some sort of gap between the codes, so that we can add more in the future, but that's something we can discuss in the actual implementation. I'm afraid I don't have any time to work on it myself, but I can help review if someone is willing to take a look.

Fun fact: AmigaOS uses these four exit code:

OK 0
WARN 5
ERROR 10
FAILURE 20

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants