| OLD | NEW |
| 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 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 help="Run this shard from the split up tests.", | 206 help="Run this shard from the split up tests.", |
| 207 default=1, type="int") | 207 default=1, type="int") |
| 208 result.add_option("--shell-dir", help="Directory containing executables", | 208 result.add_option("--shell-dir", help="Directory containing executables", |
| 209 default="") | 209 default="") |
| 210 result.add_option("--seed", help="The seed for the random distribution", | 210 result.add_option("--seed", help="The seed for the random distribution", |
| 211 type="int") | 211 type="int") |
| 212 result.add_option("-t", "--timeout", help="Timeout in seconds", | 212 result.add_option("-t", "--timeout", help="Timeout in seconds", |
| 213 default= -1, type="int") | 213 default= -1, type="int") |
| 214 result.add_option("-v", "--verbose", help="Verbose output", | 214 result.add_option("-v", "--verbose", help="Verbose output", |
| 215 default=False, action="store_true") | 215 default=False, action="store_true") |
| 216 result.add_option("--random-seed", default=0, dest="random_seed", |
| 217 help="Default seed for initializing random generator") |
| 216 return result | 218 return result |
| 217 | 219 |
| 218 | 220 |
| 219 def ProcessOptions(options): | 221 def ProcessOptions(options): |
| 220 global VARIANT_FLAGS | 222 global VARIANT_FLAGS |
| 221 | 223 |
| 222 # Architecture and mode related stuff. | 224 # Architecture and mode related stuff. |
| 223 if options.arch_and_mode: | 225 if options.arch_and_mode: |
| 224 tokens = options.arch_and_mode.split(".") | 226 tokens = options.arch_and_mode.split(".") |
| 225 options.arch = tokens[0] | 227 options.arch = tokens[0] |
| 226 options.mode = tokens[1] | 228 options.mode = tokens[1] |
| 227 options.mode = options.mode.split(",") | 229 options.mode = options.mode.split(",") |
| 228 for mode in options.mode: | 230 for mode in options.mode: |
| 229 if not mode.lower() in ["debug", "release"]: | 231 if not mode.lower() in ["debug", "release"]: |
| 230 print "Unknown mode %s" % mode | 232 print "Unknown mode %s" % mode |
| 231 return False | 233 return False |
| 232 if options.arch in ["auto", "native"]: | 234 if options.arch in ["auto", "native"]: |
| 233 options.arch = ARCH_GUESS | 235 options.arch = ARCH_GUESS |
| 234 options.arch = options.arch.split(",") | 236 options.arch = options.arch.split(",") |
| 235 for arch in options.arch: | 237 for arch in options.arch: |
| 236 if not arch in SUPPORTED_ARCHS: | 238 if not arch in SUPPORTED_ARCHS: |
| 237 print "Unknown architecture %s" % arch | 239 print "Unknown architecture %s" % arch |
| 238 return False | 240 return False |
| 239 | 241 |
| 240 # Special processing of other options, sorted alphabetically. | 242 # Special processing of other options, sorted alphabetically. |
| 241 options.command_prefix = shlex.split(options.command_prefix) | 243 options.command_prefix = shlex.split(options.command_prefix) |
| 242 options.extra_flags = shlex.split(options.extra_flags) | 244 options.extra_flags = shlex.split(options.extra_flags) |
| 243 if options.j == 0: | 245 if options.j == 0: |
| 244 options.j = multiprocessing.cpu_count() | 246 options.j = multiprocessing.cpu_count() |
| 247 while options.random_seed == 0: |
| 248 options.random_seed = random.SystemRandom().randint(-2147483648, 2147483647) |
| 245 if not options.distribution_mode in DISTRIBUTION_MODES: | 249 if not options.distribution_mode in DISTRIBUTION_MODES: |
| 246 print "Unknown distribution mode %s" % options.distribution_mode | 250 print "Unknown distribution mode %s" % options.distribution_mode |
| 247 return False | 251 return False |
| 248 if options.distribution_factor1 < 0.0: | 252 if options.distribution_factor1 < 0.0: |
| 249 print ("Distribution factor1 %s is out of range. Defaulting to 0.0" | 253 print ("Distribution factor1 %s is out of range. Defaulting to 0.0" |
| 250 % options.distribution_factor1) | 254 % options.distribution_factor1) |
| 251 options.distribution_factor1 = 0.0 | 255 options.distribution_factor1 = 0.0 |
| 252 if options.distribution_factor2 < 0.0: | 256 if options.distribution_factor2 < 0.0: |
| 253 print ("Distribution factor2 %s is out of range. Defaulting to 0.0" | 257 print ("Distribution factor2 %s is out of range. Defaulting to 0.0" |
| 254 % options.distribution_factor2) | 258 % options.distribution_factor2) |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 355 timeout = 2 * TIMEOUT_DEFAULT; | 359 timeout = 2 * TIMEOUT_DEFAULT; |
| 356 else: | 360 else: |
| 357 timeout = TIMEOUT_DEFAULT; | 361 timeout = TIMEOUT_DEFAULT; |
| 358 | 362 |
| 359 timeout *= TIMEOUT_SCALEFACTOR[mode] | 363 timeout *= TIMEOUT_SCALEFACTOR[mode] |
| 360 ctx = context.Context(arch, mode, shell_dir, | 364 ctx = context.Context(arch, mode, shell_dir, |
| 361 mode_flags, options.verbose, | 365 mode_flags, options.verbose, |
| 362 timeout, options.isolates, | 366 timeout, options.isolates, |
| 363 options.command_prefix, | 367 options.command_prefix, |
| 364 options.extra_flags, | 368 options.extra_flags, |
| 365 False) | 369 False, |
| 370 options.random_seed) |
| 366 | 371 |
| 367 # Find available test suites and read test cases from them. | 372 # Find available test suites and read test cases from them. |
| 368 variables = { | 373 variables = { |
| 369 "arch": arch, | 374 "arch": arch, |
| 370 "asan": options.asan, | 375 "asan": options.asan, |
| 371 "deopt_fuzzer": True, | 376 "deopt_fuzzer": True, |
| 372 "gc_stress": False, | 377 "gc_stress": False, |
| 373 "isolates": options.isolates, | 378 "isolates": options.isolates, |
| 374 "mode": mode, | 379 "mode": mode, |
| 375 "no_i18n": False, | 380 "no_i18n": False, |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 467 return exit_code | 472 return exit_code |
| 468 | 473 |
| 469 except KeyboardInterrupt: | 474 except KeyboardInterrupt: |
| 470 return 1 | 475 return 1 |
| 471 | 476 |
| 472 return exit_code | 477 return exit_code |
| 473 | 478 |
| 474 | 479 |
| 475 if __name__ == "__main__": | 480 if __name__ == "__main__": |
| 476 sys.exit(Main()) | 481 sys.exit(Main()) |
| OLD | NEW |