diff options
author | Yan Wang <yawanng@google.com> | 2019-07-19 11:30:23 -0700 |
---|---|---|
committer | Yan Wang <yawanng@google.com> | 2019-07-22 15:47:22 -0700 |
commit | c50d0fc2b73888aeb1977b8ce15331a80d600cda (patch) | |
tree | d37e57f7df0a7e99c5c742242495ffd93aea43b5 /startop/scripts/lib/cmd_utils.py | |
parent | 9104e0553d0df14e49ef4370469910a4d0602f77 (diff) |
startop: Add support to perfetto trace in compiler.py.
Test: pytest compiler_test.py
Bug: 137398235
Change-Id: I6968644d5c44b88e1207dfdaaa379f643d036443
Diffstat (limited to 'startop/scripts/lib/cmd_utils.py')
-rw-r--r-- | startop/scripts/lib/cmd_utils.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/startop/scripts/lib/cmd_utils.py b/startop/scripts/lib/cmd_utils.py index bc5ca3140d3d..6071f145fe1d 100644 --- a/startop/scripts/lib/cmd_utils.py +++ b/startop/scripts/lib/cmd_utils.py @@ -26,6 +26,18 @@ import lib.print_utils as print_utils TIMEOUT = 50 SIMULATE = False +def run_command_nofail(cmd: List[str], **kwargs) -> None: + """Runs cmd list with default timeout. + + Throws exception if the execution fails. + """ + my_kwargs = {"timeout": TIMEOUT, "shell": False, "simulate": False} + my_kwargs.update(kwargs) + passed, out = execute_arbitrary_command(cmd, **my_kwargs) + if not passed: + raise RuntimeError( + "Failed to execute %s (kwargs=%s), output=%s" % (cmd, kwargs, out)) + def run_adb_shell_command(cmd: str) -> Tuple[bool, str]: """Runs command using adb shell. |