Skip to content

Commit 2eb02fd

Browse files
committed
more debugging and fix not_message handling
1 parent 32fd3ce commit 2eb02fd

File tree

2 files changed

+21
-19
lines changed

2 files changed

+21
-19
lines changed

ci/jobs/scripts/functional_tests_results.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -96,14 +96,12 @@ def test_is_known_fail(test_name, test_logs, known_broken_tests, test_options_st
9696
if not matching_rules:
9797
return False
9898

99-
def matches_field(field, log, is_regex):
100-
if field is None:
101-
return True
99+
def matches_substring(substring, log, is_regex):
102100
if log is None:
103101
return False
104102
if is_regex:
105-
return bool(field.search(log))
106-
return field in log
103+
return bool(substring.search(log))
104+
return substring in log
107105

108106
for rule_data in matching_rules:
109107
if rule_data.get("check_types") and not any(
@@ -113,12 +111,14 @@ def matches_field(field, log, is_regex):
113111
continue # check_types didn't match → skip rule
114112

115113
is_regex = rule_data.get("regex", False)
116-
if matches_field(rule_data.get("not_message"), test_logs, is_regex):
117-
print(f"Not message matched: {rule_data['not_message']}")
114+
not_message = rule_data.get("not_message")
115+
if not_message and matches_substring(not_message, test_logs, is_regex):
116+
print(f"Skip rule: Not message matched: {rule_data['not_message']}")
118117
continue # not_message matched → skip rule
119-
if not matches_field(rule_data.get("message"), test_logs, is_regex):
120-
print(f"Message didn't match: {rule_data['message']}")
121-
continue # message didn't match → skip rule
118+
message = rule_data.get("message")
119+
if message and not matches_substring(message, test_logs, is_regex):
120+
print(f"Skip rule: Message didn't match: {rule_data['message']}")
121+
continue
122122

123123
return rule_data["reason"]
124124

ci/jobs/scripts/integration_tests_runner.py

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -524,15 +524,13 @@ def test_is_known_fail(test_name, test_logs, debug_log_file):
524524
if not matching_rules:
525525
return False
526526

527-
def matches_field(field, log, is_regex):
528-
if field is None:
529-
return True
527+
def matches_substring(substring, log, is_regex):
530528
if log is None:
531529
# Cannot match a message pattern if we have no logs
532530
return False
533531
if is_regex:
534-
return bool(field.search(log))
535-
return field in log
532+
return bool(substring.search(log))
533+
return substring in log
536534

537535
for rule_data in matching_rules:
538536
if rule_data.get("check_types") and not any(
@@ -541,10 +539,14 @@ def matches_field(field, log, is_regex):
541539
continue # check_types didn't match → skip rule
542540

543541
is_regex = rule_data.get("regex", False)
544-
if matches_field(rule_data.get("not_message"), test_logs, is_regex):
545-
continue # not_message matched → skip rule
546-
if not matches_field(rule_data.get("message"), test_logs, is_regex):
547-
continue # message didn't match → skip rule
542+
not_message = rule_data.get("not_message")
543+
if not_message and matches_substring(not_message, test_logs, is_regex):
544+
debug_log_file.write(f"Skip rule: Not message matched: {not_message}\n")
545+
continue
546+
message = rule_data.get("message")
547+
if message and not matches_substring(message, test_logs, is_regex):
548+
debug_log_file.write(f"Skip rule: Message didn't match: {message}\n")
549+
continue
548550

549551
return rule_data["reason"]
550552

0 commit comments

Comments
 (0)