| 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 27 matching lines...) Expand all Loading... |
| 38 import platform | 38 import platform |
| 39 import random | 39 import random |
| 40 import shlex | 40 import shlex |
| 41 import subprocess | 41 import subprocess |
| 42 import sys | 42 import sys |
| 43 import time | 43 import time |
| 44 | 44 |
| 45 from testrunner.local import execution | 45 from testrunner.local import execution |
| 46 from testrunner.local import progress | 46 from testrunner.local import progress |
| 47 from testrunner.local import testsuite | 47 from testrunner.local import testsuite |
| 48 from testrunner.local.testsuite import ALL_VARIANTS | 48 from testrunner.local.variants import ALL_VARIANTS |
| 49 from testrunner.local import utils | 49 from testrunner.local import utils |
| 50 from testrunner.local import verbose | 50 from testrunner.local import verbose |
| 51 from testrunner.network import network_execution | 51 from testrunner.network import network_execution |
| 52 from testrunner.objects import context | 52 from testrunner.objects import context |
| 53 | 53 |
| 54 | 54 |
| 55 # Base dir of the v8 checkout to be used as cwd. | 55 # Base dir of the v8 checkout to be used as cwd. |
| 56 BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) | 56 BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) |
| 57 | 57 |
| 58 ARCH_GUESS = utils.DefaultArch() | 58 ARCH_GUESS = utils.DefaultArch() |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 264 help="Prepended to each shell command used to run a test", | 264 help="Prepended to each shell command used to run a test", |
| 265 default="") | 265 default="") |
| 266 result.add_option("--download-data", help="Download missing test suite data", | 266 result.add_option("--download-data", help="Download missing test suite data", |
| 267 default=False, action="store_true") | 267 default=False, action="store_true") |
| 268 result.add_option("--download-data-only", | 268 result.add_option("--download-data-only", |
| 269 help="Download missing test suite data and exit", | 269 help="Download missing test suite data and exit", |
| 270 default=False, action="store_true") | 270 default=False, action="store_true") |
| 271 result.add_option("--extra-flags", | 271 result.add_option("--extra-flags", |
| 272 help="Additional flags to pass to each test command", | 272 help="Additional flags to pass to each test command", |
| 273 default="") | 273 default="") |
| 274 # TODO(machenbach): Remove this flag when not reference by infrastructure. |
| 274 result.add_option("--ignition-turbofan", | 275 result.add_option("--ignition-turbofan", |
| 275 help="Skip tests which don't run in ignition_turbofan", | 276 help="Deprecated", |
| 276 default=False, action="store_true") | 277 default=False, action="store_true") |
| 277 result.add_option("--isolates", help="Whether to test isolates", | 278 result.add_option("--isolates", help="Whether to test isolates", |
| 278 default=False, action="store_true") | 279 default=False, action="store_true") |
| 279 result.add_option("-j", help="The number of parallel tasks to run", | 280 result.add_option("-j", help="The number of parallel tasks to run", |
| 280 default=0, type="int") | 281 default=0, type="int") |
| 281 result.add_option("-m", "--mode", | 282 result.add_option("-m", "--mode", |
| 282 help="The test modes in which to run (comma-separated," | 283 help="The test modes in which to run (comma-separated," |
| 283 " uppercase for ninja and buildbot builds): %s" % MODES.keys
(), | 284 " uppercase for ninja and buildbot builds): %s" % MODES.keys
(), |
| 284 default="release,debug") | 285 default="release,debug") |
| 285 result.add_option("--no-harness", "--noharness", | 286 result.add_option("--no-harness", "--noharness", |
| (...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 772 arch in ['arm64', 'arm', 'mipsel', 'mips', 'mips64', 'mips64el', \ | 773 arch in ['arm64', 'arm', 'mipsel', 'mips', 'mips64', 'mips64el', \ |
| 773 'ppc', 'ppc64'] and \ | 774 'ppc', 'ppc64'] and \ |
| 774 ARCH_GUESS and arch != ARCH_GUESS | 775 ARCH_GUESS and arch != ARCH_GUESS |
| 775 # Find available test suites and read test cases from them. | 776 # Find available test suites and read test cases from them. |
| 776 variables = { | 777 variables = { |
| 777 "arch": arch, | 778 "arch": arch, |
| 778 "asan": options.asan, | 779 "asan": options.asan, |
| 779 "deopt_fuzzer": False, | 780 "deopt_fuzzer": False, |
| 780 "gc_stress": options.gc_stress, | 781 "gc_stress": options.gc_stress, |
| 781 "gcov_coverage": options.gcov_coverage, | 782 "gcov_coverage": options.gcov_coverage, |
| 782 "ignition_turbofan": options.ignition_turbofan, | |
| 783 "isolates": options.isolates, | 783 "isolates": options.isolates, |
| 784 "mode": MODES[mode]["status_mode"], | 784 "mode": MODES[mode]["status_mode"], |
| 785 "no_i18n": options.no_i18n, | 785 "no_i18n": options.no_i18n, |
| 786 "no_snap": options.no_snap, | 786 "no_snap": options.no_snap, |
| 787 "simulator_run": simulator_run, | 787 "simulator_run": simulator_run, |
| 788 "simulator": utils.UseSimulator(arch), | 788 "simulator": utils.UseSimulator(arch), |
| 789 "system": utils.GuessOS(), | 789 "system": utils.GuessOS(), |
| 790 "tsan": options.tsan, | 790 "tsan": options.tsan, |
| 791 "msan": options.msan, | 791 "msan": options.msan, |
| 792 "dcheck_always_on": options.dcheck_always_on, | 792 "dcheck_always_on": options.dcheck_always_on, |
| 793 "novfp3": options.novfp3, | 793 "novfp3": options.novfp3, |
| 794 "predictable": options.predictable, | 794 "predictable": options.predictable, |
| 795 "byteorder": sys.byteorder, | 795 "byteorder": sys.byteorder, |
| 796 } | 796 } |
| 797 all_tests = [] | 797 all_tests = [] |
| 798 num_tests = 0 | 798 num_tests = 0 |
| 799 for s in suites: | 799 for s in suites: |
| 800 s.ReadStatusFile(variables) | 800 s.ReadStatusFile(variables) |
| 801 s.ReadTestCases(ctx) | 801 s.ReadTestCases(ctx) |
| 802 if len(args) > 0: | 802 if len(args) > 0: |
| 803 s.FilterTestCasesByArgs(args) | 803 s.FilterTestCasesByArgs(args) |
| 804 all_tests += s.tests | 804 all_tests += s.tests |
| 805 |
| 806 # First filtering by status applying the generic rules (independent of |
| 807 # variants). |
| 805 s.FilterTestCasesByStatus(options.warn_unused, options.slow_tests, | 808 s.FilterTestCasesByStatus(options.warn_unused, options.slow_tests, |
| 806 options.pass_fail_tests) | 809 options.pass_fail_tests) |
| 810 |
| 807 if options.cat: | 811 if options.cat: |
| 808 verbose.PrintTestSource(s.tests) | 812 verbose.PrintTestSource(s.tests) |
| 809 continue | 813 continue |
| 810 variant_gen = s.CreateVariantGenerator(VARIANTS) | 814 variant_gen = s.CreateVariantGenerator(VARIANTS) |
| 811 variant_tests = [ t.CopyAddingFlags(v, flags) | 815 variant_tests = [ t.CopyAddingFlags(v, flags) |
| 812 for t in s.tests | 816 for t in s.tests |
| 813 for v in variant_gen.FilterVariantsByTest(t) | 817 for v in variant_gen.FilterVariantsByTest(t) |
| 814 for flags in variant_gen.GetFlagSets(t, v) ] | 818 for flags in variant_gen.GetFlagSets(t, v) ] |
| 815 | 819 |
| 816 if options.random_seed_stress_count > 1: | 820 if options.random_seed_stress_count > 1: |
| 817 # Duplicate test for random seed stress mode. | 821 # Duplicate test for random seed stress mode. |
| 818 def iter_seed_flags(): | 822 def iter_seed_flags(): |
| 819 for i in range(0, options.random_seed_stress_count): | 823 for i in range(0, options.random_seed_stress_count): |
| 820 # Use given random seed for all runs (set by default in execution.py) | 824 # Use given random seed for all runs (set by default in execution.py) |
| 821 # or a new random seed if none is specified. | 825 # or a new random seed if none is specified. |
| 822 if options.random_seed: | 826 if options.random_seed: |
| 823 yield [] | 827 yield [] |
| 824 else: | 828 else: |
| 825 yield ["--random-seed=%d" % RandomSeed()] | 829 yield ["--random-seed=%d" % RandomSeed()] |
| 826 s.tests = [ | 830 s.tests = [ |
| 827 t.CopyAddingFlags(t.variant, flags) | 831 t.CopyAddingFlags(t.variant, flags) |
| 828 for t in variant_tests | 832 for t in variant_tests |
| 829 for flags in iter_seed_flags() | 833 for flags in iter_seed_flags() |
| 830 ] | 834 ] |
| 831 else: | 835 else: |
| 832 s.tests = variant_tests | 836 s.tests = variant_tests |
| 833 | 837 |
| 838 # Second filtering by status applying the variant-dependent rules. |
| 839 s.FilterTestCasesByStatus(options.warn_unused, options.slow_tests, |
| 840 options.pass_fail_tests, variants=True) |
| 841 |
| 834 s.tests = ShardTests(s.tests, options) | 842 s.tests = ShardTests(s.tests, options) |
| 835 num_tests += len(s.tests) | 843 num_tests += len(s.tests) |
| 836 | 844 |
| 837 if options.cat: | 845 if options.cat: |
| 838 return 0 # We're done here. | 846 return 0 # We're done here. |
| 839 | 847 |
| 840 if options.report: | 848 if options.report: |
| 841 verbose.PrintReport(all_tests) | 849 verbose.PrintReport(all_tests) |
| 842 | 850 |
| 843 # Run the tests, either locally or distributed on the network. | 851 # Run the tests, either locally or distributed on the network. |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 902 "--coverage-dir=%s" % options.sancov_dir]) | 910 "--coverage-dir=%s" % options.sancov_dir]) |
| 903 except: | 911 except: |
| 904 print >> sys.stderr, "Error: Merging sancov files failed." | 912 print >> sys.stderr, "Error: Merging sancov files failed." |
| 905 exit_code = 1 | 913 exit_code = 1 |
| 906 | 914 |
| 907 return exit_code | 915 return exit_code |
| 908 | 916 |
| 909 | 917 |
| 910 if __name__ == "__main__": | 918 if __name__ == "__main__": |
| 911 sys.exit(Main()) | 919 sys.exit(Main()) |
| OLD | NEW |