Ejemplo n.º 1
0
    def add_dependency(self, name, libs=[], ok=True, variables=[], pkgconfig=False,
                       includepath=None, libpath=None, version=None,
                       versioncpp=None, versionheader=None):
        if type(libs) != type([]):
            utility.report_error(self.env, "lib lists must be stored as a list: "+name)

        self.dependencies[name]=self.DependencyData(name, libs=libs, variables=variables,
                                                    ok=ok, pkgconfig=pkgconfig,
                                                    includepath=includepath,
                                                    libpath=libpath,
                                                    version=version,
                                                    versioncpp=versioncpp,
                                                    versionheader=versionheader)
Ejemplo n.º 2
0
 def add_application(self, name, link="",
                     dependencies=[], unfound_dependencies=[], modules=[],
                     version=None, ok=True):
     if ok and not version:
         utility.report_error("Version must be specified for modules")
     if not ok:
         self.applications[name]=self.ApplicationData(name, ok=ok)
     else:
         passmodules= self._expand_modules(modules)
         passdependencies= self._expand_dependencies(passmodules,
                                                     dependencies)
         self.applications[name]\
             =self.ApplicationData(name, link=link,
                                   dependencies=passdependencies,
                                   unfound_dependencies=unfound_dependencies,
                                   modules=passmodules,
                                   version=version)
Ejemplo n.º 3
0
def _action_unit_test(target, source, env):
    global disabled_modules
    #app = "cd %s; %s %s %s -v > /dev/null"
    fsource=[]
    type= source[-1].get_contents()
    for x in source[2:-1]:
        if str(x).endswith(".py"):
            fsource.append(x.abspath)
    if source[-1] == 'example':
        # Quote list of modules so that the shell passes an empty parameter
        # to the script if there are no disabled modules (rather than the
        # script treating the first file as the list of disabled modules)
        disab = ' "%s"' % ":".join(disabled_modules)
    else:
        disab = ''
    tmpdir=Dir("#/build/tmp").abspath
    tf=target[0].abspath
    filename= target[0].abspath
    execute = env.Execute
    if type.endswith("unit test"):
        cmd= File("#/scons_tools/run-all-tests.py").abspath
        if env['cppcoverage'] != 'no':
            c = cpp_coverage._CoverageTester(env, env['cppcoverage'], type, tf)
            execute = c.Execute
        if type.startswith('module'):
            modname = _get_name(env)
            if modname == 'kernel':
                modname = 'IMP'
            elif modname != 'RMF':
                modname = 'IMP.' + modname
            cmd += ' --module=%s --pycoverage=%s' % (modname, env['pycoverage'])
            if env['pycoverage'] == 'lines':
                cmd += ' --output=%s.pycoverage' % tf
            data.get(env).env.Append(IMP_TESTS=[(modname, filename)])
        elif type.startswith('application'):
            cmd += ' --application=%s --pycoverage=%s' % (_get_name(env),
                                                          env['pycoverage'])
            for pyexe in env.get('IMP_PYTHON_EXECUTABLES', []):
                cmd += ' --pyexe=%s' % pyexe
            if env['pycoverage'] == 'lines':
                cmd += ' --output=%s.pycoverage' % tf
        if env.get('html_coverage', 'no') != 'no':
            cmd += ' --html_coverage=%s' \
                   % Dir("#/build/coverage").abspath

        cmd+=" --results="+filename
        #if len(fsource) > 0:
        #    env.Append(ENV={'TEST_DIRECTORY':fsource[0][0:fsource[0].find("/test/")+6]})
        #    #print "test dir", os.environ['TEST_DIRECTORY']
    elif type=='example':
        cmd= File("#/scons_tools/run-all-examples.py").abspath
        dmod=[]
        for d in data.get(env).modules.keys():
            if not data.get(env).modules[d].ok:
                dmod.append(d)
        cmd= cmd+ ' --excluded='+":".join(dmod)
        cmd+=" --results="+filename
    elif type=='system':
        cmd= File("#/scons_tools/run-all-system.py").abspath + " " +Dir("#/build/tmp").abspath
    else:
        utility.report_error(env, "Unknown test type "+type)
    print "tempfile", tf, tmpdir, target[0].path+".result"
    app = "mkdir -p %s; cd %s; (%s %s %s%s %s >%s) > /dev/null" \
              % (tmpdir, tmpdir, source[0].abspath, env['PYTHON'],
                 cmd, disab,
                 " ".join(fsource), tf+".out")
    print app
    if execute(app) == 0:
        #file(str(target[0]), 'w').write('PASSED\n')
        print "%s %ss succeeded" % (_get_name(env), source[-1])
    else:
        print "%s %ss FAILED" % (_get_name(env), source[-1])
        return 1