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

Side by Side Diff: tools/run-tests.py

Issue 231443002: Improve reproducibility of test runs. (Closed) Base URL: git@github.com:v8/v8.git@master
Patch Set: Address nit Created 6 years, 8 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 | « test/mjsunit/mjsunit.status ('k') | tools/testrunner/local/execution.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 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # 2 #
3 # Copyright 2012 the V8 project authors. All rights reserved. 3 # Copyright 2012 the V8 project authors. All rights reserved.
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 16 matching lines...) Expand all
27 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 29
30 30
31 import itertools 31 import itertools
32 import multiprocessing 32 import multiprocessing
33 import optparse 33 import optparse
34 import os 34 import os
35 from os.path import join 35 from os.path import join
36 import platform 36 import platform
37 import random
37 import shlex 38 import shlex
38 import subprocess 39 import subprocess
39 import sys 40 import sys
40 import time 41 import time
41 42
42 from testrunner.local import execution 43 from testrunner.local import execution
43 from testrunner.local import progress 44 from testrunner.local import progress
44 from testrunner.local import testsuite 45 from testrunner.local import testsuite
45 from testrunner.local import utils 46 from testrunner.local import utils
46 from testrunner.local import verbose 47 from testrunner.local import verbose
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 result.add_option("-v", "--verbose", help="Verbose output", 194 result.add_option("-v", "--verbose", help="Verbose output",
194 default=False, action="store_true") 195 default=False, action="store_true")
195 result.add_option("--valgrind", help="Run tests through valgrind", 196 result.add_option("--valgrind", help="Run tests through valgrind",
196 default=False, action="store_true") 197 default=False, action="store_true")
197 result.add_option("--warn-unused", help="Report unused rules", 198 result.add_option("--warn-unused", help="Report unused rules",
198 default=False, action="store_true") 199 default=False, action="store_true")
199 result.add_option("--junitout", help="File name of the JUnit output") 200 result.add_option("--junitout", help="File name of the JUnit output")
200 result.add_option("--junittestsuite", 201 result.add_option("--junittestsuite",
201 help="The testsuite name in the JUnit output file", 202 help="The testsuite name in the JUnit output file",
202 default="v8tests") 203 default="v8tests")
204 result.add_option("--random-seed", default=0, dest="random_seed",
205 help="Default seed for initializing random generator")
203 return result 206 return result
204 207
205 208
206 def ProcessOptions(options): 209 def ProcessOptions(options):
207 global VARIANT_FLAGS 210 global VARIANT_FLAGS
208 global VARIANTS 211 global VARIANTS
209 212
210 # Architecture and mode related stuff. 213 # Architecture and mode related stuff.
211 if options.arch_and_mode: 214 if options.arch_and_mode:
212 options.arch_and_mode = [arch_and_mode.split(".") 215 options.arch_and_mode = [arch_and_mode.split(".")
(...skipping 30 matching lines...) Expand all
243 options.no_network = True 246 options.no_network = True
244 options.command_prefix = shlex.split(options.command_prefix) 247 options.command_prefix = shlex.split(options.command_prefix)
245 options.extra_flags = shlex.split(options.extra_flags) 248 options.extra_flags = shlex.split(options.extra_flags)
246 249
247 if options.gc_stress: 250 if options.gc_stress:
248 options.extra_flags += GC_STRESS_FLAGS 251 options.extra_flags += GC_STRESS_FLAGS
249 252
250 if options.j == 0: 253 if options.j == 0:
251 options.j = multiprocessing.cpu_count() 254 options.j = multiprocessing.cpu_count()
252 255
256 while options.random_seed == 0:
257 options.random_seed = random.SystemRandom().randint(-2147483648, 2147483647)
258
253 def excl(*args): 259 def excl(*args):
254 """Returns true if zero or one of multiple arguments are true.""" 260 """Returns true if zero or one of multiple arguments are true."""
255 return reduce(lambda x, y: x + y, args) <= 1 261 return reduce(lambda x, y: x + y, args) <= 1
256 262
257 if not excl(options.no_stress, options.stress_only, options.no_variants, 263 if not excl(options.no_stress, options.stress_only, options.no_variants,
258 bool(options.variants), options.quickcheck): 264 bool(options.variants), options.quickcheck):
259 print("Use only one of --no-stress, --stress-only, --no-variants, " 265 print("Use only one of --no-stress, --stress-only, --no-variants, "
260 "--variants, or --quickcheck.") 266 "--variants, or --quickcheck.")
261 return False 267 return False
262 if options.no_stress: 268 if options.no_stress:
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
389 timeout = 2 * TIMEOUT_DEFAULT; 395 timeout = 2 * TIMEOUT_DEFAULT;
390 else: 396 else:
391 timeout = TIMEOUT_DEFAULT; 397 timeout = TIMEOUT_DEFAULT;
392 398
393 timeout *= TIMEOUT_SCALEFACTOR[mode] 399 timeout *= TIMEOUT_SCALEFACTOR[mode]
394 ctx = context.Context(arch, mode, shell_dir, 400 ctx = context.Context(arch, mode, shell_dir,
395 mode_flags, options.verbose, 401 mode_flags, options.verbose,
396 timeout, options.isolates, 402 timeout, options.isolates,
397 options.command_prefix, 403 options.command_prefix,
398 options.extra_flags, 404 options.extra_flags,
399 options.no_i18n) 405 options.no_i18n,
406 options.random_seed)
400 407
401 # TODO(all): Combine "simulator" and "simulator_run". 408 # TODO(all): Combine "simulator" and "simulator_run".
402 simulator_run = not options.dont_skip_simulator_slow_tests and \ 409 simulator_run = not options.dont_skip_simulator_slow_tests and \
403 arch in ['arm64', 'arm', 'mips'] and ARCH_GUESS and arch != ARCH_GUESS 410 arch in ['arm64', 'arm', 'mips'] and ARCH_GUESS and arch != ARCH_GUESS
404 # Find available test suites and read test cases from them. 411 # Find available test suites and read test cases from them.
405 variables = { 412 variables = {
406 "arch": arch, 413 "arch": arch,
407 "asan": options.asan, 414 "asan": options.asan,
408 "deopt_fuzzer": False, 415 "deopt_fuzzer": False,
409 "gc_stress": options.gc_stress, 416 "gc_stress": options.gc_stress,
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
489 except KeyboardInterrupt: 496 except KeyboardInterrupt:
490 raise 497 raise
491 498
492 if options.time: 499 if options.time:
493 verbose.PrintTestDurations(suites, overall_duration) 500 verbose.PrintTestDurations(suites, overall_duration)
494 return exit_code 501 return exit_code
495 502
496 503
497 if __name__ == "__main__": 504 if __name__ == "__main__":
498 sys.exit(Main()) 505 sys.exit(Main())
OLDNEW
« no previous file with comments | « test/mjsunit/mjsunit.status ('k') | tools/testrunner/local/execution.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698