Exemple #1
0
    def setupDejagnuEnvironment(self, env, testsuiteSource, cpu):
        """
    Return an updated ENV for running dejagnu testsuites
    """

        env['METAG_INST_ROOT'] = self.config.getVariable("METAG_INST_ROOT")

        # We need to use the gcc2 version of dejagnu as it is contains our config
        env['DEJAGNULIBS'] = os.path.join(testsuiteSource, "metag", "tools",
                                          "gcc2", "dejagnu")

        if not self.config.getVariable("Execute Tests?"):
            env['METAG_NOEXECUTE'] = "1"

        if self.version.endswith(".sim"):
            # We are going to use the linux simulator
            env['METAG_FSIM_ROOT'] = self.config.getVariable("METAG_FSIM_ROOT")
            # WORK NEEDED: Deprecate this
            env['FSIM_INST_ROOT'] = env['METAG_FSIM_ROOT']

            if cpu == "mtx":
                env['METAG_SIM'] = "mtx"
            else:
                env['METAG_SIM'] = self.config.getVariable("Simulator Config")
        else:
            # Find out about the DA that has been allocated
            da = self.getResource("Debug Adapter")
            env['DA_NAME'] = da.getAttributeValue("DA Name")

        if not 'PATH' in env:
            env['PATH'] = "%s:%s" % (env['DEJAGNULIBS'], os.environ['PATH'])
        else:
            env['PATH'] = "%s:%s" % (env['DEJAGNULIBS'], env['PATH'])

        expect = self.neoSelect("Expect", "5.45")

        if expect == None:
            self.error("Unable to locate Expect component in neo")

        env['PATH'] = "%s:%s" % (os.path.join(expect, "bin"), env['PATH'])
        env['PATH'] = "%s:%s" % (os.path.join(
            sys.path[0], "addons", "simulator", "embedded"), env['PATH'])

        # Add the neo path
        env['PATH'] = CONFIG.makeSearchPath(
            [CONFIG.getProgramDir(CONFIG.neo), env['PATH']])

        return env
Exemple #2
0
    def run(self):
        dir_cadese = os.path.join('/user', 'local_cosy')

        workdir = os.path.join(self.config.getVariable("ST_SOURCE_ROOT"),
                               "supertest")
        spoofStdin = [
            [], ["cd", "results/log"],
            [
                "for f in *; do ../../bin/log-report -tables $f | ../../do-tests/overtest_results_parser.pl > $f.yaml; done"
            ], ["cat *.yaml >results.yaml"], ["exit"]
        ]
        spoofStdin = [' '.join(x) for x in spoofStdin]
        cmd = ["product", "enter"]
        env = {
            'PATH':
            CONFIG.makeSearchPath([
                CONFIG.getProgramDir(CONFIG.neo),
                '%s/product/bin:%s/cadese/bin:%s/sccs/bin' %
                (dir_cadese, dir_cadese, dir_cadese), os.environ['PATH']
            ])
        }
        result = self.execute(env=env,
                              command=cmd,
                              workdir=workdir,
                              spoofStdin='\n'.join(spoofStdin))

        if not result == 0:
            self.error("Failed to run command")

        yaml_file = os.path.join(workdir, "build", "results", "log",
                                 "results.yaml")

        self.registerLogFile(yaml_file)

        data = yaml.load(open(yaml_file, "r"))

        failed = [cfgdat for cfgnam, cfgdat in data.items()]
        failed = [
            cfgdat['unexpected_failed']
            if 'unexpected_failed' in cfgdat else [] for cfgdat in failed
        ]
        failed = [x for y in failed for x in y]

        if len(failed) == 0:
            return self.success()
        else:
            self.error("Sanity check failed")
Exemple #3
0
    def run(self):
        host = self.getResource('Execution Host')
        p4port = str(host.getAttributeValue('P4PORT'))

        workdir = self.config.getVariable("MECC_RELEASE_ROOT")
        metag_inst_root = self.config.getVariable("METAG_INST_ROOT")

        COBIT_INST_ROOT = self.config.getVariable("COBIT_INST_ROOT")

        cmp_ver = self.testrun.getVersion("BuildMECCToolkit")

        license_file = os.path.join(os.path.expanduser("~"), "licenses")

        env = {
            'P4PORT': p4port,
            'P4USER': '******',
        }
        env['PATH'] = CONFIG.makeSearchPath([
            CONFIG.getProgramDir(CONFIG.neo),
            os.path.join(COBIT_INST_ROOT, 'bin'), os.environ['PATH']
        ])
        cmd = [
            './scripts/all.sh', '--TOOLKIT_VERSION', cmp_ver,
            '--METAG_INST_ROOT', metag_inst_root, '--LICENSE_FILE',
            license_file
        ]

        if bool(self.config.getVariable("MECC_BOOTSTRAP")):
            cmd.append('--BOOTSTRAP')

        if not self.config.getVariable("MECC_DO_WINDOWS"):
            cmd.extend(["--SKIP_WINDOWS"])

        mingw_root = self.config.getVariable("GCCMINGW_ROOT")
        cmd.extend(['--MINGW', mingw_root])

        env['EXTRA_PATH'] = CONFIG.makeSearchPath([])

        result = self.execute(env=env,
                              command=cmd,
                              workdir="%s/mecc/release" % workdir)
        if result != 0:
            self.error("Could not build MECC")

        return self.success()
Exemple #4
0
    def runARM(self):
        isa = self.config.getVariable("Instruction Set")
        fpuconfig = self.config.getVariable("FPU Variant")

        env = {}
        env['PATH'] = CONFIG.makeSearchPath(
            [CONFIG.getProgramDir(CONFIG.cmake), os.environ['PATH']])
        env['INSTALL_DIR'] = self.getSharedPath()

        # Order of toolkits is important as using Linux also requires a GCC embedded
        # toolchain.
        cmd = []
        buildtests = []
        isalist = []
        if isa in ("Any", "ARM"):
            isalist.append("arm")
        if isa in ("Any", "Thumb2"):
            isalist.append("thumb")
        fpulist = []
        if fpuconfig == "Any":
            fpulist.extend(["singledouble", "double"])
        else:
            fpulist.append(fpuconfig)

        for isa in isalist:
            if isa in A117705.atests:
                for fpuconfig in fpulist:
                    if fpuconfig in A117705.atests[isa]:
                        buildtests.append(A117705.atests[isa][fpuconfig])

        # Build with META Embedded GCC
        env['ARM_INST_ROOT'] = self.config.getVariable("ARM_INST_ROOT")
        cmd = ["make", "-f", "Makefile.ARM", "all-linux"]

        bulletdir = os.path.join(self.getWorkPath(), "metag", "support",
                                 "examples", "bullet")
        for test in buildtests:
            command = cmd[:]
            command.extend(test)
            if self.execute(command=command, env=env, workdir=bulletdir) != 0:
                self.error("Failed to build test: %s" % test)
        return self.success()
Exemple #5
0
    def run(self):
        host = self.getResource('Execution Host')
        p4port = str(host.getAttributeValue('P4PORT'))

        COBIT_INST_ROOT = self.config.getVariable("COBIT_INST_ROOT")

        root = self.getWorkPath()

        env = {
            'PATH':
            CONFIG.makeSearchPath([
                CONFIG.getProgramDir(CONFIG.neo),
                os.path.join(COBIT_INST_ROOT, 'bin'), os.environ['PATH']
            ]),
            'P4PORT':
            p4port,
            'P4USER':
            '******',
        }

        command = ['p4_cmp', 'fetch', 'SuperTest']
        if self.version == 'CHANGELIST':
            changelist = self.config.getVariable('ST_FETCH_CHANGELIST')
            command.append('--changeset=%s' % changelist)
            command.append(
                '--location=//meta/swcore/cosy/code/supertest/MAIN/supertest/build/xySuperTest.xyf'
            )
        else:
            command[-1] = command[-1] + ':%s' % self.version
        command.append(root)

        if self.execute(env=env, command=command):
            self.error("Failed to fetch source")

        self.config.setVariable("ST_SOURCE_ROOT", root)

        return self.success()
Exemple #6
0
    def run(self):
        metag_inst_root = self.config.getVariable("METAG_INST_ROOT")
        workdir = self.config.getVariable("EEMBC Source")
        toolchain = "metagcc"
        platform = self.config.getVariable("EEMBC Platform")
        cq_stat = self.config.getVariable("EEMBC CQStat")
        benchmark = self.config.getVariable("EEMBC Benchmarks")
        uuencode = self.config.getVariable("EEMBC UUENCODE")
        extra = shlex.split(self.config.getVariable("EEMBC Arbitrary"))
        run_as = self.config.getVariable("EEMBC Run As")
        cqstat_out = self.config.getVariable("EEMBC CQStat Output")
        exec_method = self.version.split('.')[-1]

        env = {
            'METAG_INST_ROOT':
            metag_inst_root,
            'PATH':
            CONFIG.makeSearchPath(
                [CONFIG.getProgramDir(CONFIG.neo), os.environ['PATH']])
        }

        if self.testrun.getVersion("MECCToolkit") != None:
            mecc_inst_root = self.config.getVariable("MECC_INST_ROOT")
            env['MECC_INST_ROOT'] = mecc_inst_root
            env['LM_LICENSE_FILE'] = os.path.join(os.path.expanduser("~"),
                                                  "licenses", "uncounted.lic")
            toolchain = "metamecc"

        cmd = ["scripts/build.sh"]
        # cmdoptions are options suitable for both building and analysing results
        cmdoptions = ["--toolchains", toolchain]
        cmdoptions.extend(["--platforms", platform])
        if cq_stat == 1:
            cmdoptions.append("--cq-stat")
            cmdoptions.extend(["--cq-stat-output", cqstat_out])
        cmdoptions.extend(["--harnesses", "th_lite"])
        cmdoptions.extend(["--benchmarks", benchmark])
        if uuencode != 1:
            cmdoptions.append("--no-uuencode")

        implementation = self.config.getVariable("EEMBC Implementation")
        if len(implementation) > 0:
            cmdoptions.extend(["--implementation", implementation])

        cmdoptions.extend(["--exec-method", exec_method])
        if exec_method == "datools":
            da = self.getResource("Debug Adapter")
            da_name = da.getAttributeValue("DA Name")
            cmdoptions.extend(["--da", da_name])
        elif exec_method == "inscript":
            metag_fsim_root = self.config.getVariable("METAG_FSIM_ROOT")
            metat_onetest_timeout = self.config.getVariable(
                "METAT_ONETEST_TIMEOUT")
            env['METAG_FSIM_ROOT'] = metag_fsim_root
            env['METAT_ONETEST_TIMEOUT'] = metat_onetest_timeout
        if run_as != "":
            cmdoptions.extend(["--run-as", run_as])

        if len(extra) > 0:
            cmdoptions.append("--")
            cmdoptions.extend(extra)

        cmd.extend(cmdoptions)

        result = self.execute(command=cmd,
                              env=env,
                              workdir="%s/eembc" % workdir)

        pattern = os.path.join(workdir, "eembc", benchmark,
                               "%s%s*.log" % (toolchain, platform))
        for logfile in glob.iglob(pattern):
            os.unlink(logfile)
        if result != 0:
            self.error("Failed to rebuild log file for EEMBC")

        cmd[0] = "scripts/run.sh"

        result = self.execute(command=cmd,
                              env=env,
                              workdir="%s/eembc" % workdir)

        if result != 0:
            self.error("Failed to run EEMBC")

        # Now process the results
        cmd = ["scripts/results.sh"]
        cmd.extend(cmdoptions)

        result = self.execute(command=cmd,
                              env=env,
                              workdir="%s/eembc" % workdir)

        if result != 0:
            self.error("Failed to run EEMBC result script")

        bmarks = self.fetchBmarkList(workdir, platform)
        if bmarks == False:
            # Error set by fetchBmarkList
            return False

        logs = "%s/%s/%s" % (benchmark, toolchain, platform)

        if cq_stat == 1:
            runtime_dict = self.read_results_runtime("%s/%s/runtime.txt" %
                                                     (cqstat_out, logs))
            cctime_dict = self.read_results_cctime("%s/%s/cctime.txt" %
                                                   (cqstat_out, logs))
            hosttime_dict = self.read_results_hosttime("%s/%s/hosttime.txt" %
                                                       (cqstat_out, logs))
            codesize_dict = self.read_results_codesize("%s/%s/codesize.txt" %
                                                       (cqstat_out, logs))
            test_set = sets.Set(runtime_dict.keys())
            test_set |= sets.Set(cctime_dict.keys())
            test_set |= sets.Set(hosttime_dict.keys())
            test_set |= sets.Set(codesize_dict.keys())
            test_set |= sets.Set(bmarks)
            for key in test_set:
                results = {}
                test_passed = True
                if key in runtime_dict:
                    results['runtime'] = runtime_dict[key]
                elif key in hosttime_dict:
                    test_passed = False
                if key in cctime_dict:
                    results['cctime'] = cctime_dict[key]
                if key in hosttime_dict:
                    results['hosttime'] = hosttime_dict[key]
                if key in codesize_dict:
                    results['codesize'] = codesize_dict[key]

                self.testsuiteSubmit(key, test_passed, extendedresults=results)

            logs_tgz = "%s/%s_%s_%s.tar.gz" % (cqstat_out, benchmark,
                                               toolchain, platform)
            tar = tarfile.open(logs_tgz, "w:gz")
            tar.add("%s/%s" % (cqstat_out, logs), arcname=logs)
            tar.close()
            self.registerLogFile(logs_tgz)

        return True
Exemple #7
0
  def run(self):
    sharedir = self.getSharedPath()

    do_apps = self.config.getVariable ("RA Do Apps").split(",")
    self.config.setVariable ("RA_SOURCE", sharedir)

    host = self.getResource("Execution Host")
    p4port = str(host.getAttributeValue('P4PORT'))
    p4user = str(host.getAttributeValue('P4USER'))

    env = {
            'PATH' : CONFIG.makeSearchPath([CONFIG.getProgramDir(CONFIG.neo),
                                            CONFIG.getProgramDir(CONFIG.perl),
                                            os.environ['PATH']]),
            'P4USER' : p4user,
            'P4PORT' : p4port
          }

    fetch_options = []

    if self.version.startswith('CHANGELIST'):
      changelist = self.config.getVariable('RA_FETCH_CHANGELIST')
      if not changelist.startswith("@"):
        changelist = "@%s" % str(changelist)
      fetch_options.append("--changeset=%s" % changelist)
      fetch_options.append("--location=//meta/swcore/code/" +\
                           "regressionapps/MAIN/metag/" +\
                           "regressionapps/xyRegressionApps.xyf")
      fetch_options.append("RegressionApps")
    else:
      fetch_options.append("RegressionApps:%s" % self.version)

    p4_cmp = self.config.getVariable("COBIT_INST_ROOT")
    p4_cmp = os.path.join(p4_cmp, "bin", "p4_cmp")

    command = [p4_cmp, "fetch", "--writable"]
    fw_command = command[:]
    fw_command.append("--partial=metag/regressionapps/framework/...")
    fw_command.extend(fetch_options)
    fw_command.append(sharedir)
    print fw_command

    # Fetch the framework
    result = self.execute (env=env, command=fw_command)
    if result != 0:
      self.error("Unable to fetch framework")

    result = self.execute (env=env,
                           command=["./dependencies.pl"] + do_apps,
                           workdir=os.path.join(sharedir, 'metag', 
                                                'regressionapps',
                                                'framework', 'performance'))
    if result != 0:
      self.error ("Could not fetch dependencies")

    deps = set()
    for dep in self.fetchOutput().split("\n"):
      if dep != "":
        name = self.findComponentToCheckout(dep)
        deps.add(name)

    for subpath in deps:
      sub_command = command[:]
      sub_command.append("--partial=%s" % subpath)
      sub_command.extend(fetch_options)
      sub_command.append(sharedir)

      result = self.execute (env=env, command=sub_command)
      if result != 0:
        self.error("Unable to fetch %s" % subpath )

    return True
