From e3662269ed0b7e545093d626aefae1c3a1ec667a Mon Sep 17 00:00:00 2001 From: deveco_xdevice Date: Wed, 11 Dec 2024 19:19:21 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E4=BF=AE=E5=A4=8DShellKit=E7=9A=84teardown?= =?UTF-8?q?-localcommand=E5=91=BD=E4=BB=A4=E5=9C=A8Linux=E6=97=A0=E6=B3=95?= =?UTF-8?q?=E6=89=A7=E8=A1=8C=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: deveco_xdevice --- plugins/ohos/src/ohos/testkit/kit.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins/ohos/src/ohos/testkit/kit.py b/plugins/ohos/src/ohos/testkit/kit.py index cc8f87f..96fb80e 100644 --- a/plugins/ohos/src/ohos/testkit/kit.py +++ b/plugins/ohos/src/ohos/testkit/kit.py @@ -505,9 +505,9 @@ class ShellKit(ITestKit): LOG.info("No teardown-localcommand to run, skipping!") else: for command in self.tear_down_local_command: - subprocess.run(command) - ret = subprocess.run(command, capture_output=True, text=True) - LOG.info("Teardown-localcommand run: {}".format(ret)) + LOG.info("Run local command: {}".format(command)) + ret = exec_cmd(command) + LOG.info("command output: {}".format(ret)) @dataclass From 97cd234f062b2b4b06d896ac3bd7837867e30428 Mon Sep 17 00:00:00 2001 From: deveco_xdevice Date: Wed, 11 Dec 2024 19:21:13 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E4=BF=AE=E5=A4=8DApp=20died=E7=9A=84?= =?UTF-8?q?=E6=83=85=E5=86=B5=E4=B8=8B=EF=BC=8C=E5=AF=B9=E5=BA=94=E7=9A=84?= =?UTF-8?q?=E9=94=99=E8=AF=AF=E4=BF=A1=E6=81=AF=E6=9C=AA=E8=A2=AB=E8=AE=BE?= =?UTF-8?q?=E4=B8=BA=E6=A8=A1=E5=9D=97=E7=9A=84=E6=8A=A5=E9=94=99=E7=9A=84?= =?UTF-8?q?=E9=97=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: deveco_xdevice --- plugins/ohos/src/ohos/parser/oh_jsunit_parser.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/plugins/ohos/src/ohos/parser/oh_jsunit_parser.py b/plugins/ohos/src/ohos/parser/oh_jsunit_parser.py index ba4a636..8e30b3e 100644 --- a/plugins/ohos/src/ohos/parser/oh_jsunit_parser.py +++ b/plugins/ohos/src/ohos/parser/oh_jsunit_parser.py @@ -364,8 +364,10 @@ class OHJSUnitTestParser(IParser): self.handler_suites_end() def _handle_result_msg(self, line): - if OHJSUnitItemConstants.APP_DIED.value in line: + is_app_died = OHJSUnitItemConstants.APP_DIED.value in line + if is_app_died: self.__test_finish_result_msg = line.replace(OHJSUnitPrefixes.TEST_FINISHED_RESULT_MSG.value, '') + if is_app_died and not self.state_machine.is_suite_empty(): test_result = self.state_machine.test() suite = self.state_machine.suite() if not test_result.is_completed: @@ -572,8 +574,10 @@ class OHJSWorkParser(IParser): self.parse_key(line, len(OHJSUnitPrefixes.STATUS.value)) def _handle_result_msg(self, line): - if OHJSUnitItemConstants.APP_DIED.value in line and not self.state_machine.is_suite_empty(): + is_app_died = OHJSUnitItemConstants.APP_DIED.value in line + if is_app_died: self.__test_finish_result_msg = line.replace(OHJSUnitPrefixes.TEST_FINISHED_RESULT_MSG.value, '') + if is_app_died and not self.state_machine.is_suite_empty(): test_result = self.state_machine.test() suite = self.state_machine.suite() if not test_result.is_completed: