Collect 100 slow tests by default

If we do not want _all_ tests durations, it makes sense to reuse the existing slow test collection and aggregation

Bug: v8:10168
Change-Id: I500acdb799f41ee6f0fb2c57afb95e1e1830b2dd
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2064221
Auto-Submit: Liviu Rau <liviurau@chromium.org>
Commit-Queue: Liviu Rau <liviurau@chromium.org>
Commit-Queue: Tamer Tas <tmrts@chromium.org>
Reviewed-by: Tamer Tas <tmrts@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66342}
This commit is contained in:
Liviu Rau 2020-02-19 15:03:21 +01:00 committed by Commit Bot
parent c12f395da7
commit ebbaf2b787
2 changed files with 4 additions and 11 deletions

View File

@ -344,8 +344,8 @@ class BaseTestRunner(object):
"color, mono)") "color, mono)")
parser.add_option("--json-test-results", parser.add_option("--json-test-results",
help="Path to a file for storing json results.") help="Path to a file for storing json results.")
parser.add_option('--json-test-times', parser.add_option('--slow-tests-cutoff', type="int", default=100,
help='Path to a file for storing json test times.') help='Collect N slowest tests')
parser.add_option("--exit-after-n-failures", type="int", default=100, parser.add_option("--exit-after-n-failures", type="int", default=100,
help="Exit after the first N failures instead of " help="Exit after the first N failures instead of "
"running all tests. Pass 0 to disable this feature.") "running all tests. Pass 0 to disable this feature.")

View File

@ -385,7 +385,8 @@ class JsonTestProgressIndicator(ProgressIndicator):
# Sort tests by duration. # Sort tests by duration.
self.tests.sort(key=lambda __duration_cmd: __duration_cmd[1], reverse=True) self.tests.sort(key=lambda __duration_cmd: __duration_cmd[1], reverse=True)
slowest_tests = self._test_records(self.tests[:20]) cutoff = self.options.slow_tests_cutoff
slowest_tests = self._test_records(self.tests[:cutoff])
complete_results.append({ complete_results.append({
"arch": self.arch, "arch": self.arch,
@ -399,8 +400,6 @@ class JsonTestProgressIndicator(ProgressIndicator):
with open(self.options.json_test_results, "w") as f: with open(self.options.json_test_results, "w") as f:
f.write(json.dumps(complete_results)) f.write(json.dumps(complete_results))
self._save_test_times()
def _test_records(self, tests): def _test_records(self, tests):
return [ return [
{ {
@ -411,9 +410,3 @@ class JsonTestProgressIndicator(ProgressIndicator):
"marked_slow": test.is_slow, "marked_slow": test.is_slow,
} for (test, duration, cmd) in tests } for (test, duration, cmd) in tests
] ]
def _save_test_times(self):
if self.options.json_test_times:
test_times = self._test_records(self.tests)
with open(self.options.json_test_times, "w") as f:
f.write(json.dumps(test_times))