Exemple #8
0
    def run(self):
        da_max_timeout = 0
        metag_inst_root = self.config.getVariable("METAG_INST_ROOT")
        workdir = self.config.getVariable("RA_SOURCE")
        workdir = os.path.join(workdir, 'metag', 'regressionapps', 'framework',
                               'performance')
        toolchain = "gcc"
        target_board = self.config.getVariable("Target Board")
        if "FPGA" in target_board:
            implementation = "fpga_tcf"
        elif target_board == "Chorus 2 Metamorph":
            implementation = "silicon_atp120"
        elif target_board == "COMET Metamorph":
            implementation = "silicon_htp221"
        else:
            self.error("Unknown Target Board")
        config = self.config.getVariable("RA Config")
        do_apps = self.config.getVariable("RA Do Apps")
        run_as = self.config.getVariable("RA Run As")

        da_max_timeout = self.config.getVariable("RA Max Timeout")

        env = {
            'METAG_INST_ROOT':
            metag_inst_root,
            'PATH':
            CONFIG.makeSearchPath([
                CONFIG.getProgramDir(CONFIG.neo),
                CONFIG.getProgramDir(CONFIG.perl), os.environ['PATH']
            ])
        }

        toolchain_version = self.testrun.getVersion("MetaMtxToolkit")

        if self.testrun.getVersion("MECCToolkit") != None:
            mecc_inst_root = self.config.getVariable("MECC_INST_ROOT")
            env['MECC_INST_ROOT'] = mecc_inst_root
            env['LM_LICENSE_FILE'] = os.path.join(os.path.expanduser("~"),
                                                  "licenses", "uncounted.lic")
            toolchain = "mecc"
            toolchain_version = self.testrun.getVersion("MECCToolkit")

        cmd = [CONFIG.perl, "./main.pl"]
        cmd.extend(["--stage=run"])
        cmd.extend(["--compiler=%s" % toolchain])
        cmd.extend(["--compiler-version=%s" % toolchain_version])
        cmd.extend(["--config=%s" % config])
        cmd.extend(["--implementation=%s" % implementation])
        cmd.extend(do_apps.split(','))

        da = self.getResource("Debug Adapter")
        da_name = da.getAttributeValue("DA Name")
        cmd.extend(["--da=%s" % da_name])
        if run_as != "":
            cmd.extend(["--run-as=%s" % run_as])
        if da_max_timeout > 0:
            cmd.extend(["--da-max-timeout=%s" % da_max_timeout])

        result = self.execute(command=cmd, env=env, workdir=workdir)

        # Exit code 2 says at least one thing worked
        if result != 0 and result != 2:
            self.error("Failed to run RA")

        cmd[2] = '--stage=analyse'

        result = self.execute(command=cmd, env=env, workdir=workdir)

        # Exit code 2 says at least one thing worked
        if result != 0 and result != 2:
            self.error("Failed to analyse results")

        cmd = ['tar', 'cvfz', 'results.tar.gz', 'results']
        result = self.execute(command=cmd, env=env, workdir=workdir)

        if result != 0:
            self.error("Failed to register log file")

        self.registerLogFile(os.path.join(workdir, "results.tar.gz"))

        yaml_file = os.path.join(workdir, "results", "all.yaml.gz")

        data = yaml.load(gzip.GzipFile(yaml_file, "r"))

        if data == None or not 'tests' in data or data['tests'] == None or len(
                data['tests']) == 0:
            self.error("Empty yaml result file")

        for tst_k, tst_v in data['tests'].items():
            result = {}

            if 'run_time' in tst_v:
                result['run_time'] = tst_v['run_time']

            if 'execution_profile' in tst_v:
                if 'issued' in tst_v['execution_profile']:
                    result['issued'] = tst_v['execution_profile']['issued']
                if 'idle' in tst_v['execution_profile']:
                    result['idle'] = tst_v['execution_profile']['idle']

            if 'binaries' in tst_v:
                for bin_k, bin_v in tst_v['binaries'].items():
                    if 'sizes' in bin_v:
                        if 'custom' in bin_v['sizes']:
                            cst_v = bin_v['sizes']['custom']
                            for x in ('app_code', 'app_data', 'lib_code',
                                      'lib_data', 'total_code', 'total_data'):
                                if x in cst_v:
                                    result[x] = cst_v[x]

            self.testsuiteSubmit(tst_k,
                                 tst_v['passed'],
                                 extendedresults=result)

        return True
