[mobly] Exit non-zero on signals.TestAbortAll Per https://github.com/google/mobly/issues/960 Mobly incorrectly exits either 0 or 1 when a test raises signals.TestAbortAll -- depending on whether any previous tests have failed or not. Instead of exiting 1 in the case of all tests being aborted, like any other failure, exit with a special code. There aren't a lot of standard codes in use, but some internal google docs suggest 40 for generic retryable errors. So use that. Bug: b/425675837 Change-Id: Iae58f6c896df2cc3d93ca9c51a84513dcd82db34 Reviewed-on: https://fuchsia-review.googlesource.com/c/third_party/github.com/google/mobly/+/1312367 Reviewed-by: Prashanth Swaminathan <prashanthsw@google.com>
diff --git a/mobly/test_runner.py b/mobly/test_runner.py index b32f5b0..6b4a2bc 100644 --- a/mobly/test_runner.py +++ b/mobly/test_runner.py
@@ -32,6 +32,9 @@ pass +EXIT_ABORT_ALL = 40 + + def main(argv=None): """Execute the test class in a test module. @@ -79,7 +82,7 @@ runner.run() ok = runner.results.is_all_pass and ok except signals.TestAbortAll: - pass + sys.exit(EXIT_ABORT_ALL) # Exit now, without running any more tests. except Exception: logging.exception('Exception when executing %s.', config.testbed_name) ok = False