@@ -96,29 +96,31 @@ 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 (
110108 ct in test_options_string for ct in rule_data ["check_types" ]
111109 ):
112- print (f"Check types didn't match: { rule_data ['check_types' ]} not in { test_options_string } " )
110+ print (
111+ f"Check types didn't match: '{ rule_data ['check_types' ]} ' not in '{ test_options_string } '"
112+ )
113113 continue # check_types didn't match → skip rule
114114
115115 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' ]} " )
116+ not_message = rule_data .get ("not_message" )
117+ if not_message and matches_substring (not_message , test_logs , is_regex ):
118+ print (f"Skip rule: Not message matched: '{ rule_data ['not_message' ]} '" )
118119 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
120+ message = rule_data .get ("message" )
121+ if message and not matches_substring (message , test_logs , is_regex ):
122+ print (f"Skip rule: Message didn't match: '{ rule_data ['message' ]} '" )
123+ continue
122124
123125 return rule_data ["reason" ]
124126
@@ -247,7 +249,10 @@ def _process_test_output(self):
247249
248250 if test [1 ] == "FAIL" :
249251 broken_message = test_is_known_fail (
250- test [0 ], test [3 ], known_broken_tests , test_options_string
252+ test [0 ],
253+ test_results_ [- 1 ].info ,
254+ known_broken_tests ,
255+ test_options_string ,
251256 )
252257
253258 if broken_message :
0 commit comments