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 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 result.add_option("--arch", | 191 result.add_option("--arch", |
192 help=("The architecture to run tests for, " | 192 help=("The architecture to run tests for, " |
193 "'auto' or 'native' for auto-detect: %s" % SUPPORTED_A
RCHS), | 193 "'auto' or 'native' for auto-detect: %s" % SUPPORTED_A
RCHS), |
194 default="ia32,x64,arm") | 194 default="ia32,x64,arm") |
195 result.add_option("--arch-and-mode", | 195 result.add_option("--arch-and-mode", |
196 help="Architecture and mode in the format 'arch.mode'", | 196 help="Architecture and mode in the format 'arch.mode'", |
197 default=None) | 197 default=None) |
198 result.add_option("--asan", | 198 result.add_option("--asan", |
199 help="Regard test expectations for ASAN", | 199 help="Regard test expectations for ASAN", |
200 default=False, action="store_true") | 200 default=False, action="store_true") |
| 201 result.add_option("--cfi-vptr", |
| 202 help="Run tests with UBSAN cfi_vptr option.", |
| 203 default=False, action="store_true") |
201 result.add_option("--buildbot", | 204 result.add_option("--buildbot", |
202 help="Adapt to path structure used on buildbots", | 205 help="Adapt to path structure used on buildbots", |
203 default=False, action="store_true") | 206 default=False, action="store_true") |
204 result.add_option("--dcheck-always-on", | 207 result.add_option("--dcheck-always-on", |
205 help="Indicates that V8 was compiled with DCHECKs enabled", | 208 help="Indicates that V8 was compiled with DCHECKs enabled", |
206 default=False, action="store_true") | 209 default=False, action="store_true") |
207 result.add_option("--novfp3", | 210 result.add_option("--novfp3", |
208 help="Indicates that V8 was compiled without VFP3 support", | 211 help="Indicates that V8 was compiled without VFP3 support", |
209 default=False, action="store_true") | 212 default=False, action="store_true") |
210 result.add_option("--cat", help="Print the source of the tests", | 213 result.add_option("--cat", help="Print the source of the tests", |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
345 | 348 |
346 def BuildbotToV8Mode(config): | 349 def BuildbotToV8Mode(config): |
347 """Convert buildbot build configs to configs understood by the v8 runner. | 350 """Convert buildbot build configs to configs understood by the v8 runner. |
348 | 351 |
349 V8 configs are always lower case and without the additional _x64 suffix for | 352 V8 configs are always lower case and without the additional _x64 suffix for |
350 64 bit builds on windows with ninja. | 353 64 bit builds on windows with ninja. |
351 """ | 354 """ |
352 mode = config[:-4] if config.endswith('_x64') else config | 355 mode = config[:-4] if config.endswith('_x64') else config |
353 return mode.lower() | 356 return mode.lower() |
354 | 357 |
| 358 def SetupEnvironment(options): |
| 359 """Setup additional environment variables.""" |
| 360 symbolizer = 'external_symbolizer_path=%s' % ( |
| 361 os.path.join( |
| 362 BASE_DIR, 'third_party', 'llvm-build', 'Release+Asserts', 'bin', |
| 363 'llvm-symbolizer', |
| 364 ) |
| 365 ) |
| 366 |
| 367 if options.asan: |
| 368 os.environ['ASAN_OPTIONS'] = symbolizer |
| 369 |
| 370 if options.cfi_vptr: |
| 371 os.environ['UBSAN_OPTIONS'] = ":".join([ |
| 372 'print_stacktrace=1', |
| 373 'print_summary=1', |
| 374 'symbolize=1', |
| 375 symbolizer, |
| 376 ]) |
| 377 |
| 378 if options.msan: |
| 379 os.environ['MSAN_OPTIONS'] = symbolizer |
| 380 |
| 381 if options.tsan: |
| 382 suppressions_file = os.path.join( |
| 383 BASE_DIR, 'tools', 'sanitizers', 'tsan_suppressions.txt') |
| 384 os.environ['TSAN_OPTIONS'] = " ".join([ |
| 385 symbolizer, |
| 386 'suppressions=%s' % suppressions_file, |
| 387 'exit_code=0', |
| 388 'report_thread_leaks=0', |
| 389 'history_size=7', |
| 390 'report_destroy_locked=0', |
| 391 ]) |
| 392 |
355 def ProcessOptions(options): | 393 def ProcessOptions(options): |
356 global ALL_VARIANTS | 394 global ALL_VARIANTS |
357 global EXHAUSTIVE_VARIANTS | 395 global EXHAUSTIVE_VARIANTS |
358 global VARIANTS | 396 global VARIANTS |
359 | 397 |
360 # Architecture and mode related stuff. | 398 # Architecture and mode related stuff. |
361 if options.arch_and_mode: | 399 if options.arch_and_mode: |
362 options.arch_and_mode = [arch_and_mode.split(".") | 400 options.arch_and_mode = [arch_and_mode.split(".") |
363 for arch_and_mode in options.arch_and_mode.split(",")] | 401 for arch_and_mode in options.arch_and_mode.split(",")] |
364 options.arch = ",".join([tokens[0] for tokens in options.arch_and_mode]) | 402 options.arch = ",".join([tokens[0] for tokens in options.arch_and_mode]) |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
409 if options.exhaustive_variants: | 447 if options.exhaustive_variants: |
410 # This is used on many bots. It includes a larger set of default variants. | 448 # This is used on many bots. It includes a larger set of default variants. |
411 # Other options for manipulating variants still apply afterwards. | 449 # Other options for manipulating variants still apply afterwards. |
412 VARIANTS = EXHAUSTIVE_VARIANTS | 450 VARIANTS = EXHAUSTIVE_VARIANTS |
413 | 451 |
414 if options.msan: | 452 if options.msan: |
415 VARIANTS = ["default"] | 453 VARIANTS = ["default"] |
416 | 454 |
417 if options.tsan: | 455 if options.tsan: |
418 VARIANTS = ["default"] | 456 VARIANTS = ["default"] |
419 suppressions_file = os.path.join(os.path.dirname(os.path.abspath(__file__)), | |
420 'sanitizers', 'tsan_suppressions.txt') | |
421 tsan_options = '%s suppressions=%s' % ( | |
422 os.environ.get('TSAN_OPTIONS', ''), suppressions_file) | |
423 os.environ['TSAN_OPTIONS'] = tsan_options | |
424 | 457 |
425 if options.j == 0: | 458 if options.j == 0: |
426 options.j = multiprocessing.cpu_count() | 459 options.j = multiprocessing.cpu_count() |
427 | 460 |
428 if options.random_seed_stress_count <= 1 and options.random_seed == 0: | 461 if options.random_seed_stress_count <= 1 and options.random_seed == 0: |
429 options.random_seed = RandomSeed() | 462 options.random_seed = RandomSeed() |
430 | 463 |
431 def excl(*args): | 464 def excl(*args): |
432 """Returns true if zero or one of multiple arguments are true.""" | 465 """Returns true if zero or one of multiple arguments are true.""" |
433 return reduce(lambda x, y: x + y, args) <= 1 | 466 return reduce(lambda x, y: x + y, args) <= 1 |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
523 | 556 |
524 def Main(): | 557 def Main(): |
525 # Use the v8 root as cwd as some test cases use "load" with relative paths. | 558 # Use the v8 root as cwd as some test cases use "load" with relative paths. |
526 os.chdir(BASE_DIR) | 559 os.chdir(BASE_DIR) |
527 | 560 |
528 parser = BuildOptions() | 561 parser = BuildOptions() |
529 (options, args) = parser.parse_args() | 562 (options, args) = parser.parse_args() |
530 if not ProcessOptions(options): | 563 if not ProcessOptions(options): |
531 parser.print_help() | 564 parser.print_help() |
532 return 1 | 565 return 1 |
| 566 SetupEnvironment(options) |
533 | 567 |
534 exit_code = 0 | 568 exit_code = 0 |
535 if not options.no_presubmit: | 569 if not options.no_presubmit: |
536 print ">>> running presubmit tests" | 570 print ">>> running presubmit tests" |
537 exit_code = subprocess.call( | 571 exit_code = subprocess.call( |
538 [sys.executable, join(BASE_DIR, "tools", "presubmit.py")]) | 572 [sys.executable, join(BASE_DIR, "tools", "presubmit.py")]) |
539 | 573 |
540 suite_paths = utils.GetSuitePaths(join(BASE_DIR, "test")) | 574 suite_paths = utils.GetSuitePaths(join(BASE_DIR, "test")) |
541 | 575 |
542 # Use default tests if no test configuration was provided at the cmd line. | 576 # Use default tests if no test configuration was provided at the cmd line. |
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
752 verbose.PrintTestDurations(suites, overall_duration) | 786 verbose.PrintTestDurations(suites, overall_duration) |
753 | 787 |
754 if num_tests == 0: | 788 if num_tests == 0: |
755 print("Warning: no tests were run!") | 789 print("Warning: no tests were run!") |
756 | 790 |
757 return exit_code | 791 return exit_code |
758 | 792 |
759 | 793 |
760 if __name__ == "__main__": | 794 if __name__ == "__main__": |
761 sys.exit(Main()) | 795 sys.exit(Main()) |
OLD | NEW |