Commit 2bac24fe authored by Sergiy Byelozyorov's avatar Sergiy Byelozyorov Committed by Commit Bot

[tools] Report infra failure on incorrect usage or uncaptured exceptions

TBR=machenbach@chromium.org

No-Try: true
Bug: chromium:893464
Change-Id: If7d9f839a715468ded293a488e7fa12fc4ef3347
Reviewed-on: https://chromium-review.googlesource.com/c/1270995
Commit-Queue: Sergiy Byelozyorov <sergiyb@chromium.org>
Reviewed-by: 's avatarSergiy Byelozyorov <sergiyb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#56485}
parent 9c9583a2
......@@ -125,6 +125,7 @@ GENERIC_RESULTS_RE = re.compile(r"^RESULT ([^:]+): ([^=]+)= ([^ ]+) ([^ ]*)$")
RESULT_STDDEV_RE = re.compile(r"^\{([^\}]+)\}$")
RESULT_LIST_RE = re.compile(r"^\[([^\]]+)\]$")
TOOLS_BASE = os.path.abspath(os.path.dirname(__file__))
INFRA_FAILURE_RETCODE = 87
def GeometricMean(values):
......@@ -970,20 +971,20 @@ def Main(args):
if len(args) == 0: # pragma: no cover
parser.print_help()
return 1
return INFRA_FAILURE_RETCODE
if options.arch in ["auto", "native"]: # pragma: no cover
options.arch = ARCH_GUESS
if not options.arch in SUPPORTED_ARCHS: # pragma: no cover
logging.error("Unknown architecture %s", options.arch)
return 1
return INFRA_FAILURE_RETCODE
if (options.json_test_results_secondary and
not options.outdir_secondary): # pragma: no cover
logging.error("For writing secondary json test results, a secondary outdir "
"patch must be specified.")
return 1
return INFRA_FAILURE_RETCODE
workspace = os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))
......@@ -998,10 +999,10 @@ def Main(args):
else:
if not os.path.isfile(options.binary_override_path):
logging.error("binary-override-path must be a file name")
return 1
return INFRA_FAILURE_RETCODE
if options.outdir_secondary:
logging.error("specify either binary-override-path or outdir-secondary")
return 1
return INFRA_FAILURE_RETCODE
options.shell_dir = os.path.abspath(
os.path.dirname(options.binary_override_path))
default_binary_name = os.path.basename(options.binary_override_path)
......@@ -1086,7 +1087,14 @@ def Main(args):
else: # pragma: no cover
print results_secondary
return min(1, len(results.errors))
if results.errors:
return 1
return 0
if __name__ == "__main__": # pragma: no cover
try:
sys.exit(Main(sys.argv[1:]))
except:
# Report infra failure on any uncaptured exceptions.
return INFRA_FAILURE_RETCODE
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment