| OLD | NEW |
| 1 #!/usr/bin/python | 1 #!/usr/bin/python |
| 2 # Copyright 2016 The Chromium Authors. All rights reserved. | 2 # Copyright 2016 The Chromium 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 """Run a test. | 6 """Run a test. |
| 7 | 7 |
| 8 Sample usage: | 8 Sample usage: |
| 9 ./run.py \ | 9 ./run.py \ |
| 10 -a src/xcodebuild/Release-iphoneos/base_unittests.app \ | 10 -a src/xcodebuild/Release-iphoneos/base_unittests.app \ |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 if args.iossim and args.platform and args.version: | 36 if args.iossim and args.platform and args.version: |
| 37 tr = test_runner.SimulatorTestRunner( | 37 tr = test_runner.SimulatorTestRunner( |
| 38 args.app, | 38 args.app, |
| 39 args.iossim, | 39 args.iossim, |
| 40 args.platform, | 40 args.platform, |
| 41 args.version, | 41 args.version, |
| 42 args.xcode_version, | 42 args.xcode_version, |
| 43 args.out_dir, | 43 args.out_dir, |
| 44 env_vars=args.env_var, | 44 env_vars=args.env_var, |
| 45 test_args=test_args, | 45 test_args=test_args, |
| 46 xctest=args.xctest, |
| 46 ) | 47 ) |
| 47 else: | 48 else: |
| 48 tr = test_runner.DeviceTestRunner( | 49 tr = test_runner.DeviceTestRunner( |
| 49 args.app, | 50 args.app, |
| 50 args.xcode_version, | 51 args.xcode_version, |
| 51 args.out_dir, | 52 args.out_dir, |
| 52 env_vars=args.env_var, | 53 env_vars=args.env_var, |
| 53 test_args=test_args, | 54 test_args=test_args, |
| 54 ) | 55 ) |
| 55 | 56 |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 help='Version of iOS the simulator should run.', | 121 help='Version of iOS the simulator should run.', |
| 121 metavar='ver', | 122 metavar='ver', |
| 122 ) | 123 ) |
| 123 parser.add_argument( | 124 parser.add_argument( |
| 124 '-x', | 125 '-x', |
| 125 '--xcode-version', | 126 '--xcode-version', |
| 126 help='Version of Xcode to use.', | 127 help='Version of Xcode to use.', |
| 127 metavar='ver', | 128 metavar='ver', |
| 128 required=True, | 129 required=True, |
| 129 ) | 130 ) |
| 131 parser.add_argument( |
| 132 '--xctest', |
| 133 action='store_true', |
| 134 help='Whether or not the given app should be run as an XCTest.', |
| 135 ) |
| 130 | 136 |
| 131 args, test_args = parser.parse_known_args() | 137 args, test_args = parser.parse_known_args() |
| 132 if args.iossim or args.platform or args.version: | 138 if args.iossim or args.platform or args.version: |
| 133 # If any of --iossim, --platform, or --version | 139 # If any of --iossim, --platform, or --version |
| 134 # are specified then they must all be specified. | 140 # are specified then they must all be specified. |
| 135 if not (args.iossim and args.platform and args.version): | 141 if not (args.iossim and args.platform and args.version): |
| 136 parser.error( | 142 parser.error( |
| 137 'must specify all or none of -i/--iossim, -p/--platform, -v/--version') | 143 'must specify all or none of -i/--iossim, -p/--platform, -v/--version') |
| 138 | 144 |
| 139 args_json = json.loads(args.args_json) | 145 args_json = json.loads(args.args_json) |
| 140 args.env_var = args.env_var or [] | 146 args.env_var = args.env_var or [] |
| 141 args.env_var.extend(args_json.get('env_var', [])) | 147 args.env_var.extend(args_json.get('env_var', [])) |
| 148 args.xctest = args_json.get('xctest', args.xctest) |
| 142 test_args.extend(args_json.get('test_args', [])) | 149 test_args.extend(args_json.get('test_args', [])) |
| 143 | 150 |
| 144 sys.exit(main(args, test_args)) | 151 sys.exit(main(args, test_args)) |
| OLD | NEW |