提交 c7166760 编写于 作者: O openharmony_ci 提交者: Gitee

!1 修改ltp测试用例概率失败问题

Merge pull request !1 from alex_hold/master
......@@ -739,11 +739,14 @@ class OpenSourceTestDriver(IDriver):
parser_instance.listeners = listener
parser_instances.append(parser_instance)
self.handler = ShellHandler(parser_instances)
result, _, error = self.config.device.execute_command_with_timeout(
command=command, case_type=DeviceTestType.open_source_test,
timeout=timeout, receiver=self.handler)
self.config.command_result = "{}{}".format(
self.config.command_result, result)
for _ in range(3):
result, _, error = self.config.device.execute_command_with_timeout(
command=command, case_type=DeviceTestType.open_source_test,
timeout=timeout, receiver=self.handler)
self.config.command_result = "{}{}".format(
self.config.command_result, result)
if "test pass" in result.lower() or "tests pass" in result.lower():
break
return error, result, self.handler
def _do_test_run(self, command, request):
......
......@@ -53,6 +53,7 @@ _CTEST_SETUP_TAG = "setup"
_CTEST_RUN_TAG = "-----------------------"
_TEST_PASSED_LOWER = "test pass"
_TESTS_PASSED_LOWER = "tests pass"
_COMPILE_PASSED = "compile PASSED"
_COMPILE_PARA = r"(.* compile .*)"
......@@ -745,7 +746,8 @@ class OpenSourceParser(IParser):
self.state_machine.trace_logs.extend(self.lines)
self.handle_suite_started_tag(self.test_num)
test_result = self.state_machine.test(reset=True)
test_result = self.state_machine.test(reset=True,
test_index=self.test_name)
test_result.run_time = 0
test_result.test_class = self.suite_name
test_result.test_name = self.test_name
......@@ -756,7 +758,8 @@ class OpenSourceParser(IParser):
listener.__started__(LifeCycle.TestCase, result)
for line in self.lines:
self.output = "{}{}".format(self.output, line)
if _TEST_PASSED_LOWER in line.lower():
if _TEST_PASSED_LOWER in line.lower() or \
_TESTS_PASSED_LOWER in line.lower():
test_result.code = ResultCode.PASSED.value
for listener in self.get_listeners():
result = copy.copy(test_result)
......
......@@ -119,10 +119,13 @@ class StateRecorder:
self.current_suites.index = uuid.uuid4().hex
return self.current_suites
def test(self, reset=False):
def test(self, reset=False, test_index=None):
if reset or not self.current_test:
self.current_test = CaseResult()
self.current_test.index = uuid.uuid4().hex
if test_index:
self.current_test.index = test_index
else:
self.current_test.index = uuid.uuid4().hex
return self.current_test
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册