Chromium Code Reviews| 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 16 matching lines...) Expand all Loading... | |
| 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 json |
| 34 import multiprocessing | 34 import multiprocessing |
| 35 import optparse | 35 import optparse |
| 36 import os | 36 import os |
| 37 from os.path import join | 37 from os.path import getmtime, isdir, join |
| 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.variants 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 DEFAULT_OUT_GN = "out.gn" | |
| 59 | |
| 58 ARCH_GUESS = utils.DefaultArch() | 60 ARCH_GUESS = utils.DefaultArch() |
| 59 | 61 |
| 60 # Map of test name synonyms to lists of test suites. Should be ordered by | 62 # Map of test name synonyms to lists of test suites. Should be ordered by |
| 61 # expected runtimes (suites with slow test cases first). These groups are | 63 # expected runtimes (suites with slow test cases first). These groups are |
| 62 # invoked in seperate steps on the bots. | 64 # invoked in seperate steps on the bots. |
| 63 TEST_MAP = { | 65 TEST_MAP = { |
| 64 # This needs to stay in sync with test/bot_default.isolate. | 66 # This needs to stay in sync with test/bot_default.isolate. |
| 65 "bot_default": [ | 67 "bot_default": [ |
| 66 "mjsunit", | 68 "mjsunit", |
| 67 "cctest", | 69 "cctest", |
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 287 default=False, dest="no_variants", action="store_true") | 289 default=False, dest="no_variants", action="store_true") |
| 288 result.add_option("--variants", | 290 result.add_option("--variants", |
| 289 help="Comma-separated list of testing variants;" | 291 help="Comma-separated list of testing variants;" |
| 290 " default: \"%s\"" % ",".join(VARIANTS)) | 292 " default: \"%s\"" % ",".join(VARIANTS)) |
| 291 result.add_option("--exhaustive-variants", | 293 result.add_option("--exhaustive-variants", |
| 292 default=False, action="store_true", | 294 default=False, action="store_true", |
| 293 help="Use exhaustive set of default variants:" | 295 help="Use exhaustive set of default variants:" |
| 294 " \"%s\"" % ",".join(EXHAUSTIVE_VARIANTS)) | 296 " \"%s\"" % ",".join(EXHAUSTIVE_VARIANTS)) |
| 295 result.add_option("--outdir", help="Base directory with compile output", | 297 result.add_option("--outdir", help="Base directory with compile output", |
| 296 default="out") | 298 default="out") |
| 299 result.add_option("--gn", help="Scan out.gn for the last built configuration", | |
| 300 default=False, action="store_true") | |
| 297 result.add_option("--predictable", | 301 result.add_option("--predictable", |
| 298 help="Compare output of several reruns of each test", | 302 help="Compare output of several reruns of each test", |
| 299 default=False, action="store_true") | 303 default=False, action="store_true") |
| 300 result.add_option("-p", "--progress", | 304 result.add_option("-p", "--progress", |
| 301 help=("The style of progress indicator" | 305 help=("The style of progress indicator" |
| 302 " (verbose, dots, color, mono)"), | 306 " (verbose, dots, color, mono)"), |
| 303 choices=progress.PROGRESS_INDICATORS.keys(), default="mono") | 307 choices=progress.PROGRESS_INDICATORS.keys(), default="mono") |
| 304 result.add_option("--quickcheck", default=False, action="store_true", | 308 result.add_option("--quickcheck", default=False, action="store_true", |
| 305 help=("Quick check mode (skip slow tests)")) | 309 help=("Quick check mode (skip slow tests)")) |
| 306 result.add_option("--report", help="Print a summary of the tests to be run", | 310 result.add_option("--report", help="Print a summary of the tests to be run", |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 420 'history_size=7', | 424 'history_size=7', |
| 421 'report_destroy_locked=0', | 425 'report_destroy_locked=0', |
| 422 ]) | 426 ]) |
| 423 | 427 |
| 424 def ProcessOptions(options): | 428 def ProcessOptions(options): |
| 425 global VARIANTS | 429 global VARIANTS |
| 426 | 430 |
| 427 # First try to auto-detect configurations based on the build if GN was | 431 # First try to auto-detect configurations based on the build if GN was |
| 428 # used. This can't be overridden by cmd-line arguments. | 432 # used. This can't be overridden by cmd-line arguments. |
| 429 options.auto_detect = False | 433 options.auto_detect = False |
| 434 if options.gn: | |
| 435 gn_out_dir = os.path.join(BASE_DIR, DEFAULT_OUT_GN) | |
| 436 latest_timestamp = -1 | |
| 437 latest_config = None | |
| 438 for gn_config in os.listdir(gn_out_dir): | |
| 439 gn_config_dir = os.path.join(gn_out_dir, gn_config) | |
| 440 if not isdir(gn_config_dir): | |
| 441 continue | |
| 442 if os.path.getmtime(gn_config_dir) > latest_timestamp: | |
| 443 latest_timestamp = os.path.getmtime(gn_config_dir) | |
| 444 latest_config = gn_config | |
| 445 if latest_config: | |
| 446 options.outdir = os.path.join(DEFAULT_OUT_GN, latest_config) | |
| 447 | |
| 430 build_config_path = os.path.join( | 448 build_config_path = os.path.join( |
| 431 BASE_DIR, options.outdir, "v8_build_config.json") | 449 BASE_DIR, options.outdir, "v8_build_config.json") |
| 432 if os.path.exists(build_config_path): | 450 if os.path.exists(build_config_path): |
| 433 try: | 451 try: |
| 434 with open(build_config_path) as f: | 452 with open(build_config_path) as f: |
| 435 build_config = json.load(f) | 453 build_config = json.load(f) |
| 436 except Exception: | 454 except Exception: |
| 437 print ("%s exists but contains invalid json. Is your build up-to-date?" % | 455 print ("%s exists but contains invalid json. Is your build up-to-date?" % |
| 438 build_config_path) | 456 build_config_path) |
| 439 return False | 457 return False |
| (...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 671 for (arch, mode) in options.arch_and_mode: | 689 for (arch, mode) in options.arch_and_mode: |
| 672 try: | 690 try: |
| 673 code = Execute(arch, mode, args, options, suites) | 691 code = Execute(arch, mode, args, options, suites) |
| 674 except KeyboardInterrupt: | 692 except KeyboardInterrupt: |
| 675 return 2 | 693 return 2 |
| 676 exit_code = exit_code or code | 694 exit_code = exit_code or code |
| 677 return exit_code | 695 return exit_code |
| 678 | 696 |
| 679 | 697 |
| 680 def Execute(arch, mode, args, options, suites): | 698 def Execute(arch, mode, args, options, suites): |
| 681 print(">>> Running tests for %s.%s" % (arch, mode)) | 699 print(">>> Running tests for %s.%s" % (arch, mode)) |
|
Michael Achenbach
2016/08/30 11:51:03
Optional suggestion: Maybe print the last piece of
| |
| 682 | 700 |
| 683 shell_dir = options.shell_dir | 701 shell_dir = options.shell_dir |
| 684 if not shell_dir: | 702 if not shell_dir: |
| 685 if options.buildbot: | 703 if options.buildbot: |
| 686 # TODO(machenbach): Get rid of different output folder location on | 704 # TODO(machenbach): Get rid of different output folder location on |
| 687 # buildbot. Currently this is capitalized Release and Debug. | 705 # buildbot. Currently this is capitalized Release and Debug. |
| 688 shell_dir = os.path.join(BASE_DIR, options.outdir, mode) | 706 shell_dir = os.path.join(BASE_DIR, options.outdir, mode) |
| 689 mode = BuildbotToV8Mode(mode) | 707 mode = BuildbotToV8Mode(mode) |
| 690 elif options.auto_detect: | 708 elif options.auto_detect: |
| 691 # If an output dir with a build was passed, test directly in that | 709 # If an output dir with a build was passed, test directly in that |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 879 "--coverage-dir=%s" % options.sancov_dir]) | 897 "--coverage-dir=%s" % options.sancov_dir]) |
| 880 except: | 898 except: |
| 881 print >> sys.stderr, "Error: Merging sancov files failed." | 899 print >> sys.stderr, "Error: Merging sancov files failed." |
| 882 exit_code = 1 | 900 exit_code = 1 |
| 883 | 901 |
| 884 return exit_code | 902 return exit_code |
| 885 | 903 |
| 886 | 904 |
| 887 if __name__ == "__main__": | 905 if __name__ == "__main__": |
| 888 sys.exit(Main()) | 906 sys.exit(Main()) |
| OLD | NEW |