@@ -474,6 +474,19 @@ def _get_parallel_tests_skip_list(repo_path):
474474 skip_list_tests = json .load (skip_list_file )
475475 return list (sorted (skip_list_tests ))
476476
477+ @staticmethod
478+ def _get_broken_tests_list (repo_path : str ) -> dict :
479+ skip_list_file_path = f"{ repo_path } /tests/broken_tests.json"
480+ if (
481+ not os .path .isfile (skip_list_file_path )
482+ or os .path .getsize (skip_list_file_path ) == 0
483+ ):
484+ return {}
485+
486+ with open (skip_list_file_path , "r" , encoding = "utf-8" ) as skip_list_file :
487+ skip_list_tests = json .load (skip_list_file )
488+ return skip_list_tests
489+
477490 @staticmethod
478491 def group_test_by_file (tests ):
479492 result = {} # type: Dict
@@ -891,6 +904,8 @@ def run_impl(self, repo_path, build_path):
891904 " " .join (not_found_tests [:3 ]),
892905 )
893906
907+ known_broken_tests = self ._get_broken_tests_list (repo_path )
908+
894909 grouped_tests = self .group_test_by_file (filtered_sequential_tests )
895910 i = 0
896911 for par_group in chunks (filtered_parallel_tests , PARALLEL_GROUP_SIZE ):
@@ -921,6 +936,26 @@ def run_impl(self, repo_path, build_path):
921936 group_counters , group_test_times , log_paths = self .try_run_test_group (
922937 repo_path , group , tests , MAX_RETRY , NUM_WORKERS
923938 )
939+
940+ for fail_status in ("ERROR" , "FAILED" ):
941+ for failed_test in group_counters [fail_status ]:
942+ if failed_test in known_broken_tests .keys ():
943+ fail_message = known_broken_tests [failed_test ].get ("message" )
944+ if not fail_message :
945+ mark_as_broken = True
946+ else :
947+ mark_as_broken = False
948+ for log_path in log_paths :
949+ if log_path .endswith (".log" ):
950+ with open (log_path ) as log_file :
951+ if fail_message in log_file .read ():
952+ mark_as_broken = True
953+ break
954+
955+ if mark_as_broken :
956+ group_counters [fail_status ].remove (failed_test )
957+ group_counters ["BROKEN" ].append (failed_test )
958+
924959 total_tests = 0
925960 for counter , value in group_counters .items ():
926961 logging .info (
0 commit comments