Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(368)

Side by Side Diff: third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/controllers/manager.py

Issue 2308283002: Allow seeding the random layout test order and write out seed. (Closed)
Patch Set: Remove incomplete docstring change Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright (C) 2010 Google Inc. All rights reserved. 1 # Copyright (C) 2010 Google Inc. All rights reserved.
2 # Copyright (C) 2010 Gabor Rapcsanyi (rgabor@inf.u-szeged.hu), University of Sze ged 2 # Copyright (C) 2010 Gabor Rapcsanyi (rgabor@inf.u-szeged.hu), University of Sze ged
3 # 3 #
4 # Redistribution and use in source and binary forms, with or without 4 # Redistribution and use in source and binary forms, with or without
5 # modification, are permitted provided that the following conditions are 5 # modification, are permitted provided that the following conditions are
6 # met: 6 # met:
7 # 7 #
8 # * Redistributions of source code must retain the above copyright 8 # * Redistributions of source code must retain the above copyright
9 # notice, this list of conditions and the following disclaimer. 9 # notice, this list of conditions and the following disclaimer.
10 # * Redistributions in binary form must reproduce the above 10 # * Redistributions in binary form must reproduce the above
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 tests_to_run = [test for test in test_names if test not in tests_to_skip ] 246 tests_to_run = [test for test in test_names if test not in tests_to_skip ]
247 247
248 if not tests_to_run: 248 if not tests_to_run:
249 return tests_to_run, tests_to_skip 249 return tests_to_run, tests_to_skip
250 250
251 # Create a sorted list of test files so the subset chunk, 251 # Create a sorted list of test files so the subset chunk,
252 # if used, contains alphabetically consecutive tests. 252 # if used, contains alphabetically consecutive tests.
253 if self._options.order == 'natural': 253 if self._options.order == 'natural':
254 tests_to_run.sort(key=self._port.test_key) 254 tests_to_run.sort(key=self._port.test_key)
255 elif self._options.order == 'random': 255 elif self._options.order == 'random':
256 random.shuffle(tests_to_run) 256 tests_to_run.sort()
257 elif self._options.order == 'random-seeded': 257 rand = random.Random()
258 rnd = random.Random() 258 rand.seed(self._options.seed)
Dirk Pranke 2016/09/09 19:50:22 Nit: this can be rand = random.Random(self._
259 rnd.seed(4) # http://xkcd.com/221/ 259 rand.shuffle(tests_to_run)
260 rnd.shuffle(tests_to_run)
261 260
262 tests_to_run, tests_in_other_chunks = self._finder.split_into_chunks(tes ts_to_run) 261 tests_to_run, tests_in_other_chunks = self._finder.split_into_chunks(tes ts_to_run)
263 self._expectations.add_extra_skipped_tests(tests_in_other_chunks) 262 self._expectations.add_extra_skipped_tests(tests_in_other_chunks)
264 tests_to_skip.update(tests_in_other_chunks) 263 tests_to_skip.update(tests_in_other_chunks)
265 264
266 return tests_to_run, tests_to_skip 265 return tests_to_run, tests_to_skip
267 266
268 def _test_input_for_file(self, test_file): 267 def _test_input_for_file(self, test_file):
269 return TestInput(test_file, 268 return TestInput(test_file,
270 self._options.slow_time_out_ms if self._test_is_slow(te st_file) else self._options.time_out_ms, 269 self._options.slow_time_out_ms if self._test_is_slow(te st_file) else self._options.time_out_ms,
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after
553 552
554 stats = {} 553 stats = {}
555 for result in initial_results.results_by_name.values(): 554 for result in initial_results.results_by_name.values():
556 if result.type != test_expectations.SKIP: 555 if result.type != test_expectations.SKIP:
557 stats[result.test_name] = {'results': (_worker_number(result.wor ker_name), result.test_number, result.pid, int( 556 stats[result.test_name] = {'results': (_worker_number(result.wor ker_name), result.test_number, result.pid, int(
558 result.test_run_time * 1000), int(result.total_run_time * 10 00))} 557 result.test_run_time * 1000), int(result.total_run_time * 10 00))}
559 stats_trie = {} 558 stats_trie = {}
560 for name, value in stats.iteritems(): 559 for name, value in stats.iteritems():
561 json_results_generator.add_path_to_trie(name, value, stats_trie) 560 json_results_generator.add_path_to_trie(name, value, stats_trie)
562 return stats_trie 561 return stats_trie
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698