From c50d0fc2b73888aeb1977b8ce15331a80d600cda Mon Sep 17 00:00:00 2001 From: Yan Wang Date: Fri, 19 Jul 2019 11:30:23 -0700 Subject: startop: Add support to perfetto trace in compiler.py. Test: pytest compiler_test.py Bug: 137398235 Change-Id: I6968644d5c44b88e1207dfdaaa379f643d036443 --- startop/scripts/lib/cmd_utils.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'startop/scripts/lib/cmd_utils.py') 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. -- cgit v1.2.3