Exemple #9
0
    def run(self):
        dir_cadese = os.path.join('/user', 'local_cosy')
        serverhost = self.getResource("Execution Host").getHostName()

        workdir = os.path.join(self.config.getVariable("ST_SOURCE_ROOT"),
                               "supertest")
        spoofStdin = [[],
                      [
                          "export",
                          "MECC_INST_ROOT='%s'" %
                          self.config.getVariable("MECC_INST_ROOT")
                      ],
                      [
                          "export",
                          "LM_LICENSE_FILE='%s'" %
                          os.path.join(os.path.expanduser("~"), "licenses",
                                       "uncounted.lic")
                      ],
                      [
                          "export",
                          "METAG_INST_ROOT='%s'" %
                          self.config.getVariable("METAG_INST_ROOT")
                      ],
                      [
                          "export",
                          "METAG_FSIM_ROOT='%s'" %
                          self.config.getVariable("METAG_FSIM_ROOT")
                      ],
                      [
                          "export",
                          "PATH=%s" % CONFIG.makeSearchPath(
                              [CONFIG.getProgramDir(CONFIG.neo), "$PATH"])
                      ], ["export", "ALLOW_REMOTE_HASP=1"],
                      [
                          "./do-tests/%s-all.pl" % self.get_mode(),
                          "--results=$PWD/results",
                          "--serverhost=%s" % serverhost,
                      ] + self.get_testgroupopts(), ["exit"]]
        spoofStdin = [' '.join(x) for x in spoofStdin]
        spoofStdin = '\n'.join(spoofStdin)

        print "BEGIN STDIN"
        print spoofStdin
        print "END STDIN"

        cmd = ["product", "enter"]

        env = {
            'PATH':
            CONFIG.makeSearchPath([
                CONFIG.getProgramDir(CONFIG.neo),
                '%s/product/bin:%s/cadese/bin:%s/sccs/bin' %
                (dir_cadese, dir_cadese, dir_cadese), os.environ['PATH']
            ])
        }
        result = self.execute(env=env,
                              command=cmd,
                              workdir=workdir,
                              spoofStdin=spoofStdin)

        if not result == 0:
            self.error("Failed to run command")

        return self.success()
Exemple #10
0
    def run(self):
        host = self.getResource('Execution Host')
        p4port = str(host.getAttributeValue('P4PORT'))

        # Extract configuration data for this testrun
        MECC_INST_ROOT = self.config.getVariable("MECC_INST_ROOT")
        METAG_INST_ROOT = self.config.getVariable("METAG_INST_ROOT")
        METAG_FSIM_ROOT = self.config.getVariable("METAG_FSIM_ROOT")
        COBIT_INST_ROOT = self.config.getVariable("COBIT_INST_ROOT")

        root = self.getWorkPath()

        env = {
            'PATH':
            CONFIG.makeSearchPath([
                CONFIG.getProgramDir(CONFIG.neo),
                os.path.join(COBIT_INST_ROOT, 'bin'), os.environ['PATH']
            ]),
            'LM_LICENSE_FILE':
            os.path.join(os.path.expanduser("~"), "licenses", "uncounted.lic"),
            'MECC_INST_ROOT':
            MECC_INST_ROOT,
            'METAG_INST_ROOT':
            METAG_INST_ROOT,
            'METAG_FSIM_ROOT':
            METAG_FSIM_ROOT,
            'P4PORT':
            p4port,
            'P4USER':
            '******',
        }

        command = ['p4_cmp', 'fetch', 'TicketRegression']
        if self.version == 'CHANGELIST':
            changelist = self.config.getVariable(
                'MECCTICKETS_FETCH_CHANGELIST')
            command.append('--changeset=%s' % changelist)
            command.append(
                '--location=//meta/swcore/cosy/code/ticket_regression/MAIN/mecc/tickets/xyTicketRegression.xyf'
            )
        else:
            command[-1] = command[-1] + ':%s' % self.version
        command.append(root)

        if self.execute(env=env, command=command):
            self.error("Failed to fetch source")

        command = ["./all_tickets.sh"]

        if self.config.getVariable("MECCTICKETS_VERBOSE"):
            command.append('--verbose')

        if self.execute(workdir=os.path.join(root, "mecc", "tickets"),
                        env=env,
                        command=command):
            self.error("Failed to execute all_tickets.sh")

        summary = collections.defaultdict(lambda: 0)
        output = self.fetchOutput().splitlines()

        # Parse each line of the last command's output
        anything_failed = False

        for line in output:
            passed = False

            if re.match('\w+ *: *(PASS|FAIL) *: *.*$', line):
                line = re.split(' *: *', line)
                ticketid = line[0]
                result = line[1]
                ext_result = line[2]

                summary[ext_result] += 1

                passed = False

                if result == 'PASS':
                    passed = True
                else:
                    anything_failed = True

                self.testsuiteSubmit(ticketid, passed, {"Result": ext_result})

        if anything_failed:
            return self.failure(summary)

        return self.success(summary)
