Skip to content

Commit 0028ba7

Browse files
committed
Document rationale for failure frequency quantization better.
1 parent 64b09c7 commit 0028ba7

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

test/runner.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff 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):

0 commit comments

Comments
 (0)