def __init__(self, app_path, host_app_path, iossim_path, version, platform, out_dir, variations_seed_path, **kwargs): super(VariationsSimulatorParallelTestRunner, self).__init__(app_path, host_app_path, iossim_path, version, platform, out_dir, **kwargs) self.variations_seed_path = variations_seed_path self.host_app_bundle_id = test_apps.get_bundle_id(self.host_app_path) self.log_parser = xcode_log_parser.get_parser() self.test_app = self.get_launch_test_app()
def __init__( self, app_path, out_dir, env_vars=None, retries=None, shards=None, test_args=None, test_cases=None, xctest=False, ): """Initializes a new instance of this class. Args: app_path: Path to the compiled .app to run. out_dir: Directory to emit test data into. env_vars: List of environment variables to pass to the test itself. retries: Number of times to retry failed test cases. test_args: List of strings to pass as arguments to the test when launching. test_cases: List of tests to be included in the test run. None or [] to include all tests. xctest: Whether or not this is an XCTest. Raises: AppNotFoundError: If the given app does not exist. PlugInsNotFoundError: If the PlugIns directory does not exist for XCTests. XcodeVersionNotFoundError: If the given Xcode version does not exist. XCTestPlugInNotFoundError: If the .xctest PlugIn does not exist. """ app_path = os.path.abspath(app_path) if not os.path.exists(app_path): raise AppNotFoundError(app_path) xcode_info = get_current_xcode_info() LOGGER.info('Using Xcode version %s build %s at %s', xcode_info['version'], xcode_info['build'], xcode_info['path']) if not os.path.exists(out_dir): os.makedirs(out_dir) self.app_name = os.path.splitext(os.path.split(app_path)[-1])[0] self.app_path = app_path self.cfbundleid = test_apps.get_bundle_id(app_path) self.env_vars = env_vars or [] self.logs = collections.OrderedDict() self.out_dir = out_dir self.retries = retries or 0 self.shards = shards or 1 self.test_args = test_args or [] self.test_cases = test_cases or [] self.xctest_path = '' # TODO(crbug.com/1006881): Separate "running style" from "parser style" # for XCtests and Gtests. self.xctest = xctest self.test_results = {} self.test_results['version'] = 3 self.test_results['path_delimiter'] = '.' self.test_results['seconds_since_epoch'] = int(time.time()) # This will be overwritten when the tests complete successfully. self.test_results['interrupted'] = True if self.xctest: plugins_dir = os.path.join(self.app_path, 'PlugIns') if not os.path.exists(plugins_dir): raise PlugInsNotFoundError(plugins_dir) for plugin in os.listdir(plugins_dir): if plugin.endswith('.xctest'): self.xctest_path = os.path.join(plugins_dir, plugin) if not os.path.exists(self.xctest_path): raise XCTestPlugInNotFoundError(self.xctest_path)