コード例 #1
0
def get_deprecated_map():
    """
    Get the mapping of deprecated names with some metadata.
    """

    # Import everything there is to import, so the map is fully populated
    import_all_submodules(lisa)
    return DEPRECATED_MAP
コード例 #2
0
ファイル: conf.py プロジェクト: lukaszluba-arm/lisa
def nitpick_ignore_module(module):
    mod_prefix = ('{}.'.format(module.__name__))

    class ContinueException(Exception):
        pass

    def get_xref(module, name, x):
        # We don't want to ignore "foreign" modules
        if (
            isinstance(x, types.ModuleType) and
            not x.__name__.startswith(mod_prefix)
        ):
            raise ContinueException

        try:
            reftype = get_xref_type(x)
        except ValueError:
            raise ContinueException
        else:
            # Re-exported names would have the __module__ set to the module
            # they are defined in
            try:
                mod = x.__module__
            # Otherwise, assume it was defined in that module
            except AttributeError:
                mod = module.__name__
            else:
                # We don't want to ignore "foreign" classes that happened
                # to be imported there
                if mod is None or not mod.startswith(mod_prefix):
                    raise ContinueException

            try:
                name = x.__qualname__
            except AttributeError:
                pass

            name = '{}.{}'.format(mod, name)
            return (reftype, name)

    modules = [module] + import_all_submodules(module, best_effort=True)
    xrefs = []
    for module in modules:
        xrefs.append(('py:mod', module.__name__))

        for name, x in inspect.getmembers(module):
            with contextlib.suppress(ContinueException):
                xrefs.append(get_xref(module, name, x))

            if isinstance(x, type):
                for name, y in inspect.getmembers(x):
                    with contextlib.suppress(ContinueException):
                        xrefs.append(
                            get_xref(module, name, y)
                        )

    return xrefs
コード例 #3
0
ファイル: target.py プロジェクト: Binse-Park/lisa-1
    def _init_target(self, kind, name, workdir, device, host,
            port, username, password, keyfile,
            devlib_platform, devlib_excluded_modules,
            wait_boot, wait_boot_timeout,
    ):
        """
        Initialize the Target
        """
        logger = self.get_logger()
        conn_settings = {}

        # If the target is Android, we need just (eventually) the device
        if kind == 'android':
            logger.debug('Setting up Android target...')
            devlib_target_cls = devlib.AndroidTarget

            # Workaround for ARM-software/devlib#225
            workdir = workdir or '/data/local/tmp/devlib-target'

            if device:
                pass
            elif host:
                port = port or self.ADB_PORT_DEFAULT
                device = '{}:{}'.format(host, port)
            else:
                device = 'DEFAULT'

            conn_settings['device'] = device

        elif kind == 'linux':
            logger.debug('Setting up Linux target...')
            devlib_target_cls = devlib.LinuxTarget

            conn_settings['username'] = username
            conn_settings['port'] = port or self.SSH_PORT_DEFAULT
            conn_settings['host'] = host


            # Configure password or SSH keyfile
            if keyfile:
                conn_settings['keyfile'] = keyfile
            else:
                conn_settings['password'] = password
        elif kind == 'host':
            logger.debug('Setting up localhost Linux target...')
            devlib_target_cls = devlib.LocalLinuxTarget
            # If we are given a password, assume we can use it as a sudo
            # password.
            conn_settings['unrooted'] = password is None
            conn_settings['password'] = password
        else:
            raise ValueError('Unsupported platform type {}'.format(kind))

        logger.info('%s %s target connection settings:', kind, name)
        for key, val in conn_settings.items():
            logger.info('%10s : %s', key, val)

        ########################################################################
        # Devlib Platform configuration
        ########################################################################

        if not devlib_platform:
            devlib_platform = devlib.platform.Platform()

        ########################################################################
        # Devlib modules configuration
        ########################################################################

        # Make sure all submodules of devlib.module are imported so the classes
        # are all created
        import_all_submodules(devlib.module)
        # Get all devlib Module subclasses that exist
        devlib_module_set = {
            cls.name
            for cls in get_subclasses(devlib.module.Module)
            if (
                getattr(cls, 'name', None)
                # early modules try to connect to UART and do very
                # platform-specific things we are not interested in
                and getattr(cls, 'stage') != 'early'
            )
        }

        # The platform can define a list of modules to exclude, in case a given
        # module really have troubles on a given platform.
        devlib_module_set.difference_update(devlib_excluded_modules)

        devlib_module_list = sorted(devlib_module_set)
        logger.info('Devlib modules to load: %s', ', '.join(devlib_module_list))

        ########################################################################
        # Create devlib Target object
        ########################################################################

        target = devlib_target_cls(
            platform = devlib_platform,
            modules = devlib_module_list,
            load_default_modules = False,
            connection_settings = conn_settings,
            working_directory = workdir,
            connect=False,
        )

        target.connect(check_boot_completed=wait_boot, timeout=wait_boot_timeout)

        logger.debug('Checking target connection...')
        logger.debug('Target info:')
        logger.debug('      ABI: %s', target.abi)
        logger.debug('     CPUs: %s', target.cpuinfo)
        logger.debug(' clusters: %s', target.core_clusters)
        logger.debug('  workdir: %s', target.working_directory)

        target.setup()

        if isinstance(target, devlib.AndroidTarget):
            target.adb_root(force=True)

        # Verify that all the required modules have been initialized
        for module in devlib_module_list:
            if not hasattr(target, module):
                logger.warning('Failed to initialized "{}" devlib Module'.format(module))
        return target
コード例 #4
0
ファイル: target.py プロジェクト: ambroise-arm/lisa
import lisa.assets
from lisa.wlgen.rta import RTA
from lisa.utils import Loggable, HideExekallID, resolve_dotted_name, get_subclasses, import_all_submodules, LISA_HOME, RESULT_DIR, LATEST_LINK, ASSETS_PATH, setup_logging, ArtifactPath, nullcontext, ExekallTaggable
from lisa.conf import SimpleMultiSrcConf, KeyDesc, LevelKeyDesc, TopLevelKeyDesc, StrList, Configurable

from lisa.platforms.platinfo import PlatformInfo


class PasswordKeyDesc(KeyDesc):
    def pretty_format(self, v):
        return '<password>'


# Make sure all submodules of devlib.module are imported so the classes
# are all created before we list them
import_all_submodules(devlib.module)
_DEVLIB_AVAILABLE_MODULES = {
    cls.name
    for cls in get_subclasses(devlib.module.Module) if
    (getattr(cls, 'name', None)
     # early modules try to connect to UART and do very
     # platform-specific things we are not interested in
     and getattr(cls, 'stage') != 'early')
}


class TargetConf(SimpleMultiSrcConf, HideExekallID):
    """
    Target connection settings.

    Only keys defined below are allowed, with the given meaning and type: