!315 1、修复ShellKit的teardown-localcommand命令在Linux无法执行的问题;2、修复App died的情况下,对应的错误信息未被设为模块的报错的问题

Merge pull request !315 from liangzhuowei/master
This commit is contained in:
openharmony_ci 2024-12-11 12:46:45 +00:00 committed by Gitee
commit 207cdfd943
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 9 additions and 5 deletions

View File

@ -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:

View File

@ -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