Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(162)

Side by Side Diff: build/android/test_runner.py

Issue 681713002: Update from chromium https://crrev.com/301315 (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « build/android/pylib/constants.py ('k') | build/common.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # 2 #
3 # Copyright 2013 The Chromium Authors. All rights reserved. 3 # Copyright 2013 The Chromium Authors. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be 4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file. 5 # found in the LICENSE file.
6 6
7 """Runs all types of tests from one unified interface.""" 7 """Runs all types of tests from one unified interface."""
8 8
9 import collections 9 import collections
10 import logging 10 import logging
11 import optparse 11 import optparse
12 import os 12 import os
13 import shutil 13 import shutil
14 import signal 14 import signal
15 import sys 15 import sys
16 import threading 16 import threading
17 import unittest
17 18
18 from pylib import android_commands 19 from pylib import android_commands
19 from pylib import constants 20 from pylib import constants
20 from pylib import forwarder 21 from pylib import forwarder
21 from pylib import ports 22 from pylib import ports
22 from pylib.base import base_test_result 23 from pylib.base import base_test_result
23 from pylib.base import test_dispatcher 24 from pylib.base import test_dispatcher
24 from pylib.gtest import gtest_config 25 from pylib.gtest import gtest_config
25 from pylib.gtest import setup as gtest_setup 26 from pylib.gtest import setup as gtest_setup
26 from pylib.gtest import test_options as gtest_test_options 27 from pylib.gtest import test_options as gtest_test_options
(...skipping 10 matching lines...) Expand all
37 from pylib.perf import test_runner as perf_test_runner 38 from pylib.perf import test_runner as perf_test_runner
38 from pylib.uiautomator import setup as uiautomator_setup 39 from pylib.uiautomator import setup as uiautomator_setup
39 from pylib.uiautomator import test_options as uiautomator_test_options 40 from pylib.uiautomator import test_options as uiautomator_test_options
40 from pylib.utils import apk_helper 41 from pylib.utils import apk_helper
41 from pylib.utils import command_option_parser 42 from pylib.utils import command_option_parser
42 from pylib.utils import report_results 43 from pylib.utils import report_results
43 from pylib.utils import reraiser_thread 44 from pylib.utils import reraiser_thread
44 from pylib.utils import run_tests_helper 45 from pylib.utils import run_tests_helper
45 46
46 47
48 HOST_TESTS = ['junit', 'python']
49
50
47 def AddCommonOptions(option_parser): 51 def AddCommonOptions(option_parser):
48 """Adds all common options to |option_parser|.""" 52 """Adds all common options to |option_parser|."""
49 53
50 group = optparse.OptionGroup(option_parser, 'Common Options') 54 group = optparse.OptionGroup(option_parser, 'Common Options')
51 default_build_type = os.environ.get('BUILDTYPE', 'Debug') 55 default_build_type = os.environ.get('BUILDTYPE', 'Debug')
52 group.add_option('--debug', action='store_const', const='Debug', 56 group.add_option('--debug', action='store_const', const='Debug',
53 dest='build_type', default=default_build_type, 57 dest='build_type', default=default_build_type,
54 help=('If set, run test suites under out/Debug. ' 58 help=('If set, run test suites under out/Debug. '
55 'Default is env var BUILDTYPE or Debug.')) 59 'Default is env var BUILDTYPE or Debug.'))
56 group.add_option('--release', action='store_const', 60 group.add_option('--release', action='store_const',
57 const='Release', dest='build_type', 61 const='Release', dest='build_type',
58 help=('If set, run test suites under out/Release.' 62 help=('If set, run test suites under out/Release.'
59 ' Default is env var BUILDTYPE or Debug.')) 63 ' Default is env var BUILDTYPE or Debug.'))
60 group.add_option('--build-directory', dest='build_directory', 64 group.add_option('--build-directory', dest='build_directory',
61 help=('Path to the directory in which build files are' 65 help=('Path to the directory in which build files are'
62 ' located (should not include build type)')) 66 ' located (should not include build type)'))
63 group.add_option('-c', dest='cleanup_test_files',
64 help='Cleanup test files on the device after run',
65 action='store_true')
66 group.add_option('--num_retries', dest='num_retries', type='int', 67 group.add_option('--num_retries', dest='num_retries', type='int',
67 default=2, 68 default=2,
68 help=('Number of retries for a test before ' 69 help=('Number of retries for a test before '
69 'giving up.')) 70 'giving up.'))
70 group.add_option('-v', 71 group.add_option('-v',
71 '--verbose', 72 '--verbose',
72 dest='verbose_count', 73 dest='verbose_count',
73 default=0, 74 default=0,
74 action='count', 75 action='count',
75 help='Verbose level (multiple times for more)') 76 help='Verbose level (multiple times for more)')
76 group.add_option('--tool',
77 dest='tool',
78 help=('Run the test under a tool '
79 '(use --tool help to list them)'))
80 group.add_option('--flakiness-dashboard-server', 77 group.add_option('--flakiness-dashboard-server',
81 dest='flakiness_dashboard_server', 78 dest='flakiness_dashboard_server',
82 help=('Address of the server that is hosting the ' 79 help=('Address of the server that is hosting the '
83 'Chrome for Android flakiness dashboard.')) 80 'Chrome for Android flakiness dashboard.'))
84 group.add_option('--skip-deps-push', dest='push_deps',
85 action='store_false', default=True,
86 help=('Do not push dependencies to the device. '
87 'Use this at own risk for speeding up test '
88 'execution on local machine.'))
89 group.add_option('-d', '--device', dest='test_device',
90 help=('Target device for the test suite '
91 'to run on.'))
92 option_parser.add_option_group(group) 81 option_parser.add_option_group(group)
93 82
94 83
95 def ProcessCommonOptions(options): 84 def ProcessCommonOptions(options):
96 """Processes and handles all common options.""" 85 """Processes and handles all common options."""
97 run_tests_helper.SetLogLevel(options.verbose_count) 86 run_tests_helper.SetLogLevel(options.verbose_count)
98 constants.SetBuildType(options.build_type) 87 constants.SetBuildType(options.build_type)
99 if options.build_directory: 88 if options.build_directory:
100 constants.SetBuildDirectory(options.build_directory) 89 constants.SetBuildDirectory(options.build_directory)
101 90
102 91
92 def AddDeviceOptions(option_parser):
93 group = optparse.OptionGroup(option_parser, 'Device Options')
94 group.add_option('-c', dest='cleanup_test_files',
95 help='Cleanup test files on the device after run',
96 action='store_true')
97 group.add_option('--tool',
98 dest='tool',
99 help=('Run the test under a tool '
100 '(use --tool help to list them)'))
101 group.add_option('--skip-deps-push', dest='push_deps',
102 action='store_false', default=True,
103 help=('Do not push dependencies to the device. '
104 'Use this at own risk for speeding up test '
105 'execution on local machine.'))
106 group.add_option('-d', '--device', dest='test_device',
107 help=('Target device for the test suite '
108 'to run on.'))
109 option_parser.add_option_group(group)
110
111
103 def AddGTestOptions(option_parser): 112 def AddGTestOptions(option_parser):
104 """Adds gtest options to |option_parser|.""" 113 """Adds gtest options to |option_parser|."""
105 114
106 option_parser.usage = '%prog gtest [options]' 115 option_parser.usage = '%prog gtest [options]'
107 option_parser.commands_dict = {} 116 option_parser.commands_dict = {}
108 option_parser.example = '%prog gtest -s base_unittests' 117 option_parser.example = '%prog gtest -s base_unittests'
109 118
110 # TODO(gkanwar): Make this option required 119 # TODO(gkanwar): Make this option required
111 option_parser.add_option('-s', '--suite', dest='suite_name', 120 option_parser.add_option('-s', '--suite', dest='suite_name',
112 help=('Executable name of the test suite to run ' 121 help=('Executable name of the test suite to run '
(...skipping 13 matching lines...) Expand all
126 type='int', 135 type='int',
127 default=60) 136 default=60)
128 option_parser.add_option('--isolate_file_path', 137 option_parser.add_option('--isolate_file_path',
129 '--isolate-file-path', 138 '--isolate-file-path',
130 dest='isolate_file_path', 139 dest='isolate_file_path',
131 help='.isolate file path to override the default ' 140 help='.isolate file path to override the default '
132 'path') 141 'path')
133 # TODO(gkanwar): Move these to Common Options once we have the plumbing 142 # TODO(gkanwar): Move these to Common Options once we have the plumbing
134 # in our other test types to handle these commands 143 # in our other test types to handle these commands
135 AddCommonOptions(option_parser) 144 AddCommonOptions(option_parser)
145 AddDeviceOptions(option_parser)
136 146
137 147
138 def AddLinkerTestOptions(option_parser): 148 def AddLinkerTestOptions(option_parser):
139 option_parser.usage = '%prog linker' 149 option_parser.usage = '%prog linker'
140 option_parser.commands_dict = {} 150 option_parser.commands_dict = {}
141 option_parser.example = '%prog linker' 151 option_parser.example = '%prog linker'
142 152
143 option_parser.add_option('-f', '--gtest-filter', dest='test_filter', 153 option_parser.add_option('-f', '--gtest-filter', dest='test_filter',
144 help='googletest-style filter string.') 154 help='googletest-style filter string.')
145 AddCommonOptions(option_parser) 155 AddCommonOptions(option_parser)
156 AddDeviceOptions(option_parser)
146 157
147 158
148 def ProcessGTestOptions(options): 159 def ProcessGTestOptions(options):
149 """Intercept test suite help to list test suites. 160 """Intercept test suite help to list test suites.
150 161
151 Args: 162 Args:
152 options: Command line options. 163 options: Command line options.
153 """ 164 """
154 if options.suite_name == 'help': 165 if options.suite_name == 'help':
155 print 'Available test suites are:' 166 print 'Available test suites are:'
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 def AddInstrumentationTestOptions(option_parser): 230 def AddInstrumentationTestOptions(option_parser):
220 """Adds Instrumentation test options to |option_parser|.""" 231 """Adds Instrumentation test options to |option_parser|."""
221 232
222 option_parser.usage = '%prog instrumentation [options]' 233 option_parser.usage = '%prog instrumentation [options]'
223 option_parser.commands_dict = {} 234 option_parser.commands_dict = {}
224 option_parser.example = ('%prog instrumentation ' 235 option_parser.example = ('%prog instrumentation '
225 '--test-apk=ChromeShellTest') 236 '--test-apk=ChromeShellTest')
226 237
227 AddJavaTestOptions(option_parser) 238 AddJavaTestOptions(option_parser)
228 AddCommonOptions(option_parser) 239 AddCommonOptions(option_parser)
240 AddDeviceOptions(option_parser)
229 241
230 option_parser.add_option('-j', '--java-only', action='store_true', 242 option_parser.add_option('-j', '--java-only', action='store_true',
231 default=False, help='Run only the Java tests.') 243 default=False, help='Run only the Java tests.')
232 option_parser.add_option('-p', '--python-only', action='store_true', 244 option_parser.add_option('-p', '--python-only', action='store_true',
233 default=False, 245 default=False,
234 help='Run only the host-driven tests.') 246 help='Run only the host-driven tests.')
235 option_parser.add_option('--host-driven-root', 247 option_parser.add_option('--host-driven-root',
236 help='Root of the host-driven tests.') 248 help='Root of the host-driven tests.')
237 option_parser.add_option('-w', '--wait_debugger', dest='wait_for_debugger', 249 option_parser.add_option('-w', '--wait_debugger', dest='wait_for_debugger',
238 action='store_true', 250 action='store_true',
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
327 help=('Package under test. Possible values: %s' % 339 help=('Package under test. Possible values: %s' %
328 constants.PACKAGE_INFO.keys())) 340 constants.PACKAGE_INFO.keys()))
329 option_parser.add_option( 341 option_parser.add_option(
330 '--test-jar', dest='test_jar', 342 '--test-jar', dest='test_jar',
331 help=('The name of the dexed jar containing the tests (without the ' 343 help=('The name of the dexed jar containing the tests (without the '
332 '.dex.jar extension). Alternatively, this can be a full path ' 344 '.dex.jar extension). Alternatively, this can be a full path '
333 'to the jar.')) 345 'to the jar.'))
334 346
335 AddJavaTestOptions(option_parser) 347 AddJavaTestOptions(option_parser)
336 AddCommonOptions(option_parser) 348 AddCommonOptions(option_parser)
349 AddDeviceOptions(option_parser)
337 350
338 351
339 def ProcessUIAutomatorOptions(options, error_func): 352 def ProcessUIAutomatorOptions(options, error_func):
340 """Processes UIAutomator options/arguments. 353 """Processes UIAutomator options/arguments.
341 354
342 Args: 355 Args:
343 options: optparse.Options object. 356 options: optparse.Options object.
344 error_func: Function to call with the error message in case of an error. 357 error_func: Function to call with the error message in case of an error.
345 358
346 Returns: 359 Returns:
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
440 option_parser.add_option( 453 option_parser.add_option(
441 '--seed', type='int', 454 '--seed', type='int',
442 help=('Seed value for pseudo-random generator. Same seed value generates ' 455 help=('Seed value for pseudo-random generator. Same seed value generates '
443 'the same sequence of events. Seed is randomized by default.')) 456 'the same sequence of events. Seed is randomized by default.'))
444 option_parser.add_option( 457 option_parser.add_option(
445 '--extra-args', default='', 458 '--extra-args', default='',
446 help=('String of other args to pass to the command verbatim ' 459 help=('String of other args to pass to the command verbatim '
447 '[default: "%default"].')) 460 '[default: "%default"].'))
448 461
449 AddCommonOptions(option_parser) 462 AddCommonOptions(option_parser)
463 AddDeviceOptions(option_parser)
450 464
451 465
452 def ProcessMonkeyTestOptions(options, error_func): 466 def ProcessMonkeyTestOptions(options, error_func):
453 """Processes all monkey test options. 467 """Processes all monkey test options.
454 468
455 Args: 469 Args:
456 options: optparse.Options object. 470 options: optparse.Options object.
457 error_func: Function to call with the error message in case of an error. 471 error_func: Function to call with the error message in case of an error.
458 472
459 Returns: 473 Returns:
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
513 help=('Do not impose a timeout. Each perf step is responsible for ' 527 help=('Do not impose a timeout. Each perf step is responsible for '
514 'implementing the timeout logic.')) 528 'implementing the timeout logic.'))
515 option_parser.add_option( 529 option_parser.add_option(
516 '-f', '--test-filter', 530 '-f', '--test-filter',
517 help=('Test filter (will match against the names listed in --steps).')) 531 help=('Test filter (will match against the names listed in --steps).'))
518 option_parser.add_option( 532 option_parser.add_option(
519 '--dry-run', 533 '--dry-run',
520 action='store_true', 534 action='store_true',
521 help='Just print the steps without executing.') 535 help='Just print the steps without executing.')
522 AddCommonOptions(option_parser) 536 AddCommonOptions(option_parser)
537 AddDeviceOptions(option_parser)
523 538
524 539
525 def ProcessPerfTestOptions(options, args, error_func): 540 def ProcessPerfTestOptions(options, args, error_func):
526 """Processes all perf test options. 541 """Processes all perf test options.
527 542
528 Args: 543 Args:
529 options: optparse.Options object. 544 options: optparse.Options object.
530 error_func: Function to call with the error message in case of an error. 545 error_func: Function to call with the error message in case of an error.
531 546
532 Returns: 547 Returns:
533 A PerfOptions named tuple which contains all options relevant to 548 A PerfOptions named tuple which contains all options relevant to
534 perf tests. 549 perf tests.
535 """ 550 """
536 # Only one of steps, print_step or single_step must be provided. 551 # Only one of steps, print_step or single_step must be provided.
537 count = len(filter(None, 552 count = len(filter(None,
538 [options.steps, options.print_step, options.single_step])) 553 [options.steps, options.print_step, options.single_step]))
539 if count != 1: 554 if count != 1:
540 error_func('Please specify one of: --steps, --print-step, --single-step.') 555 error_func('Please specify one of: --steps, --print-step, --single-step.')
541 single_step = None 556 single_step = None
542 if options.single_step: 557 if options.single_step:
543 single_step = ' '.join(args[2:]) 558 single_step = ' '.join(args[2:])
544 return perf_test_options.PerfOptions( 559 return perf_test_options.PerfOptions(
545 options.steps, options.flaky_steps, options.output_json_list, 560 options.steps, options.flaky_steps, options.output_json_list,
546 options.print_step, options.no_timeout, options.test_filter, 561 options.print_step, options.no_timeout, options.test_filter,
547 options.dry_run, single_step) 562 options.dry_run, single_step)
548 563
549 564
565 def AddPythonTestOptions(option_parser):
566 option_parser.add_option('-s', '--suite', dest='suite_name',
567 help=('Name of the test suite to run'
568 '(use -s help to list them).'))
569 AddCommonOptions(option_parser)
570
571
572 def ProcessPythonTestOptions(options, error_func):
573 if options.suite_name not in constants.PYTHON_UNIT_TEST_SUITES:
574 available = ('Available test suites: [%s]' %
575 ', '.join(constants.PYTHON_UNIT_TEST_SUITES.iterkeys()))
576 if options.suite_name == 'help':
577 print available
578 else:
579 error_func('"%s" is not a valid suite. %s' %
580 (options.suite_name, available))
581
582
550 def _RunGTests(options, devices): 583 def _RunGTests(options, devices):
551 """Subcommand of RunTestsCommands which runs gtests.""" 584 """Subcommand of RunTestsCommands which runs gtests."""
552 ProcessGTestOptions(options) 585 ProcessGTestOptions(options)
553 586
554 exit_code = 0 587 exit_code = 0
555 for suite_name in options.suite_name: 588 for suite_name in options.suite_name:
556 # TODO(gkanwar): Move this into ProcessGTestOptions once we require -s for 589 # TODO(gkanwar): Move this into ProcessGTestOptions once we require -s for
557 # the gtest command. 590 # the gtest command.
558 gtest_options = gtest_test_options.GTestOptions( 591 gtest_options = gtest_test_options.GTestOptions(
559 options.tool, 592 options.tool,
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
730 if perf_options.single_step: 763 if perf_options.single_step:
731 return perf_test_runner.PrintTestOutput('single_step') 764 return perf_test_runner.PrintTestOutput('single_step')
732 765
733 perf_test_runner.PrintSummary(tests) 766 perf_test_runner.PrintSummary(tests)
734 767
735 # Always return 0 on the sharding stage. Individual tests exit_code 768 # Always return 0 on the sharding stage. Individual tests exit_code
736 # will be returned on the print_step stage. 769 # will be returned on the print_step stage.
737 return 0 770 return 0
738 771
739 772
773 def _RunPythonTests(options, error_func):
774 """Subcommand of RunTestsCommand which runs python unit tests."""
775 ProcessPythonTestOptions(options, error_func)
776
777 suite_vars = constants.PYTHON_UNIT_TEST_SUITES[options.suite_name]
778 suite_path = suite_vars['path']
779 suite_test_modules = suite_vars['test_modules']
780
781 sys.path = [suite_path] + sys.path
782 try:
783 suite = unittest.TestSuite()
784 suite.addTests(unittest.defaultTestLoader.loadTestsFromName(m)
785 for m in suite_test_modules)
786 runner = unittest.TextTestRunner(verbosity=1+options.verbose_count)
787 return 0 if runner.run(suite).wasSuccessful() else 1
788 finally:
789 sys.path = sys.path[1:]
790
791
740 def _GetAttachedDevices(test_device=None): 792 def _GetAttachedDevices(test_device=None):
741 """Get all attached devices. 793 """Get all attached devices.
742 794
743 Args: 795 Args:
744 test_device: Name of a specific device to use. 796 test_device: Name of a specific device to use.
745 797
746 Returns: 798 Returns:
747 A list of attached devices. 799 A list of attached devices.
748 """ 800 """
749 attached_devices = [] 801 attached_devices = []
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
783 option_parser.error('Unrecognized arguments: %s' % (' '.join(args[2:]))) 835 option_parser.error('Unrecognized arguments: %s' % (' '.join(args[2:])))
784 return constants.ERROR_EXIT_CODE 836 return constants.ERROR_EXIT_CODE
785 if command == 'perf': 837 if command == 'perf':
786 if ((options.single_step and len(args) <= 2) or 838 if ((options.single_step and len(args) <= 2) or
787 (not options.single_step and len(args) > 2)): 839 (not options.single_step and len(args) > 2)):
788 option_parser.error('Unrecognized arguments: %s' % (' '.join(args))) 840 option_parser.error('Unrecognized arguments: %s' % (' '.join(args)))
789 return constants.ERROR_EXIT_CODE 841 return constants.ERROR_EXIT_CODE
790 842
791 ProcessCommonOptions(options) 843 ProcessCommonOptions(options)
792 844
793 devices = _GetAttachedDevices(options.test_device) 845 if command in HOST_TESTS:
846 devices = []
847 else:
848 devices = _GetAttachedDevices(options.test_device)
794 849
795 forwarder.Forwarder.RemoveHostLog() 850 forwarder.Forwarder.RemoveHostLog()
796 if not ports.ResetTestServerPortAllocation(): 851 if not ports.ResetTestServerPortAllocation():
797 raise Exception('Failed to reset test server port.') 852 raise Exception('Failed to reset test server port.')
798 853
799 if command == 'gtest': 854 if command == 'gtest':
800 return _RunGTests(options, devices) 855 return _RunGTests(options, devices)
801 elif command == 'linker': 856 elif command == 'linker':
802 return _RunLinkerTests(options, devices) 857 return _RunLinkerTests(options, devices)
803 elif command == 'instrumentation': 858 elif command == 'instrumentation':
804 return _RunInstrumentationTests(options, option_parser.error, devices) 859 return _RunInstrumentationTests(options, option_parser.error, devices)
805 elif command == 'uiautomator': 860 elif command == 'uiautomator':
806 return _RunUIAutomatorTests(options, option_parser.error, devices) 861 return _RunUIAutomatorTests(options, option_parser.error, devices)
807 elif command == 'junit': 862 elif command == 'junit':
808 return _RunJUnitTests(options, option_parser.error) 863 return _RunJUnitTests(options, option_parser.error)
809 elif command == 'monkey': 864 elif command == 'monkey':
810 return _RunMonkeyTests(options, option_parser.error, devices) 865 return _RunMonkeyTests(options, option_parser.error, devices)
811 elif command == 'perf': 866 elif command == 'perf':
812 return _RunPerfTests(options, args, option_parser.error) 867 return _RunPerfTests(options, args, option_parser.error)
868 elif command == 'python':
869 return _RunPythonTests(options, option_parser.error)
813 else: 870 else:
814 raise Exception('Unknown test type.') 871 raise Exception('Unknown test type.')
815 872
816 873
817 def HelpCommand(command, _options, args, option_parser): 874 def HelpCommand(command, _options, args, option_parser):
818 """Display help for a certain command, or overall help. 875 """Display help for a certain command, or overall help.
819 876
820 Args: 877 Args:
821 command: String indicating the command that was received to trigger 878 command: String indicating the command that was received to trigger
822 this function. 879 this function.
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
865 'instrumentation': CommandFunctionTuple( 922 'instrumentation': CommandFunctionTuple(
866 AddInstrumentationTestOptions, RunTestsCommand), 923 AddInstrumentationTestOptions, RunTestsCommand),
867 'uiautomator': CommandFunctionTuple( 924 'uiautomator': CommandFunctionTuple(
868 AddUIAutomatorTestOptions, RunTestsCommand), 925 AddUIAutomatorTestOptions, RunTestsCommand),
869 'junit': CommandFunctionTuple( 926 'junit': CommandFunctionTuple(
870 AddJUnitTestOptions, RunTestsCommand), 927 AddJUnitTestOptions, RunTestsCommand),
871 'monkey': CommandFunctionTuple( 928 'monkey': CommandFunctionTuple(
872 AddMonkeyTestOptions, RunTestsCommand), 929 AddMonkeyTestOptions, RunTestsCommand),
873 'perf': CommandFunctionTuple( 930 'perf': CommandFunctionTuple(
874 AddPerfTestOptions, RunTestsCommand), 931 AddPerfTestOptions, RunTestsCommand),
932 'python': CommandFunctionTuple(
933 AddPythonTestOptions, RunTestsCommand),
875 'linker': CommandFunctionTuple( 934 'linker': CommandFunctionTuple(
876 AddLinkerTestOptions, RunTestsCommand), 935 AddLinkerTestOptions, RunTestsCommand),
877 'help': CommandFunctionTuple(lambda option_parser: None, HelpCommand) 936 'help': CommandFunctionTuple(lambda option_parser: None, HelpCommand)
878 } 937 }
879 938
880 939
881 def DumpThreadStacks(_signal, _frame): 940 def DumpThreadStacks(_signal, _frame):
882 for thread in threading.enumerate(): 941 for thread in threading.enumerate():
883 reraiser_thread.LogThreadStack(thread) 942 reraiser_thread.LogThreadStack(thread)
884 943
885 944
886 def main(): 945 def main():
887 signal.signal(signal.SIGUSR1, DumpThreadStacks) 946 signal.signal(signal.SIGUSR1, DumpThreadStacks)
888 option_parser = command_option_parser.CommandOptionParser( 947 option_parser = command_option_parser.CommandOptionParser(
889 commands_dict=VALID_COMMANDS) 948 commands_dict=VALID_COMMANDS)
890 return command_option_parser.ParseAndExecute(option_parser) 949 return command_option_parser.ParseAndExecute(option_parser)
891 950
892 951
893 if __name__ == '__main__': 952 if __name__ == '__main__':
894 sys.exit(main()) 953 sys.exit(main())
OLDNEW
« no previous file with comments | « build/android/pylib/constants.py ('k') | build/common.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698