Ejemplo n.º 1
0
def load(bsp, opts):
    mandatory = ['bsp', 'arch', 'tester']
    cfg = configuration.configuration()
    path_ = opts.defaults.expand('%%{_configdir}/bsps/%s.ini' % (bsp))
    ini_name = path.basename(path_)
    for p in path.dirname(path_).split(':'):
        if path.exists(path.join(p, ini_name)):
            cfg.load(path.join(p, ini_name))
            if not cfg.has_section(bsp):
                raise error.general('bsp section not found in ini: [%s]' %
                                    (bsp))
            item_names = cfg.get_item_names(bsp, err=False)
            for m in mandatory:
                if m not in item_names:
                    raise error.general(
                        'mandatory item not found in bsp section: %s' % (m))
            opts.defaults.set_write_map(bsp, add=True)
            for i in cfg.get_items(bsp, flatten=False):
                opts.defaults[i[0]] = i[1]
            if not opts.defaults.set_read_map(bsp):
                raise error.general('cannot set BSP read map: %s' % (bsp))
            # Get a copy of the required fields we need
            requires = cfg.comma_list(bsp, 'requires', err=False)
            del cfg
            user_config = opts.find_arg('--user-config')
            if user_config is not None:
                user_config = path.expanduser(user_config[1])
                if not path.exists(user_config):
                    raise error.general(
                        'cannot find user configuration file: %s' %
                        (user_config))
            else:
                if 'HOME' in os.environ:
                    user_config = path.join(os.environ['HOME'],
                                            '.rtemstesterrc')
            if user_config:
                if path.exists(user_config):
                    cfg = configuration.configuration()
                    cfg.load(user_config)
                    if cfg.has_section(bsp):
                        for i in cfg.get_items(bsp, flatten=False):
                            opts.defaults[i[0]] = i[1]
            # Check for the required values.
            for r in requires:
                if opts.defaults.get(r) is None:
                    raise error.general('user value missing, BSP %s requires \'%s\': missing: %s' % \
                                        (bsp, ', '.join(requires), r))
            return opts.defaults['bsp']
    raise error.general('cannot find bsp configuration file: %s.ini' % (bsp))
Ejemplo n.º 2
0
 def __init__(self, config, host, port):
     self.lock = threading.Lock()
     self.session_timeout = 10
     self.host = host
     self.port = port
     self.server = None
     self.clients = {}
     self.config = configuration.configuration()
     self._load(config)
     self.session_counter = 0
Ejemplo n.º 3
0
 def __init__(self, command_path, build=None, bootloader=None):
     #
     # Check if there is a defaults.mc file under the command path. If so
     # this is the tester being run from within the git repo. If not found
     # assume the tools have been installed and the defaults is in the
     # install prefix.
     #
     boot_ini = 'tools/config/rtems-boot.ini'
     if path.exists(path.join(command_path, boot_ini)):
         rtdir = command_path
     else:
         rtdir = '%{_prefix}/share/rtems'
     boot_ini = '%s/%s' % (rtdir, boot_ini)
     self.build = None
     self.macros = macros.macros(rtdir=rtdir, show_minimal=True)
     self.config = configuration.configuration(raw=False)
     self.load_config(bootloader, self.macros.expand(boot_ini))
     self.clean = True
Ejemplo n.º 4
0
 def __init__(self):
     self.config = configuration_.configuration()
     self.archs = {}
     self.profiles = {}