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.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Steven Jones’s picture

Assigned: Steven Jones » Unassigned
Status: Active » Needs review
FileSize
407 bytes

Here's a patch.

Steven Jones’s picture

Actually I think that returns the wrong way around.

moshe weitzman’s picture

Assigned: Unassigned » msonnabaum

Not sure. if you are running with Jenkins, you really shoud use the --xml option which better communicates failures, timing, etc. Any opinions here?

greg.1.anderson’s picture

I 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.

moshe weitzman’s picture

With that change, you can't distinguish between a simplet test failure versus test-run itself failing.

greg.1.anderson’s picture

Ideally, 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.

alberto56’s picture

Version: » 8.x-6.x-dev

you can't distinguish between a simpletest failure versus test-run itself failing.

Exit 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)

moshe weitzman’s picture

Status: Needs review » Fixed

committed. can't backport as that would change api.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

alberto56’s picture

This still does not work for me, please see https://github.com/drush-ops/drush/issues/212