def BuildAllTests(self, ninja_flags): """Runs build step for all specified unit test binaries. Args: ninja_flags: Command line flags to pass to ninja. Returns: True if the build succeeds, False if not. """ result = True try: if self.out_directory: out_directory = self.out_directory else: out_directory = paths.BuildOutputDirectory(self.platform, self.config) if ninja_flags: extra_flags = [ninja_flags] else: extra_flags = [] build_tests.BuildTargets(self.test_targets, out_directory, self.dry_run, extra_flags) except subprocess.CalledProcessError as e: result = False sys.stderr.write("Error occurred during building.\n") sys.stderr.write("{}\n".format(e)) return result
def __init__(self, platform_name, target_name, config, device_id, **kwargs): self.platform_name = platform_name self.target_name = target_name self.config = config self.device_id = device_id # The following pattern makes sure that variables will be initialized # properly whether a kwarg is passed in with a value of None or it # is not passed in at all. out_directory = kwargs.get("out_directory", None) if not out_directory: out_directory = paths.BuildOutputDirectory(platform_name, config) self.out_directory = out_directory output_file = kwargs.get("output_file", None) if not output_file: output_file = sys.stdout self.output_file = output_file target_command_line_params = kwargs.get("target_params", None) if target_command_line_params is None: target_command_line_params = [] self.target_command_line_params = target_command_line_params env_variables = kwargs.get("env_variables", None) if env_variables is None: env_variables = {} self.env_variables = env_variables # Launchers that need different startup timeout times should reassign # this variable during initialization. self.startup_timeout_seconds = 2 * 60
def _GetDeployPaths(platform_name, config): """Returns a list of paths that should be included in the archive.""" try: gyp_config = GetPlatformConfig(platform_name) patterns = gyp_config.GetDeployPathPatterns() logging.info('Found platform include patterns: [%s]', ', '.join(patterns)) out_directory = paths.BuildOutputDirectory(platform_name, config) out_paths = [] for root, _, files in port_symlink.OsWalk(out_directory): for f in files: full_path = os.path.join(root, f) file_path = os.path.relpath(full_path, out_directory) if _PathMatchesPatterns(file_path, patterns): out_paths.append(file_path) return out_paths except NotImplementedError: # Abstract class throws NotImplementedError. logging.warning('** AUTO INCLUDE: ** Specific deploy paths were not found ' 'so including known possible deploy paths from the ' 'platform out directory.') build_root = paths.BuildOutputDirectory(platform_name, config) deploy_paths = _FindPossibleDeployPaths(build_root) return deploy_paths
def _MakeCobaltArchiveFromSource(output_archive_path, platform_name, config, platform_sdk_version, additional_buildinfo_dict, include_black_box_tests): """Finds necessary files and makes an archive.""" _MakeDirs(os.path.dirname(output_archive_path)) out_directory = paths.BuildOutputDirectory(platform_name, config) root_dir = os.path.abspath( os.path.normpath(os.path.join(out_directory, '..', '..'))) flist = filelist.FileList() inc_paths = _GetDeployPaths(platform_name, config) logging.info('Adding binary files to bundle...') for path in inc_paths: path = os.path.join(out_directory, path) if not os.path.exists(path): logging.info('Skipping deploy path %s because it does not exist.', path) continue logging.info(' adding %s', os.path.abspath(path)) flist.AddAllFilesInPath(root_dir=root_dir, sub_path=path) logging.info('...done') launcher_tools_path = os.path.join( os.path.dirname(output_archive_path), '____app_launcher') if os.path.exists(launcher_tools_path): port_symlink.Rmtree(launcher_tools_path) logging.info('Adding app_launcher_files to bundle in %s', os.path.abspath(launcher_tools_path)) try: CopyAppLauncherTools(repo_root=paths.REPOSITORY_ROOT, dest_root=launcher_tools_path, additional_glob_patterns=[], include_black_box_tests=include_black_box_tests) flist.AddAllFilesInPath(root_dir=launcher_tools_path, sub_path=launcher_tools_path) logging.info('...done') MakeCobaltArchiveFromFileList( output_archive_path, input_file_list=flist, platform_name=platform_name, platform_sdk_version=platform_sdk_version, config=config, additional_buildinfo_dict=additional_buildinfo_dict) logging.info('...done') finally: port_symlink.Rmtree(launcher_tools_path)
def BuildOutputDirectory(platform, config): return paths.BuildOutputDirectory(platform, config)
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()