Exemple #11
0
    def createStaticTests(self, workDir, cvsroot, runNow):
        # prepare version dictionary
        useNeolist = self.config.getVariable("Use CSim NEOLIST")

        if useNeolist:
            pathNeolist = os.path.join(CONFIG.getProgramDir(CONFIG.neo),
                                       "csim.NEOLIST")
            try:
                fileNeolist = open(pathNeolist, "r")
                dataNeolist = fileNeolist.readlines()
                fileNeolist.close()
            except IOError:
                return self.failure(
                    {"Error": "Reading csim.NEOLIST file failed"})

        # checkout YAML files into work directory
        if not self.cvsCheckout("metag/tools/tests/simtests/yaml", cvsroot):
            self.error("Unable to check out yaml files")

        yamlDirectory = os.path.join(self.getWorkPath(), "metag", "tools",
                                     "tests", "simtests", "yaml")

        # replace proper strings in all YAML files (create copy of each)
        testruns = []
        for file in os.listdir(yamlDirectory):
            if not file.endswith("meta_static.yaml"):
                continue
            try:
                srcFilePath = os.path.join(yamlDirectory, file)
                dstFilePath = os.path.join(workDir, "ready-%s" % file)
                srcFile = open(srcFilePath, 'r')
                dstFile = open(dstFilePath, 'w')
                testruns.append(dstFilePath)

                # get proper verify and toolkit versions
                if useNeolist:
                    yamlDict = self.getConfig(dataNeolist, file)
                else:
                    yamlDict = self.getConfig()

                # replace fields
                text = srcFile.read()
                for key, value in yamlDict.items():
                    text = text.replace(key, value)
                dstFile.write(text)

                srcFile.close()
                dstFile.close()
            except IOError:
                return self.failure(
                    {"Error": "Couldn't replace strings in YAML files"})

        host = self.getResource("Execution Host")
        filesystem = host.getAttributeValue("Shared Filesystem")
        hostid = host.getAttributeValue("Specific Host")

        # generate and run all tests!
        for t in testruns:
            command = [
                CONFIG.neo, "overtest", "-t", "--new", "-u", "testsim",
                "--file", t, "--type", "Execution Host", "--attribute",
                "Specific Host", "--value", hostid
            ]
            if runNow:
                command.append("--go")

            result = self.execute(command=command)

            if result != 0:
                self.error("Creating the testruns failed")

        if testruns:
            return self.success()
        else:
            return self.failure(
                {"Error": "Creating the testruns dynamically failed"})
