Reland "[tools] Report infra failure on incorrect usage or uncaptured exceptions"
This is a reland of 2bac24fe2c
Original change's description:
> [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: Sergiy Byelozyorov <sergiyb@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#56485}
TBR=machenbach@google.com
Test: ran run_perf_test.py locally (it reports same errors as before this CL)
No-Try: true
Bug: chromium:893464
Change-Id: I1bb2fae6fe2e2b7350695e491d7c3d52ff06db14
Reviewed-on: https://chromium-review.googlesource.com/c/1270965
Commit-Queue: Sergiy Byelozyorov <sergiyb@chromium.org>
Reviewed-by: Sergiy Byelozyorov <sergiyb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#56495}
This commit is contained in:
parent
22b56f47e3
commit
96fba5f37f
@ -108,6 +108,7 @@ import os
|
|||||||
import re
|
import re
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
|
import traceback
|
||||||
|
|
||||||
from testrunner.local import android
|
from testrunner.local import android
|
||||||
from testrunner.local import command
|
from testrunner.local import command
|
||||||
@ -125,6 +126,7 @@ GENERIC_RESULTS_RE = re.compile(r"^RESULT ([^:]+): ([^=]+)= ([^ ]+) ([^ ]*)$")
|
|||||||
RESULT_STDDEV_RE = re.compile(r"^\{([^\}]+)\}$")
|
RESULT_STDDEV_RE = re.compile(r"^\{([^\}]+)\}$")
|
||||||
RESULT_LIST_RE = re.compile(r"^\[([^\]]+)\]$")
|
RESULT_LIST_RE = re.compile(r"^\[([^\]]+)\]$")
|
||||||
TOOLS_BASE = os.path.abspath(os.path.dirname(__file__))
|
TOOLS_BASE = os.path.abspath(os.path.dirname(__file__))
|
||||||
|
INFRA_FAILURE_RETCODE = 87
|
||||||
|
|
||||||
|
|
||||||
def GeometricMean(values):
|
def GeometricMean(values):
|
||||||
@ -970,20 +972,20 @@ def Main(args):
|
|||||||
|
|
||||||
if len(args) == 0: # pragma: no cover
|
if len(args) == 0: # pragma: no cover
|
||||||
parser.print_help()
|
parser.print_help()
|
||||||
return 1
|
return INFRA_FAILURE_RETCODE
|
||||||
|
|
||||||
if options.arch in ["auto", "native"]: # pragma: no cover
|
if options.arch in ["auto", "native"]: # pragma: no cover
|
||||||
options.arch = ARCH_GUESS
|
options.arch = ARCH_GUESS
|
||||||
|
|
||||||
if not options.arch in SUPPORTED_ARCHS: # pragma: no cover
|
if not options.arch in SUPPORTED_ARCHS: # pragma: no cover
|
||||||
logging.error("Unknown architecture %s", options.arch)
|
logging.error("Unknown architecture %s", options.arch)
|
||||||
return 1
|
return INFRA_FAILURE_RETCODE
|
||||||
|
|
||||||
if (options.json_test_results_secondary and
|
if (options.json_test_results_secondary and
|
||||||
not options.outdir_secondary): # pragma: no cover
|
not options.outdir_secondary): # pragma: no cover
|
||||||
logging.error("For writing secondary json test results, a secondary outdir "
|
logging.error("For writing secondary json test results, a secondary outdir "
|
||||||
"patch must be specified.")
|
"patch must be specified.")
|
||||||
return 1
|
return INFRA_FAILURE_RETCODE
|
||||||
|
|
||||||
workspace = os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))
|
workspace = os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))
|
||||||
|
|
||||||
@ -998,10 +1000,10 @@ def Main(args):
|
|||||||
else:
|
else:
|
||||||
if not os.path.isfile(options.binary_override_path):
|
if not os.path.isfile(options.binary_override_path):
|
||||||
logging.error("binary-override-path must be a file name")
|
logging.error("binary-override-path must be a file name")
|
||||||
return 1
|
return INFRA_FAILURE_RETCODE
|
||||||
if options.outdir_secondary:
|
if options.outdir_secondary:
|
||||||
logging.error("specify either binary-override-path or outdir-secondary")
|
logging.error("specify either binary-override-path or outdir-secondary")
|
||||||
return 1
|
return INFRA_FAILURE_RETCODE
|
||||||
options.shell_dir = os.path.abspath(
|
options.shell_dir = os.path.abspath(
|
||||||
os.path.dirname(options.binary_override_path))
|
os.path.dirname(options.binary_override_path))
|
||||||
default_binary_name = os.path.basename(options.binary_override_path)
|
default_binary_name = os.path.basename(options.binary_override_path)
|
||||||
@ -1086,7 +1088,20 @@ def Main(args):
|
|||||||
else: # pragma: no cover
|
else: # pragma: no cover
|
||||||
print results_secondary
|
print results_secondary
|
||||||
|
|
||||||
return min(1, len(results.errors))
|
if results.errors:
|
||||||
|
return 1
|
||||||
|
|
||||||
|
return 0
|
||||||
|
|
||||||
|
|
||||||
|
def MainWrapper():
|
||||||
|
try:
|
||||||
|
return Main(sys.argv[1:])
|
||||||
|
except:
|
||||||
|
# Log uncaptured exceptions and report infra failure to the caller.
|
||||||
|
traceback.print_exc()
|
||||||
|
return INFRA_FAILURE_RETCODE
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__": # pragma: no cover
|
if __name__ == "__main__": # pragma: no cover
|
||||||
sys.exit(Main(sys.argv[1:]))
|
sys.exit(MainWrapper())
|
||||||
|
Loading…
Reference in New Issue
Block a user