twister: Fix gTest harness
The gTest harness asssumed that the lines end with the test name, but some gTest implementations include the test duration in the line. Update both the tests and regex to allow this and also avoid capturing characters into the `test_name` that cannot be valid test name chars. Fixes #72318 Signed-off-by: Yuval Peress <peress@google.com>
This commit is contained in:
parent
9abca61841
commit
1b51740fa3
2 changed files with 6 additions and 6 deletions
|
|
@ -570,11 +570,11 @@ class Pytest(Harness):
|
|||
|
||||
class Gtest(Harness):
|
||||
ANSI_ESCAPE = re.compile(r'\x1B(?:[@-Z\\-_]|\[[0-?]*[ -/]*[@-~])')
|
||||
TEST_START_PATTERN = r".*\[ RUN \] (?P<suite_name>.*)\.(?P<test_name>.*)$"
|
||||
TEST_PASS_PATTERN = r".*\[ OK \] (?P<suite_name>.*)\.(?P<test_name>.*)$"
|
||||
TEST_SKIP_PATTERN = r".*\[ DISABLED \] (?P<suite_name>.*)\.(?P<test_name>.*)$"
|
||||
TEST_FAIL_PATTERN = r".*\[ FAILED \] (?P<suite_name>.*)\.(?P<test_name>.*)$"
|
||||
FINISHED_PATTERN = r".*\[==========\] Done running all tests\.$"
|
||||
TEST_START_PATTERN = r".*\[ RUN \] (?P<suite_name>[a-zA-Z_][a-zA-Z0-9_]*)\.(?P<test_name>[a-zA-Z_][a-zA-Z0-9_]*)"
|
||||
TEST_PASS_PATTERN = r".*\[ OK \] (?P<suite_name>[a-zA-Z_][a-zA-Z0-9_]*)\.(?P<test_name>[a-zA-Z_][a-zA-Z0-9_]*)"
|
||||
TEST_SKIP_PATTERN = r".*\[ DISABLED \] (?P<suite_name>[a-zA-Z_][a-zA-Z0-9_]*)\.(?P<test_name>[a-zA-Z_][a-zA-Z0-9_]*)"
|
||||
TEST_FAIL_PATTERN = r".*\[ FAILED \] (?P<suite_name>[a-zA-Z_][a-zA-Z0-9_]*)\.(?P<test_name>[a-zA-Z_][a-zA-Z0-9_]*)"
|
||||
FINISHED_PATTERN = r".*\[==========\] Done running all tests\."
|
||||
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ GTEST_FAIL_STATE = " FAILED "
|
|||
SAMPLE_GTEST_START = (
|
||||
"[00:00:00.000,000] [0m<inf> label: [==========] Running all tests.[0m"
|
||||
)
|
||||
SAMPLE_GTEST_FMT = "[00:00:00.000,000] [0m<inf> label: [{state}] {suite}.{test}[0m"
|
||||
SAMPLE_GTEST_FMT = "[00:00:00.000,000] [0m<inf> label: [{state}] {suite}.{test} (0ms)[0m"
|
||||
SAMPLE_GTEST_END = (
|
||||
"[00:00:00.000,000] [0m<inf> label: [==========] Done running all tests.[0m"
|
||||
)
|
||||
|
|
|
|||
Loading…
Reference in a new issue