Beispiel #1
0
 def __init__(self, index, total, report, executable, rtems_tools, bsp,
              bsp_config, opts):
     self.index = index
     self.total = total
     self.report = report
     self.bsp = bsp
     self.bsp_config = bsp_config
     self.opts = copy.copy(opts)
     self.opts.defaults['test_index'] = str(index)
     self.opts.defaults['test_total'] = str(total)
     self.opts.defaults['bsp'] = bsp
     self.opts.defaults['bsp_arch'] = '%%{%s_arch}' % (bsp)
     self.opts.defaults['bsp_opts'] = '%%{%s_opts}' % (bsp)
     if not path.isfile(executable):
         raise error.general('cannot find executable: %s' % (executable))
     self.opts.defaults['test_executable'] = executable
     self.opts.defaults['test_executable_name'] = path.basename(executable)
     if rtems_tools:
         rtems_tools_bin = path.join(self.opts.defaults.expand(rtems_tools),
                                     'bin')
         if not path.isdir(rtems_tools_bin):
             raise error.general('cannot find RTEMS tools path: %s' %
                                 (rtems_tools_bin))
         self.opts.defaults['rtems_tools'] = rtems_tools_bin
     self.config = config.file(self.report, self.bsp_config, self.opts)
Beispiel #2
0
def _check_dir(_opts, macro, value, constraint, silent=False):
    if constraint != 'none' and not path.isdir(value):
        if constraint == 'required':
            if not silent:
                log.notice('error: dir: not found: (%s) %s' % (macro, value))
            return False
        if not silent and _opts.warn_all():
            log.notice('warning: dir: not found: (%s) %s' % (macro, value))
    return True
Beispiel #3
0
def find_executables(paths, glob):
    executables = []
    for p in paths:
        if path.isfile(p):
            executables += [p]
        elif path.isdir(p):
            for root, dirs, files in os.walk(p, followlinks = True):
                for f in files:
                    if fnmatch.fnmatch(f.lower(), glob):
                        executables += [path.join(root, f)]
    return sorted(executables)
Beispiel #4
0
def find_executables(paths):
    executables = []
    for p in paths:
        if path.isfile(p):
            executables += [p]
        elif path.isdir(p):
            for root, dirs, files in os.walk(p, followlinks = True):
                for f in files:
                    if f.lower().endswith('.exe'):
                        executables += [path.join(root, f)]
    return sorted(executables)
Beispiel #5
0
def find_executables(paths, glob):
    executables = []
    for p in paths:
        if path.isfile(p):
            executables += [p]
        elif path.isdir(p):
            for root, dirs, files in os.walk(p, followlinks=True):
                for f in files:
                    if fnmatch.fnmatch(f.lower(), glob):
                        executables += [path.join(root, f)]
    return sorted(executables)
Beispiel #6
0
def find_executables(paths, glob):
    executables = []
    for p in paths:
        if path.isfile(p):
            executables += [p]
        elif path.isdir(p):
            for root, dirs, files in os.walk(p, followlinks=True):
                for f in files:
                    if fnmatch.fnmatch(f.lower(), glob):
                        executables += [path.join(root, f)]
    norun = re.compile('.*\.norun.*')
    executables = [e for e in executables if not norun.match(e)]
    return sorted(executables)
Beispiel #7
0
 def __call__(self, parser, namespace, values, option_string=None):
     if type(values) is not list:
         values = [values]
     for value in values:
         if not path.isdir(value):
             raise argparse.ArgumentError(
                 self, 'is not a valid directory: %s' % (value))
         if not path.isreadable(value):
             raise argparse.ArgumentError(self,
                                          'is not readable: %s' % (value))
         if not path.iswritable(value):
             raise argparse.ArgumentError(self,
                                          'is not writeable: %s' % (value))
         setattr(namespace, self.dest, value)
Beispiel #8
0
 def __call__(self, parser, namespace, value, option_string=None):
     current = getattr(namespace, self.dest)
     if current is None:
         current = []
     if isinstance(value, list):
         values = value
     else:
         values = [values]
     for value in values:
         if not path.isfile(value) and not path.isdir(value):
             err = 'is not a valid file or directory: %s' % (value)
             raise argparse.ArgumentError(self, err)
         if not path.isreadable(value):
             raise argparse.ArgumentError(self,
                                          'is not readable: %s' % (value))
         current += [value]
     setattr(namespace, self.dest, current)
Beispiel #9
0
 def __init__(self, index, total, report, executable, rtems_tools, bsp, bsp_config, opts):
     self.index = index
     self.total = total
     self.report = report
     self.bsp = bsp
     self.bsp_config = bsp_config
     self.opts = copy.copy(opts)
     self.opts.defaults['test_index'] = str(index)
     self.opts.defaults['test_total'] = str(total)
     self.opts.defaults['bsp'] = bsp
     self.opts.defaults['bsp_arch'] = '%%{%s_arch}' % (bsp)
     self.opts.defaults['bsp_opts'] = '%%{%s_opts}' % (bsp)
     if not path.isfile(executable):
         raise error.general('cannot find executable: %s' % (executable))
     self.opts.defaults['test_executable'] = executable
     if rtems_tools:
         rtems_tools_bin = path.join(self.opts.defaults.expand(rtems_tools), 'bin')
         if not path.isdir(rtems_tools_bin):
             raise error.general('cannot find RTEMS tools path: %s' % (rtems_tools_bin))
         self.opts.defaults['rtems_tools'] = rtems_tools_bin
     self.config = config.file(self.report, self.bsp_config, self.opts)