From 9113dd912ee49ab04224d5de156706e41cf49dde Mon Sep 17 00:00:00 2001 From: liuqi Date: Wed, 6 Jun 2018 17:46:48 +0800 Subject: [PATCH] Fix converter.py not abort when mace run failed for old adb. --- tools/sh_commands.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/tools/sh_commands.py b/tools/sh_commands.py index 0234eff4..8282f884 100644 --- a/tools/sh_commands.py +++ b/tools/sh_commands.py @@ -43,7 +43,6 @@ except Exception as e: ################################ # common ################################ -logger = logging.getLogger('MACE') def strip_invalid_utf8(str): @@ -85,6 +84,15 @@ class BuildType(object): code = 'code' +def stdout_success(stdout): + stdout_lines = stdout.split("\n") + for line in stdout_lines: + if "Aborted" in line or "FAILED" in line or \ + "Segmentation fault" in line: + return False + return True + + ################################ # clear data ################################ @@ -740,8 +748,11 @@ def tuning_run(abi, _tty_in=True, _out=process_output, _err_to_out=True) + stdout = "".join(stdout_buff) + if not stdout_success(stdout): + common.MaceLogger.error("Mace Run", "Mace run failed.") print("Running finished!\n") - return "".join(stdout_buff) + return stdout def validate_model(abi, -- GitLab