Skip to content

Commit 9741c25

Browse files
edersondisouzakartben
authored andcommitted
twister: More restrictive regex for log markers
Some simulators - like simics - may end up adding extraneous suffixes to logged lines. This may cause some regex that match too much fail. This patch fixes two such cases: - regex to find RunID changed to only match valid hexadecimal characters; - regex to match start of testsuite changed to only match valid word characters (0-9A-Za-z_). Signed-off-by: Ederson de Souza <[email protected]>
1 parent a58e659 commit 9741c25

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

scripts/pylib/twister/twisterlib/harness.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class Harness:
3838
FAULT = "ZEPHYR FATAL ERROR"
3939
RUN_PASSED = "PROJECT EXECUTION SUCCESSFUL"
4040
RUN_FAILED = "PROJECT EXECUTION FAILED"
41-
run_id_pattern = r"RunID: (?P<run_id>.*)"
41+
run_id_pattern = r"RunID: (?P<run_id>[0-9A-Fa-f]+)"
4242

4343
def __init__(self):
4444
self._status = TwisterStatus.NONE
@@ -789,7 +789,7 @@ class Test(Harness):
789789
# Ztest log patterns don't require to match the line start exactly: there are platforms
790790
# where there is some logging prefix at each console line whereas on other platforms
791791
# without prefixes the leading space is stripped.
792-
test_suite_start_pattern = re.compile(r"Running TESTSUITE (?P<suite_name>\S*)")
792+
test_suite_start_pattern = re.compile(r"Running TESTSUITE (?P<suite_name>\w*)")
793793
test_suite_end_pattern = re.compile(
794794
r"TESTSUITE (?P<suite_name>\S*)\s+(?P<suite_status>succeeded|failed)"
795795
)

0 commit comments

Comments
 (0)