Fix exit code handling of only_jctf
We would always unconditionally return 0, making the bots green even on failures
Change-Id: I74e81f9fe88963a16b1e1098f7ba939a56efc19c
diff --git a/tools/test.py b/tools/test.py
index 2815834..e05ad55 100755
--- a/tools/test.py
+++ b/tools/test.py
@@ -253,7 +253,7 @@
if options.only_jctf:
# Note: not setting -Pruntimes will run with all available runtimes.
return_code = gradle.RunGradle(gradle_args, throw_on_failure=False)
- return 0
+ return archive_and_return(return_code)
# Now run tests on selected runtime(s).
vms_to_test = [options.dex_vm] if options.dex_vm != "all" else ALL_ART_VMS
@@ -278,13 +278,17 @@
'gs://r8-test-results/golden-files/' + archive)
if return_code != 0:
- if options.archive_failures and os.name != 'nt':
- archive_failures()
- return return_code
+ return archive_and_return(return_code)
return 0
+def archive_and_return(return_code):
+ if return_code != 0:
+ if options.archive_failures and os.name != 'nt':
+ archive_failures()
+ return return_code
+
def print_jstacks():
processes = subprocess.check_output(['ps', 'aux'])
for l in processes.splitlines():