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 12 matching lines...) Expand all Loading... |
23 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 23 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
24 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
25 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
26 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
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 from collections import OrderedDict | 31 from collections import OrderedDict |
32 import itertools | 32 import itertools |
| 33 import json |
33 import multiprocessing | 34 import multiprocessing |
34 import optparse | 35 import optparse |
35 import os | 36 import os |
36 from os.path import join | 37 from os.path import join |
37 import platform | 38 import platform |
38 import random | 39 import random |
39 import shlex | 40 import shlex |
40 import subprocess | 41 import subprocess |
41 import sys | 42 import sys |
42 import time | 43 import time |
(...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
427 'report_thread_leaks=0', | 428 'report_thread_leaks=0', |
428 'history_size=7', | 429 'history_size=7', |
429 'report_destroy_locked=0', | 430 'report_destroy_locked=0', |
430 ]) | 431 ]) |
431 | 432 |
432 def ProcessOptions(options): | 433 def ProcessOptions(options): |
433 global ALL_VARIANTS | 434 global ALL_VARIANTS |
434 global EXHAUSTIVE_VARIANTS | 435 global EXHAUSTIVE_VARIANTS |
435 global VARIANTS | 436 global VARIANTS |
436 | 437 |
| 438 # First try to auto-detect configurations based on the build if GN was |
| 439 # used. This can't be overridden by cmd-line arguments. |
| 440 options.auto_detect = False |
| 441 build_config_path = os.path.join( |
| 442 BASE_DIR, options.outdir, "v8_build_config.json") |
| 443 if os.path.exists(build_config_path): |
| 444 try: |
| 445 with open(build_config_path) as f: |
| 446 build_config = json.load(f) |
| 447 except Exception: |
| 448 print ("%s exists but contains invalid json. Is your build up-to-date?" % |
| 449 build_config_path) |
| 450 return False |
| 451 options.auto_detect = True |
| 452 |
| 453 options.arch_and_mode = None |
| 454 options.arch = build_config["v8_target_cpu"] |
| 455 if options.arch == 'x86': |
| 456 # TODO(machenbach): Transform all to x86 eventually. |
| 457 options.arch = 'ia32' |
| 458 options.asan = build_config["is_asan"] |
| 459 options.dcheck_always_on = build_config["dcheck_always_on"] |
| 460 options.mode = 'debug' if build_config["is_debug"] else 'release' |
| 461 options.msan = build_config["is_msan"] |
| 462 options.no_i18n = not build_config["v8_enable_i18n_support"] |
| 463 options.no_snap = not build_config["v8_use_snapshot"] |
| 464 options.tsan = build_config["is_tsan"] |
| 465 |
437 # Architecture and mode related stuff. | 466 # Architecture and mode related stuff. |
438 if options.arch_and_mode: | 467 if options.arch_and_mode: |
439 options.arch_and_mode = [arch_and_mode.split(".") | 468 options.arch_and_mode = [arch_and_mode.split(".") |
440 for arch_and_mode in options.arch_and_mode.split(",")] | 469 for arch_and_mode in options.arch_and_mode.split(",")] |
441 options.arch = ",".join([tokens[0] for tokens in options.arch_and_mode]) | 470 options.arch = ",".join([tokens[0] for tokens in options.arch_and_mode]) |
442 options.mode = ",".join([tokens[1] for tokens in options.arch_and_mode]) | 471 options.mode = ",".join([tokens[1] for tokens in options.arch_and_mode]) |
443 options.mode = options.mode.split(",") | 472 options.mode = options.mode.split(",") |
444 for mode in options.mode: | 473 for mode in options.mode: |
445 if not BuildbotToV8Mode(mode) in MODES: | 474 if not BuildbotToV8Mode(mode) in MODES: |
446 print "Unknown mode %s" % mode | 475 print "Unknown mode %s" % mode |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
660 def Execute(arch, mode, args, options, suites): | 689 def Execute(arch, mode, args, options, suites): |
661 print(">>> Running tests for %s.%s" % (arch, mode)) | 690 print(">>> Running tests for %s.%s" % (arch, mode)) |
662 | 691 |
663 shell_dir = options.shell_dir | 692 shell_dir = options.shell_dir |
664 if not shell_dir: | 693 if not shell_dir: |
665 if options.buildbot: | 694 if options.buildbot: |
666 # TODO(machenbach): Get rid of different output folder location on | 695 # TODO(machenbach): Get rid of different output folder location on |
667 # buildbot. Currently this is capitalized Release and Debug. | 696 # buildbot. Currently this is capitalized Release and Debug. |
668 shell_dir = os.path.join(BASE_DIR, options.outdir, mode) | 697 shell_dir = os.path.join(BASE_DIR, options.outdir, mode) |
669 mode = BuildbotToV8Mode(mode) | 698 mode = BuildbotToV8Mode(mode) |
| 699 elif options.auto_detect: |
| 700 # If an output dir with a build was passed, test directly in that |
| 701 # directory. |
| 702 shell_dir = os.path.join(BASE_DIR, options.outdir) |
670 else: | 703 else: |
671 shell_dir = os.path.join( | 704 shell_dir = os.path.join( |
672 BASE_DIR, | 705 BASE_DIR, |
673 options.outdir, | 706 options.outdir, |
674 "%s.%s" % (arch, MODES[mode]["output_folder"]), | 707 "%s.%s" % (arch, MODES[mode]["output_folder"]), |
675 ) | 708 ) |
676 if not os.path.exists(shell_dir): | 709 if not os.path.exists(shell_dir): |
677 raise Exception('Could not find shell_dir: "%s"' % shell_dir) | 710 raise Exception('Could not find shell_dir: "%s"' % shell_dir) |
678 | 711 |
679 # Populate context object. | 712 # Populate context object. |
(...skipping 25 matching lines...) Expand all Loading... |
705 options.random_seed, | 738 options.random_seed, |
706 options.no_sorting, | 739 options.no_sorting, |
707 options.rerun_failures_count, | 740 options.rerun_failures_count, |
708 options.rerun_failures_max, | 741 options.rerun_failures_max, |
709 options.predictable, | 742 options.predictable, |
710 options.no_harness, | 743 options.no_harness, |
711 use_perf_data=not options.swarming, | 744 use_perf_data=not options.swarming, |
712 sancov_dir=options.sancov_dir) | 745 sancov_dir=options.sancov_dir) |
713 | 746 |
714 # TODO(all): Combine "simulator" and "simulator_run". | 747 # TODO(all): Combine "simulator" and "simulator_run". |
| 748 # TODO(machenbach): In GN we can derive simulator run from |
| 749 # target_arch != v8_target_arch in the dumped build config. |
715 simulator_run = not options.dont_skip_simulator_slow_tests and \ | 750 simulator_run = not options.dont_skip_simulator_slow_tests and \ |
716 arch in ['arm64', 'arm', 'mipsel', 'mips', 'mips64', 'mips64el', \ | 751 arch in ['arm64', 'arm', 'mipsel', 'mips', 'mips64', 'mips64el', \ |
717 'ppc', 'ppc64'] and \ | 752 'ppc', 'ppc64'] and \ |
718 ARCH_GUESS and arch != ARCH_GUESS | 753 ARCH_GUESS and arch != ARCH_GUESS |
719 # Find available test suites and read test cases from them. | 754 # Find available test suites and read test cases from them. |
720 variables = { | 755 variables = { |
721 "arch": arch, | 756 "arch": arch, |
722 "asan": options.asan, | 757 "asan": options.asan, |
723 "deopt_fuzzer": False, | 758 "deopt_fuzzer": False, |
724 "gc_stress": options.gc_stress, | 759 "gc_stress": options.gc_stress, |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
847 "--coverage-dir=%s" % options.sancov_dir]) | 882 "--coverage-dir=%s" % options.sancov_dir]) |
848 except: | 883 except: |
849 print >> sys.stderr, "Error: Merging sancov files failed." | 884 print >> sys.stderr, "Error: Merging sancov files failed." |
850 exit_code = 1 | 885 exit_code = 1 |
851 | 886 |
852 return exit_code | 887 return exit_code |
853 | 888 |
854 | 889 |
855 if __name__ == "__main__": | 890 if __name__ == "__main__": |
856 sys.exit(Main()) | 891 sys.exit(Main()) |
OLD | NEW |