MCPcopy Create free account
hub / github.com/emscripten-core/emscripten / read_approx_fail_freq

Function read_approx_fail_freq

test/runner.py:309–321  ·  view source on GitHub ↗
(test_name)

Source from the content-addressed store, hash-verified

307 previous_test_run_results = common.load_previous_test_run_results()
308
309 def read_approx_fail_freq(test_name):
310 if test_name in previous_test_run_results and 'fail_frequency' in previous_test_run_results[test_name]:
311 # Quantize the float value to relatively fine-grained buckets for sorting.
312 # This bucketization is needed to merge two competing sorting goals: we may
313 # want to fail early (so tests with previous history of failures should sort first)
314 # but we also want to run the slowest tests first.
315 # We cannot sort for both goals at the same time, so have failure frequency
316 # take priority over test runtime, and quantize the failures to distinct
317 # frequencies, to be able to then sort by test runtime inside the same failure
318 # frequency bucket.
319 NUM_BUCKETS = 20
320 return round(previous_test_run_results[test_name]['fail_frequency'] * NUM_BUCKETS) / NUM_BUCKETS
321 return 0
322
323 def sort_tests_failing_and_slowest_first_comparator(x, y):
324 x = str(x)

Calls 1

roundFunction · 0.50

Tested by

no test coverage detected