@@ -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
0 commit comments