def __init__(self, platform, config, device_id, specified_targets, target_params, out_directory, platform_tests_only, application_name=None, dry_run=False, xml_output_dir=None, log_xml_results=False): self.platform = platform self.config = config self.device_id = device_id self.target_params = target_params self.out_directory = out_directory self._platform_config = build.GetPlatformConfig(platform) self._app_config = self._platform_config.GetApplicationConfiguration( application_name) self.dry_run = dry_run self.xml_output_dir = xml_output_dir self.log_xml_results = log_xml_results self.threads = [] _VerifyConfig(self._platform_config) _VerifyConfig(self._app_config) # If a particular test binary has been provided, configure only that one. if specified_targets: self.test_targets = self._GetSpecifiedTestTargets(specified_targets) else: self.test_targets = self._GetTestTargets(platform_tests_only) self.test_env_vars = self._GetAllTestEnvVariables()
def __init__(self, *args, **kwargs): super(BlackBoxTestCase, self).__init__(*args, **kwargs) self.launcher_params = _launcher_params self.platform_config = build.GetPlatformConfig( _launcher_params.platform) self.cobalt_config = self.platform_config.GetApplicationConfiguration( 'cobalt')
def test_simple(self): with WebPlatformTestServer( binding_address=self.GetBindingAddress(), wpt_http_port=self.GetWptHttpPort()): target_params = [] filters = self.cobalt_config.GetWebPlatformTestFilters() # Regardless of our own platform, if we are Evergreen we also need to # filter the tests that are filtered by the underlying platform. For # example, the 'evergreen-arm-hardfp' needs to filter the 'raspi-2' # filtered tests when it is running on a Raspberry Pi 2. if self.launcher_params.IsEvergreen(): loader_platform_config = build.GetPlatformConfig( self.launcher_params.loader_platform) loader_platform_cobalt_config = loader_platform_config.GetApplicationConfiguration( 'cobalt') for filter in loader_platform_cobalt_config.GetWebPlatformTestFilters(): if filter not in filters: filters.append(filter) used_filters = [] for filter in filters: if filter == test_filter.DISABLE_TESTING: return if filter == test_filter.FILTER_ALL: return if isinstance(filter, test_filter.TestFilter): if filter.config and filter.config != self.launcher_params.config: continue if filter.test_name and filter.test_name == test_filter.FILTER_ALL: return used_filters.append(filter.test_name) else: used_filters.append(filter) if used_filters: target_params.append('--gtest_filter=-{}'.format( ':'.join(used_filters))) if self.launcher_params.target_params: target_params += self.launcher_params.target_params launcher = abstract_launcher.LauncherFactory( self.launcher_params.platform, 'web_platform_tests', self.launcher_params.config, device_id=self.launcher_params.device_id, target_params=target_params, output_file=None, out_directory=self.launcher_params.out_directory, env_variables={'ASAN_OPTIONS': 'intercept_tls_get_addr=0'}, loader_platform=self.launcher_params.loader_platform, loader_config=self.launcher_params.loader_config, loader_out_directory=self.launcher_params.loader_out_directory) status = launcher.Run() self.assertEqual(status, 0)
def _GetLauncherForPlatform(platform_name): """Gets the module containing a platform's concrete launcher implementation. Args: platform_name: Platform on which the app will be run, ex. "linux-x64x11". Returns: The module containing the platform's launcher implementation. """ gyp_config = build.GetPlatformConfig(platform_name) if not hasattr(gyp_config, "GetLauncher"): return None else: return gyp_config.GetLauncher()
def _GetTestFilters(self): """Get test filters for a given platform and configuration.""" filters = self._platform_config.GetTestFilters() app_filters = self._app_config.GetTestFilters() if app_filters: filters.extend(app_filters) # Regardless of our own platform, if we are Evergreen we also need to # filter the tests that are filtered by the underlying platform. For # example, the 'evergreen-arm-hardfp' needs to filter the 'raspi-2' # filtered tests when it is running on a Raspberry Pi 2. if self.loader_platform and self.loader_config: loader_platform_config = build.GetPlatformConfig( self.loader_platform) loader_app_config = loader_platform_config.GetApplicationConfiguration( self.application_name) for filter_ in (loader_platform_config.GetTestFilters() + loader_app_config.GetTestFilters()): if filter_ not in filters: filters.append(filter_) return filters
def __init__(self, options): options.build_configs = _Dedupe(options.build_configs) self.options = options self.common_args = [] self.platform_configuration = build.GetPlatformConfig(options.platform) if not self.platform_configuration: raise RuntimeError('Unable to load PlatformConfiguration.') env_vars = self.platform_configuration.GetEnvironmentVariables() self.app_configuration = ( self.platform_configuration.GetApplicationConfiguration( options.application)) if not self.app_configuration: raise RuntimeError('Unable to load an ApplicationConfiguration.') app_env_vars = self.app_configuration.GetEnvironmentVariables() if app_env_vars: env_vars.update(app_env_vars) os.environ.update(env_vars) self._MakeCommonArguments()
def test_simple(self): device_params = black_box_tests._device_params if device_params.config not in _WEB_PLATFORM_TESTS_CONFIGS: logging.warning('Can only run web platform tests on debug or devel ' 'configs.') return with WebPlatformTestServer(binding_address=self.GetBindingAddress()): target_params = [] platform_config = build.GetPlatformConfig(device_params.platform) cobalt_config = platform_config.GetApplicationConfiguration('cobalt') filters = cobalt_config.GetWebPlatformTestFilters() if test_filter.DISABLE_TESTING in filters: return if test_filter.FILTER_ALL in filters: return if filters: target_params.append('--gtest_filter=-{}'.format(':'.join( filters))) if device_params.target_params: target_params += device_params.target_params launcher = abstract_launcher.LauncherFactory( device_params.platform, 'web_platform_tests', device_params.config, device_id=device_params.device_id, target_params=target_params, output_file=None, out_directory=device_params.out_directory) status = launcher.Run() self.assertEqual(status, 0)
def __init__(self, platform, config, loader_platform, loader_config, device_id, specified_targets, target_params, out_directory, loader_out_directory, platform_tests_only, application_name=None, dry_run=False, xml_output_dir=None, log_xml_results=False, launcher_args=None): self.platform = platform self.config = config self.loader_platform = loader_platform self.loader_config = loader_config self.device_id = device_id self.target_params = target_params self.out_directory = out_directory self.loader_out_directory = loader_out_directory self.launcher_args = launcher_args if not self.out_directory: self.out_directory = paths.BuildOutputDirectory( self.platform, self.config) self.coverage_directory = os.path.join(self.out_directory, "coverage") if (not self.loader_out_directory and self.loader_platform and self.loader_config): self.loader_out_directory = paths.BuildOutputDirectory( self.loader_platform, self.loader_config) self._platform_config = build.GetPlatformConfig(platform) if self.loader_platform: self._loader_platform_config = build.GetPlatformConfig( loader_platform) self._app_config = self._platform_config.GetApplicationConfiguration( application_name) self.application_name = application_name self.dry_run = dry_run self.xml_output_dir = xml_output_dir self.log_xml_results = log_xml_results self.threads = [] _EnsureBuildDirectoryExists(self.out_directory) _VerifyConfig(self._platform_config) if self.loader_platform: _EnsureBuildDirectoryExists(self.loader_out_directory) _VerifyConfig(self._loader_platform_config) _VerifyConfig(self._app_config) # If a particular test binary has been provided, configure only that one. if specified_targets: self.test_targets = self._GetSpecifiedTestTargets( specified_targets) else: self.test_targets = self._GetTestTargets(platform_tests_only) self.test_env_vars = self._GetAllTestEnvVariables()