Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I think that running:
drush test-run --all
Should return a non-zero exit code when a test fails that it's testing. I know that the Drupal core run-tests.sh doesn't either, but I still think it's poor form here.
Tools like travis or Jenkins use the exit codes to determine if the test was a success/fail, so at the moment could always think things are working just fine.
Comment | File | Size | Author |
---|---|---|---|
#2 | drush-1802948-non-zero-test-exit.patch | 425 bytes | Steven Jones |
#1 | drush-1802948-non-zero-test-exit.patch | 407 bytes | Steven Jones |
Comments
Comment #1
Steven Jones CreditAttribution: Steven Jones commentedHere's a patch.
Comment #2
Steven Jones CreditAttribution: Steven Jones commentedActually I think that returns the wrong way around.
Comment #3
moshe weitzman CreditAttribution: moshe weitzman commentedNot sure. if you are running with Jenkins, you really shoud use the --xml option which better communicates failures, timing, etc. Any opinions here?
Comment #4
greg.1.anderson CreditAttribution: greg.1.anderson commentedI think that it is most appropriate to return the correct status result code as in #2, even if the same information also appears inside the output produced via the --xml option.
Comment #5
moshe weitzman CreditAttribution: moshe weitzman commentedWith that change, you can't distinguish between a simplet test failure versus test-run itself failing.
Comment #6
greg.1.anderson CreditAttribution: greg.1.anderson commentedIdeally, I would expect that both of those failures would return an error status result, with the more specific error information being included in the output generated with the --xml option (or possibly introduce different status return codes for Drush -- but we've never supported that before). I won't push for a change if the current implementation works better with our existing test harness, though.
Comment #7
alberto56 CreditAttribution: alberto56 commentedExit code 1 will cause the Continuous integration tool to alert the developers that action is required, and we can then dig further to see if it is test-run, or the simpletest tests, or something else.
When the simpletest fails, are there any situations where a normal exit code is required?
(Posting a comment required me to add a version -- I added the latest available)
Comment #8
moshe weitzman CreditAttribution: moshe weitzman commentedcommitted. can't backport as that would change api.
Comment #10
alberto56 CreditAttribution: alberto56 commentedThis still does not work for me, please see https://github.com/drush-ops/drush/issues/212