OLD | NEW |
1 # Copyright 2016 The Chromium Authors. All rights reserved. | 1 # Copyright 2016 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 """Test runners for iOS.""" | 5 """Test runners for iOS.""" |
6 | 6 |
7 import argparse | 7 import argparse |
8 import collections | 8 import collections |
9 import errno | 9 import errno |
10 import os | 10 import os |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 test_args: List of strings to pass as arguments to the test when | 147 test_args: List of strings to pass as arguments to the test when |
148 launching. | 148 launching. |
149 xctest: Whether or not this is an XCTest. | 149 xctest: Whether or not this is an XCTest. |
150 | 150 |
151 Raises: | 151 Raises: |
152 AppNotFoundError: If the given app does not exist. | 152 AppNotFoundError: If the given app does not exist. |
153 PlugInsNotFoundError: If the PlugIns directory does not exist for XCTests. | 153 PlugInsNotFoundError: If the PlugIns directory does not exist for XCTests. |
154 XcodeVersionNotFoundError: If the given Xcode version does not exist. | 154 XcodeVersionNotFoundError: If the given Xcode version does not exist. |
155 XCTestPlugInNotFoundError: If the .xctest PlugIn does not exist. | 155 XCTestPlugInNotFoundError: If the .xctest PlugIn does not exist. |
156 """ | 156 """ |
| 157 app_path = os.path.abspath(app_path) |
157 if not os.path.exists(app_path): | 158 if not os.path.exists(app_path): |
158 raise AppNotFoundError(app_path) | 159 raise AppNotFoundError(app_path) |
159 | 160 |
160 if not find_xcode.find_xcode(xcode_version)['found']: | 161 if not find_xcode.find_xcode(xcode_version)['found']: |
161 raise XcodeVersionNotFoundError(xcode_version) | 162 raise XcodeVersionNotFoundError(xcode_version) |
162 | 163 |
163 if not os.path.exists(out_dir): | 164 if not os.path.exists(out_dir): |
164 os.makedirs(out_dir) | 165 os.makedirs(out_dir) |
165 | 166 |
166 self.app_name = os.path.splitext(os.path.split(app_path)[-1])[0] | 167 self.app_name = os.path.splitext(os.path.split(app_path)[-1])[0] |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
368 """ | 369 """ |
369 super(SimulatorTestRunner, self).__init__( | 370 super(SimulatorTestRunner, self).__init__( |
370 app_path, | 371 app_path, |
371 xcode_version, | 372 xcode_version, |
372 out_dir, | 373 out_dir, |
373 env_vars=env_vars, | 374 env_vars=env_vars, |
374 test_args=test_args, | 375 test_args=test_args, |
375 xctest=xctest, | 376 xctest=xctest, |
376 ) | 377 ) |
377 | 378 |
| 379 iossim_path = os.path.abspath(iossim_path) |
378 if not os.path.exists(iossim_path): | 380 if not os.path.exists(iossim_path): |
379 raise SimulatorNotFoundError(iossim_path) | 381 raise SimulatorNotFoundError(iossim_path) |
380 | 382 |
381 self.homedir = '' | 383 self.homedir = '' |
382 self.iossim_path = iossim_path | 384 self.iossim_path = iossim_path |
383 self.platform = platform | 385 self.platform = platform |
384 self.start_time = None | 386 self.start_time = None |
385 self.version = version | 387 self.version = version |
386 | 388 |
387 @staticmethod | 389 @staticmethod |
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
646 A dict of environment variables. | 648 A dict of environment variables. |
647 """ | 649 """ |
648 env = super(DeviceTestRunner, self).get_launch_env() | 650 env = super(DeviceTestRunner, self).get_launch_env() |
649 if self.xctest_path: | 651 if self.xctest_path: |
650 # e.g. ios_web_shell_test_host | 652 # e.g. ios_web_shell_test_host |
651 env['APP_TARGET_NAME'] = ( | 653 env['APP_TARGET_NAME'] = ( |
652 os.path.splitext(os.path.basename(self.app_path))[0]) | 654 os.path.splitext(os.path.basename(self.app_path))[0]) |
653 # e.g. ios_web_shell_test | 655 # e.g. ios_web_shell_test |
654 env['TEST_TARGET_NAME'] = env['APP_TARGET_NAME'].rsplit('_', 1)[0] | 656 env['TEST_TARGET_NAME'] = env['APP_TARGET_NAME'].rsplit('_', 1)[0] |
655 return env | 657 return env |
OLD | NEW |