| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright 2014 the V8 project authors. All rights reserved. | 2 # Copyright 2014 the V8 project authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 | 5 |
| 6 """ | 6 """ |
| 7 Performance runner for d8. | 7 Performance runner for d8. |
| 8 | 8 |
| 9 Call e.g. with tools/run-perf.py --arch ia32 some_suite.json | 9 Call e.g. with tools/run-perf.py --arch ia32 some_suite.json |
| 10 | 10 |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 import math | 101 import math |
| 102 import optparse | 102 import optparse |
| 103 import os | 103 import os |
| 104 import re | 104 import re |
| 105 import sys | 105 import sys |
| 106 | 106 |
| 107 from testrunner.local import commands | 107 from testrunner.local import commands |
| 108 from testrunner.local import utils | 108 from testrunner.local import utils |
| 109 | 109 |
| 110 ARCH_GUESS = utils.DefaultArch() | 110 ARCH_GUESS = utils.DefaultArch() |
| 111 SUPPORTED_ARCHS = ["android_arm", | 111 SUPPORTED_ARCHS = ["arm", |
| 112 "android_arm64", | |
| 113 "android_ia32", | |
| 114 "android_x64", | |
| 115 "arm", | |
| 116 "ia32", | 112 "ia32", |
| 117 "mips", | 113 "mips", |
| 118 "mipsel", | 114 "mipsel", |
| 119 "nacl_ia32", | 115 "nacl_ia32", |
| 120 "nacl_x64", | 116 "nacl_x64", |
| 121 "x64", | 117 "x64", |
| 122 "arm64"] | 118 "arm64"] |
| 123 | 119 |
| 124 GENERIC_RESULTS_RE = re.compile(r"^RESULT ([^:]+): ([^=]+)= ([^ ]+) ([^ ]*)$") | 120 GENERIC_RESULTS_RE = re.compile(r"^RESULT ([^:]+): ([^=]+)= ([^ ]+) ([^ ]*)$") |
| 125 RESULT_STDDEV_RE = re.compile(r"^\{([^\}]+)\}$") | 121 RESULT_STDDEV_RE = re.compile(r"^\{([^\}]+)\}$") |
| (...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 463 raise Exception("Invalid suite configuration.") | 459 raise Exception("Invalid suite configuration.") |
| 464 | 460 |
| 465 | 461 |
| 466 class Platform(object): | 462 class Platform(object): |
| 467 def __init__(self, options): | 463 def __init__(self, options): |
| 468 self.shell_dir = options.shell_dir | 464 self.shell_dir = options.shell_dir |
| 469 self.extra_flags = options.extra_flags.split() | 465 self.extra_flags = options.extra_flags.split() |
| 470 | 466 |
| 471 @staticmethod | 467 @staticmethod |
| 472 def GetPlatform(options): | 468 def GetPlatform(options): |
| 473 if options.arch.startswith("android"): | 469 if options.android_build_tools: |
| 474 return AndroidPlatform(options) | 470 return AndroidPlatform(options) |
| 475 else: | 471 else: |
| 476 return DesktopPlatform(options) | 472 return DesktopPlatform(options) |
| 477 | 473 |
| 478 | 474 |
| 479 class DesktopPlatform(Platform): | 475 class DesktopPlatform(Platform): |
| 480 def __init__(self, options): | 476 def __init__(self, options): |
| 481 super(DesktopPlatform, self).__init__(options) | 477 super(DesktopPlatform, self).__init__(options) |
| 482 | 478 |
| 483 def PreExecution(self): | 479 def PreExecution(self): |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 625 print ">>> Test timed out after %ss." % runnable.timeout | 621 print ">>> Test timed out after %ss." % runnable.timeout |
| 626 stdout = "" | 622 stdout = "" |
| 627 return stdout | 623 return stdout |
| 628 | 624 |
| 629 | 625 |
| 630 # TODO: Implement results_processor. | 626 # TODO: Implement results_processor. |
| 631 def Main(args): | 627 def Main(args): |
| 632 logging.getLogger().setLevel(logging.INFO) | 628 logging.getLogger().setLevel(logging.INFO) |
| 633 parser = optparse.OptionParser() | 629 parser = optparse.OptionParser() |
| 634 parser.add_option("--android-build-tools", | 630 parser.add_option("--android-build-tools", |
| 635 help="Path to chromium's build/android.") | 631 help="Path to chromium's build/android. Specifying this " |
| 632 "option will run tests using android platform.") |
| 636 parser.add_option("--arch", | 633 parser.add_option("--arch", |
| 637 help=("The architecture to run tests for, " | 634 help=("The architecture to run tests for, " |
| 638 "'auto' or 'native' for auto-detect"), | 635 "'auto' or 'native' for auto-detect"), |
| 639 default="x64") | 636 default="x64") |
| 640 parser.add_option("--buildbot", | 637 parser.add_option("--buildbot", |
| 641 help="Adapt to path structure used on buildbots", | 638 help="Adapt to path structure used on buildbots", |
| 642 default=False, action="store_true") | 639 default=False, action="store_true") |
| 643 parser.add_option("--device", | 640 parser.add_option("--device", |
| 644 help="The device ID to run Android tests on. If not given " | 641 help="The device ID to run Android tests on. If not given " |
| 645 "it will be autodetected.") | 642 "it will be autodetected.") |
| (...skipping 10 matching lines...) Expand all Loading... |
| 656 parser.print_help() | 653 parser.print_help() |
| 657 return 1 | 654 return 1 |
| 658 | 655 |
| 659 if options.arch in ["auto", "native"]: # pragma: no cover | 656 if options.arch in ["auto", "native"]: # pragma: no cover |
| 660 options.arch = ARCH_GUESS | 657 options.arch = ARCH_GUESS |
| 661 | 658 |
| 662 if not options.arch in SUPPORTED_ARCHS: # pragma: no cover | 659 if not options.arch in SUPPORTED_ARCHS: # pragma: no cover |
| 663 print "Unknown architecture %s" % options.arch | 660 print "Unknown architecture %s" % options.arch |
| 664 return 1 | 661 return 1 |
| 665 | 662 |
| 666 if (bool(options.arch.startswith("android")) != | 663 if (options.device and not options.android_build_tools): # pragma: no cover |
| 667 bool(options.android_build_tools)): # pragma: no cover | 664 print "Specifying a device requires Android build tools." |
| 668 print ("Android architectures imply setting --android-build-tools and the " | |
| 669 "other way around.") | |
| 670 return 1 | |
| 671 | |
| 672 if (options.device and not | |
| 673 options.arch.startswith("android")): # pragma: no cover | |
| 674 print "Specifying a device requires an Android architecture to be used." | |
| 675 return 1 | 665 return 1 |
| 676 | 666 |
| 677 workspace = os.path.abspath(os.path.join(os.path.dirname(__file__), "..")) | 667 workspace = os.path.abspath(os.path.join(os.path.dirname(__file__), "..")) |
| 678 | 668 |
| 679 if options.buildbot: | 669 if options.buildbot: |
| 680 options.shell_dir = os.path.join(workspace, options.outdir, "Release") | 670 options.shell_dir = os.path.join(workspace, options.outdir, "Release") |
| 681 else: | 671 else: |
| 682 options.shell_dir = os.path.join(workspace, options.outdir, | 672 options.shell_dir = os.path.join(workspace, options.outdir, |
| 683 "%s.release" % options.arch) | 673 "%s.release" % options.arch) |
| 684 | 674 |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 726 | 716 |
| 727 if options.json_test_results: | 717 if options.json_test_results: |
| 728 results.WriteToFile(options.json_test_results) | 718 results.WriteToFile(options.json_test_results) |
| 729 else: # pragma: no cover | 719 else: # pragma: no cover |
| 730 print results | 720 print results |
| 731 | 721 |
| 732 return min(1, len(results.errors)) | 722 return min(1, len(results.errors)) |
| 733 | 723 |
| 734 if __name__ == "__main__": # pragma: no cover | 724 if __name__ == "__main__": # pragma: no cover |
| 735 sys.exit(Main(sys.argv[1:])) | 725 sys.exit(Main(sys.argv[1:])) |
| OLD | NEW |