Exemple #12
0
    def run(self):
        METAG_INST_ROOT = self.config.getVariable("METAG_INST_ROOT")
        meoslib_version = self.testrun.getVersion("MeOSLib")

        # What configurations should be run
        interrupt_models = self.config.getVariable("Interrupt Models")
        library_variants = self.config.getVariable("Library Variants")
        interrupt_stack = self.config.getVariable("Fast Interrupt Stack")
        force_meta = self.config.getVariable("Force META ISA")
        if " " in interrupt_models or " " in library_variants or " " in interrupt_stack:
            self.run_all_configs = True

        env = {}
        env['PATH'] = os.environ['PATH']
        env['TEST_INT_MODELS'] = interrupt_models
        env['VARIANTS'] = library_variants
        env['FAST_STACKS'] = interrupt_stack
        env['TOOLKIT_VERSION'] = self.testrun.getVersion("MetaMtxToolkit")
        if env['TEST_INT_MODELS'] == "$(FAST_NAME)":
            env['LFLAGS_GEN'] = "-minterrupts=fastint"
        if force_meta:
            if 'LFLAGS_GEN' in env:
                env['LFLAGS_GEN'] += " -mno-minim"
            else:
                env['LFLAGS_GEN'] = "-mno-minim"

        if self.version == "Physical Board":
            # Run tests using a DA
            da = self.getResource("Debug Adapter")
            da_name = da.getAttributeValue("DA Name")

            host = self.getResource("Execution Host")
            cvsroot = host.getAttributeValue("KL metag CVSROOT")

            if meoslib_version in ("5.4.6", "5.4.7", "5.4.8", "5.4.9",
                                   "5.4.10", "5.4.11"):
                result = self.execute(command=[
                    "tar", "-xzf",
                    os.path.join(CONFIG.shareddir, "source_temp", "meos",
                                 "%s.tar.gz" % meoslib_version)
                ])
                if result != 0:
                    self.error("Unable to obtain source for meos %s" %
                               meoslib_version)

                indent_path = self.neoSelect("Indent", "2.2.9")
                if indent_path is None:
                    self.error("Unable to locate Indent 2.2.9")
                indent_path = os.path.join(indent_path, "bin")

                env['PATH'] = CONFIG.makeSearchPath([indent_path, env['PATH']])
                meos_dir = os.path.join(self.getWorkPath(), meoslib_version)
                test_command = ["make", "testclean", "test"]
            else:
                ccs_version = meoslib_version
                if ccs_version == "scratch":
                    ccs_version = ":MAX"
                if not self.ccsCheckout(
                        "metag/tools/libs/meos/ccs/meoslib.ccs", "MeOSLib",
                        ccs_version, cvsroot):
                    self.error("Unable to check out MeOSLib:%s" %
                               meoslib_version)

                if meoslib_version == "scratch":
                    meos_src = os.path.join(self.getWorkPath(), "metag",
                                            "tools", "libs", "meos", "meoslib")
                    if self.execute(workdir=meos_src,
                                    env={"CVSROOT": cvsroot},
                                    command=[CONFIG.cvs, "update", "-dPA"
                                             ]) != 0:
                        self.error("Unable to update meos to head source")

                meos_dir = os.path.join(self.getWorkPath(), "metag", "tools",
                                        "libs", "meos")
                test_command = ["make", "-f", "build.mk", "test"]

            board_type = self.config.getVariable("Target Board")

            env['MEOS_BOARD'] = "generic_tcf"

            # Workaround test system bug
            if meoslib_version == "5.3.2.0":
                env['BOARD_FEATURES'] = "2 1 DSP atp mtp NOLITE NOGP"

            TARGET_CPU = "metag"
            CORE = "meta"
            if board_type == "Chorus 2 Metamorph":
                env['MEOS_BOARD'] = "atp120dp_ocm"
                # Workaround test system bug
                if meoslib_version == "5.3.2.0":
                    env['BOARD_FEATURES'] = "4 2 1 DSP atp NOLITE NOGP"
            elif board_type == "MTX122 FPGA":
                env['TARGET_CPU'] = "mtxg"
                env['MEOS_BOARD'] = "mtx"
                CORE = "mtx"
                # Workaround test system bug
                if meoslib_version == "5.3.2.0":
                    env['BOARD_FEATURES'] = "1 atp MTX NOLITE NOGP"

            if board_type == "FRISA FPGA":
                env['BOARD_DSP_THREADS'] = "4"

            env['DA'] = da_name
            env['TEST_LOG'] = os.path.join(self.getWorkPath(), "meostests.log")
            env['METAG_INST_ROOT'] = METAG_INST_ROOT
            env['PREBUILT_MEOS'] = METAG_INST_ROOT
            env['PATH'] = CONFIG.makeSearchPath(
                [CONFIG.getProgramDir(CONFIG.neo), env['PATH']])
            env['CODESCAPE_VER'] = "7.1.1.8:x32"
            env['CORE'] = CORE
            env['BOARD'] = env['MEOS_BOARD']

            if self.execute(command=test_command, env=env,
                            workdir=meos_dir) != 0:
                self.error("Failed to run meos testsuite")

            # Now parse the log file
            if not os.path.exists(env['TEST_LOG']):
                self.error("Unable to find log file")

            self.parseLogFile(env['TEST_LOG'])
            self.registerLogFile(env['TEST_LOG'])

        return True
Exemple #13
0
        if self.execute(command=[
                " ".join(cmd + [
                    extra_gcc_config, "--make_target_all=skip",
                    "--make_target_install='%s'" %
                    gcc_install_target, "--jobs=1", "gcc"
                ])
        ],
                        shell=True) != 0:
            self.error("Failed to install gcc")

        if not "Canadian Cross" in self.version and new_elf_build \
           and self.version.startswith("Bare Metal") \
           and self.testrun.getVersion("SmallClib") != None:
            env = {}
            env['PATH'] = CONFIG.makeSearchPath(
                [CONFIG.getProgramDir(CONFIG.cmake), os.environ['PATH']])
            if self.execute(command=[" ".join(cmd + ["smallclib"])],
                            shell=True,
                            env=env) != 0:
                self.error("Failed to build smallclib")

        # Build GDB with the newly built host libexpat
        extra_host = "--hostlibs=%s" % hostinstall
        if self.execute(command=[" ".join(cmd + [extra_host, "gdb"])],
                        shell=True) != 0:
            self.error("Failed to build gdb")

        if self.testrun.getVersion(
                "Python") != None and "mingw" not in host_triple:
            if self.execute(command=[" ".join(cmd + [extra_host, "gdb-py"])],
                            shell=True) != 0:
