File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -277,7 +277,15 @@ def create_test_run_sorter(failfast):
277277 def read_approx_fail_freq (test_name ):
278278 if test_name in previous_test_run_results and 'fail_frequency' in previous_test_run_results [test_name ]:
279279 # Quantize the float value to relatively fine-grained buckets for sorting
280- return round (previous_test_run_results [test_name ]['fail_frequency' ] * 20 ) / 20
280+ # This bucketization is needed to merge two competing sorting goals: we may
281+ # want to fail early (so tests with previous history of failures should sort first)
282+ # but we also want to run the slowest tests first.
283+ # We cannot sort for both goals at the same time, so have failure frequency
284+ # take priority over test runtime, and quantize the failures to distinct
285+ # frequencies, to be able to then sort by test runtime inside the same failure
286+ # frequency bucket.
287+ NUM_BUCKETS = 20
288+ return round (previous_test_run_results [test_name ]['fail_frequency' ] * NUM_BUCKETS ) / NUM_BUCKETS
281289 return 0
282290
283291 def sort_tests_failing_and_slowest_first_comparator (x , y ):
You can’t perform that action at this time.
0 commit comments