diff --git a/tools/testrunner/base_runner.py b/tools/testrunner/base_runner.py index e5f4252cc6..ee46b6cbcf 100644 --- a/tools/testrunner/base_runner.py +++ b/tools/testrunner/base_runner.py @@ -344,8 +344,8 @@ class BaseTestRunner(object): "color, mono)") parser.add_option("--json-test-results", help="Path to a file for storing json results.") - parser.add_option('--json-test-times', - help='Path to a file for storing json test times.') + parser.add_option('--slow-tests-cutoff', type="int", default=100, + help='Collect N slowest tests') parser.add_option("--exit-after-n-failures", type="int", default=100, help="Exit after the first N failures instead of " "running all tests. Pass 0 to disable this feature.") diff --git a/tools/testrunner/testproc/progress.py b/tools/testrunner/testproc/progress.py index 339a094f45..3357eef76c 100644 --- a/tools/testrunner/testproc/progress.py +++ b/tools/testrunner/testproc/progress.py @@ -385,7 +385,8 @@ class JsonTestProgressIndicator(ProgressIndicator): # Sort tests by duration. 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({ "arch": self.arch, @@ -399,8 +400,6 @@ class JsonTestProgressIndicator(ProgressIndicator): with open(self.options.json_test_results, "w") as f: f.write(json.dumps(complete_results)) - self._save_test_times() - def _test_records(self, tests): return [ { @@ -411,9 +410,3 @@ class JsonTestProgressIndicator(ProgressIndicator): "marked_slow": test.is_slow, } 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))