Exemple #14
0
    def runMETA(self):
        isa = self.config.getVariable("Instruction Set")
        optfp = self.config.getVariable("Optimised Math")
        fpuconfig = self.config.getVariable("FPU Variant")

        env = {}
        env['PATH'] = CONFIG.makeSearchPath(
            [CONFIG.getProgramDir(CONFIG.cmake), os.environ['PATH']])
        env['OPTFPPATH'] = self.testrun.getSharedPath("FPU Math Library")
        env['INSTALL_DIR'] = self.getSharedPath()

        # Order of toolkits is important as using Linux also requires a GCC embedded
        # toolchain.
        cmd = []
        buildtests = []
        isalist = []
        if isa in ("Any", "meta"):
            isalist.append("meta")
        if isa in ("Any", "minim") and \
           self.testrun.getVersion("META Linux Buildroot") == None:
            isalist.append("minim")
        optfplist = []
        if optfp in ("Any", "optimised"):
            optfplist.append("optimised")
        if optfp in ("Any", "normal"):
            optfplist.append("normal")
        fpulist = []
        if fpuconfig == "Any":
            fpulist.extend(["single", "singledouble", "double"])
        else:
            fpulist.append(fpuconfig)

        for isa in isalist:
            if isa in A117705.mtests:
                for optfp in optfplist:
                    if optfp in A117705.mtests[isa]:
                        for fpuconfig in fpulist:
                            if fpuconfig in A117705.mtests[isa][optfp]:
                                buildtests.append(
                                    A117705.mtests[isa][optfp][fpuconfig])

        if self.testrun.getVersion("META Linux Buildroot") != None:
            # Build with META Linux GCC
            self.initialiseBuildSystem()
            env['METAG_LINUX_ROOT'] = self.toolkit_path
            cmd = ["make", "-f", "Makefile.META", "all-linux"]
        elif self.testrun.getVersion("MetaMtxToolkit") != None:
            # Build with META Embedded GCC
            env['METAG_INST_ROOT'] = self.config.getVariable("METAG_INST_ROOT")
            cmd = ["make", "-f", "Makefile.META", "all-embedded"]
        else:
            self.error("Unable to determine what toolchain to build with")

        bulletdir = os.path.join(self.getWorkPath(), "metag", "support",
                                 "examples", "bullet")
        for test in buildtests:
            command = cmd[:]
            command.extend(test)
            if self.execute(command=command, env=env, workdir=bulletdir) != 0:
                self.error("Failed to build test: %s" % test)
        return self.success()
Exemple #15
0
    def run(self):
        # Execute a command overriding some environment variables
        result = self.execute(
            workdir=self.getSharedPath(),
            command=[
                CONFIG.git, "clone",
                "--reference=%s/uTest.git" % CONFIG.gitref,
                "git://mipssw-mgmt.ba.imgtec.org/sec/uTest.git", "uTest"
            ])

        if result != 0:
            self.error("Unable to clone uTest repository")

        result = self.execute(workdir=os.path.join(self.getSharedPath(),
                                                   "uTest"),
                              command=[CONFIG.git, "checkout", "overtest"])

        if result != 0:
            self.error("Unable to checkout uTest branch")

        result = self.execute(
            workdir=self.getSharedPath(),
            command=[
                CONFIG.git, "clone",
                "--reference=%s/codesize-test-suites.git" % CONFIG.gitref,
                "git://mipssw-mgmt.ba.imgtec.org/sec/codesize-test-suites.git",
                "codesize-test-suites"
            ])

        if result != 0:
            self.error("Unable to clone codesize-test-suites repository")

        result = self.execute(workdir=os.path.join(self.getSharedPath(),
                                                   "codesize-test-suites"),
                              command=[CONFIG.git, "checkout", "overtest"])

        if result != 0:
            self.error("Unable to checkout codesize-test-suites branch")

        env = {
            'PATH':
            CONFIG.makeSearchPath([
                os.path.join(self.getSharedPath(), "uTest"),
                CONFIG.getProgramDir(CONFIG.python), os.environ['PATH']
            ])
        }

        triple = self.config.getVariable("Triple")
        vendor = triple.split("-", 2)[1]
        osname = triple.split("-", 2)[2]
        cflags = self.config.getVariable("CFLAGS")
        toolchain_root = self.config.getVariable("Toolchain Root")

        config_text = ("include overtest\n"
                       "\n"
                       "config mips_toolchain inherits " + vendor + ",os:" +
                       osname + "\n"
                       "{\n"
                       "  path = " + os.path.join(toolchain_root, "bin") + "\n"
                       "}\n"
                       "\n"
                       "config mips_gcc_options\n"
                       "{\n"
                       "  cmd_line += " + cflags + "\n"
                       "}\n"
                       "\n"
                       "variation mips_toolchains is mips_toolchain\n"
                       "variation mips_gcc_options is mips_gcc_options\n")

        config_file = open(
            os.path.join(self.getSharedPath(), "codesize-test-suites",
                         "testsuites", "config.tst"), "w")

        config_file.write(config_text)
        config_file.close()

        result = self.execute(
            workdir=os.path.join(self.getSharedPath(), "codesize-test-suites",
                                 "testsuites"),
            env=env,
            command=[
                "%s -t%s -Rcodesize -Afunc_size,stderr -Tfunc_size" %
                (os.path.join(self.getSharedPath(), "codesize-test-suites",
                              "scripts", "codesize"), self.concurrency)
            ],
            shell=True)

        testsuites_dir = os.path.join(self.getSharedPath(),
                                      "codesize-test-suites", "testsuites")
        logfile = open(
            os.path.join(testsuites_dir, "codesize_func_size_total.csv"))

        totalsize = 0

        logfile.readline()
        for total in logfile:
            (testname, size) = total.split(",")
            testname = testname.strip()
            if size.strip() == "":
                size = 0
            else:
                size = int(size.strip())
            totalsize += size
            self.testsuiteSubmit(testname, True, {"size": size})
        logfile.close()

        for logfile in [
                "codesize_func_size_all.csv", "codesize_func_size_total.csv",
                "codesize_stderr_all.csv"
        ]:
            self.registerLogFile(os.path.join(testsuites_dir, logfile), True)

        return self.success({"size": totalsize, "failures": result != 0})