# Copyright 2022 The Chromium Authors # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """Provides a base class for test running."""
import os import subprocess
from abc import ABC, abstractmethod from typing import Dict, List, Optional, Union
from common import read_package_paths
class TestRunner(ABC): """Base class that handles running a test."""
@property def package_deps(self) -> Dict[str, str]: """
Returns:
A dictionary of packages that |self._packages| depend on, with
mapping from the package name to the local path to its far file. """
return self._package_deps
def _build_package_deps(self, package_paths: List[str]) -> Dict[str, str]: """Retrieve information for all packages listed in |package_paths|."""
package_deps = {} for path in package_paths:
path = os.path.join(self._out_dir, path)
package_name = os.path.basename(path).replace('.far', '') if package_name in package_deps: assert path == package_deps[package_name]
package_deps[package_name] = path return package_deps
def _populate_package_deps(self) -> None: """Retrieve information for all packages |self._packages| depend on.
Note, this function expects the packages to be built with chromium
specified build rules and placed in certain locations. """
package_paths = [] for package in self._packages:
package_paths.extend(read_package_paths(self._out_dir, package))
return self._build_package_deps(package_paths)
@abstractmethod def run_test(self) -> subprocess.Popen: """
Returns:
A subprocess.Popen object that ran the test command. """
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.