Beispiel #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
Beispiel #2
0
  def run(self):
    binutils = os.path.join(self.testrun.getSharedPath("Binutils"), "binutils")
    dejagnu = os.path.join(self.testrun.getSharedPath("Dejagnu"), "dejagnu")
    triple = self.config.getVariable("Triple")

    # Create the site config to run the suite
    self.make_site(binutils, triple)

    toolchain_root = self.config.getVariable("Toolchain Root")

    env = {}
    env['PATH'] = CONFIG.makeSearchPath([os.path.join(toolchain_root, "bin"),
					dejagnu, os.environ['PATH']])
    env['LC_ALL'] = 'C'
    if triple.startswith("nanomips"):
      arch = "nanomips"
    else:
      arch = "mips"

    target_board = arch + "-sim-mti32"
    cmd = ["runtest", "--tool", "binutils", "--target_board=%s" % target_board]
    self.execute(env=env, command=cmd)
    self.registerLogFile(os.path.join (self.getWorkPath(), "binutils.log"), compress=True)
    self.registerLogFile(os.path.join (self.getWorkPath(), "binutils.sum"), compress=True)
    summary = self.parse (os.path.join (self.getWorkPath(), "binutils.log"))
    return self.success(summary)
Beispiel #3
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")
Beispiel #4
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()
Beispiel #5
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()
Beispiel #6
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()
Beispiel #7
0
    def run(self):
        binutils = os.path.join(self.testrun.getSharedPath("Binutils"),
                                "binutils")
        dejagnu = os.path.join(self.testrun.getSharedPath("Dejagnu"),
                               "dejagnu")
        triple = self.config.getVariable("Triple")

        # Create the site config to run the suite
        self.make_site(binutils, triple)

        toolchain_root = self.config.getVariable("Toolchain Root")

        env = {}
        env['PATH'] = CONFIG.makeSearchPath(
            [os.path.join(toolchain_root, "bin"), dejagnu, os.environ['PATH']])
        env['LC_ALL'] = 'C'
        try:
            arch = self.config.getVariable("Architecture")
        except ConfigException, e:
            arch = "mips"
Beispiel #8
0
    def run(self):
        gdb = os.path.join(self.testrun.getSharedPath("GDB"), "gdb")
        dejagnu = os.path.join(self.testrun.getSharedPath("Dejagnu"),
                               "dejagnu")
        triple = self.config.getVariable("Triple")

        # Create the site config to run the suite
        self.make_site(gdb, triple)

        toolchain_root = self.config.getVariable("Toolchain Root")

        env = {}
        env['PATH'] = CONFIG.makeSearchPath([
            os.path.join(toolchain_root, "bin"),
            "/user/rgi_data2/Verify/CentOS-5/Tcl_8.6.4_x64/root/bin", dejagnu,
            os.environ['PATH']
        ])
        if triple == "nanomips-elf" and self.version == "GNUSIM":
            target_board = "nanomips-sim-mti32"
            gdb_bin = os.path.join(toolchain_root, "bin", "%s-gdb" % triple)
        else:
            self.error("Unknown configuration")

        cmd = [
            "runtest",
            "--target_board=%s" % target_board,
            "GDB=%s" % gdb_bin
        ]
        self.execute(env=env, command=cmd)

        self.registerLogFile(os.path.join(self.getWorkPath(), "gdb.log"),
                             compress=True)
        self.registerLogFile(os.path.join(self.getWorkPath(), "gdb.sum"),
                             compress=True)

        summary = self.parse(os.path.join(self.getWorkPath(), "gdb.log"))

        return self.success(summary)
Beispiel #9
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(
                [os.path.join(COBIT_INST_ROOT, 'bin'), os.environ['PATH']]),
            'P4PORT':
            p4port,
            'P4USER':
            '******',
        }

        command = [
            'p4_cmp', 'fetch', 'MECCToolkit', '--partial=mecc/release/...'
        ]
        if self.version == 'CHANGELIST':
            changelist = self.config.getVariable(
                'MECCSCRIPTS_FETCH_CHANGELIST')
            command.append('--changeset=%s' % changelist)
            location = self.config.getVariable('MECCSCRIPTS_FETCH_LOCATION')
            command.append('--location=%s' % location)
        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("MECC_RELEASE_ROOT", root)

        return self.success()
Beispiel #10
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
Beispiel #11
0
        plt.vlines(midx, -600, 500, label="v_" + name)

    fig, ax = plt.subplots()
    ax.scatter(df.x, df.y)
    for i, indexnum in enumerate(range(len(df.x))):
        ax.annotate(indexnum + 1, (df.x[i], df.y[i]))
    plt.plot([df.iloc[index1].x, df.iloc[index2].x], [df.iloc[index1].y, df.iloc[index2].y])
    plt.xlabel("X")
    plt.ylabel("Y")
    x1, y1 = df.iloc[index2].x, df.iloc[index2].y
    x2, y2 = df.iloc[index1].x, df.iloc[index1].y
    midx, midy = x1 - (x1 - x2) * 0.325, y1 - (y1 - y2) * 0.325
    frontx, fronty = x1 - (x1 - x2) * 0.15, y1 - (y1 - y2) * 0.15
    backx, backy = x1 - (x1 - x2) * 0.5, y1 - (y1 - y2) * 0.5

    plot_linec(x1, y1, x2, y2, 0.15, "0.15c")
    plot_linec(x1, y1, x2, y2, 0.3, "0.3c")
    plot_linec(x1, y1, x2, y2, 0.5, "0.5c")
    plt.legend(loc="lower right")
    plt.savefig(csv_path + "/front_mid_back.png")


# 初始化配置文件
opt = CONFIG(project_path='F:/ansys_program/windblade/ansys_model/',
             csv_path='F:/ansys_program/windblade/useful_csv/',
             Encoding='BG', NIND=20, MAXGEN=300,
             Drawing=1, plot_use=False,
             start_time=time.time(), ansys_time=1, primary_index=1)

getjiemian_linec(opt.csv_path)
Beispiel #12
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()
Beispiel #13
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)
Beispiel #14
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"})
Beispiel #15
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()
Beispiel #16
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})
Beispiel #17
0
    def run(self):
        dejagnu = os.path.join(self.testrun.getSharedPath("Dejagnu"),
                               "dejagnu")
        gcc = os.path.join(self.testrun.getSharedPath("GCC"), "gcc")

        triple = self.config.getVariable("Triple")
        toolchain_root = self.config.getVariable("Toolchain Root")

        gcc_exec = os.path.join(toolchain_root, "bin", "%s-gcc" % triple)
        gpp_exec = os.path.join(toolchain_root, "bin", "%s-g++" % triple)
        test_installed = os.path.join(gcc, "contrib", "test_installed")

        testSelection = self.config.getVariable("GCC Test Selection")
        cflags = self.config.getVariable("CFLAGS")
        # This is 32, n32 or 64
        abi = self.config.getVariable("ABI")
        # This is el or eb
        endian = self.config.getVariable("Endian")

        env = {}
        env['PATH'] = CONFIG.makeSearchPath(
            [os.path.join(toolchain_root, "bin"), dejagnu, os.environ['PATH']])

        if triple.startswith("nanomips"):
            if abi == "p32":
                abi_opt = "-m32"
            elif abi == "p64":
                abi_opt = "-m64"
            else:
                self.error("unknown abi %s" % abi)
        else:
            abi_opt = "-mabi=%s" % abi

        if endian == "el":
            cflags = "%s -EL %s" % (abi_opt, cflags)
        else:
            cflags = "%s -EB %s" % (abi_opt, cflags)

        cflags = "/%s" % cflags.replace(" ", "/")

        extra_command = []

        if self.version.startswith("QEMU"):
            qemu_root = self.config.getVariable("QEMU Root")
            cpu = self.config.getVariable("CPU")
            if triple.endswith("linux-gnu") or triple.endswith("linux-musl"):
                board = "multi-sim"
                if abi == "32" or abi == "p32":
                    suffix = ""
                else:
                    suffix = abi
                kernel_version = self._getKernelVersion()
                if triple.startswith("nanomips"):
                    cpu = "nanomips-generic"
                    if endian == "eb":
                        suffix = "%seb" % suffix
                    qemu_exec = os.path.join(qemu_root, "bin",
                                             "qemu-nanomips%s" % suffix)
                else:
                    if endian == "el":
                        suffix = "%sel" % suffix
                    qemu_exec = os.path.join(qemu_root, "bin",
                                             "qemu-mips%s" % suffix)
                env['DEJAGNU_SIM'] = qemu_exec
                env['DEJAGNU_SIM_OPTIONS'] = "-r %s -cpu %s" % (kernel_version,
                                                                cpu)
                env['DEJAGNU_SIM_GCC'] = gcc_exec
                env['ASAN_OPTIONS'] = "color=never"
                env['UBSAN_OPTIONS'] = "color=never"
                env['LSAN_OPTIONS'] = "color=never"
                env['TSAN_OPTIONS'] = "color=never"
            else:
                board = "generic-sim"
                if abi == "32" or abi == "p32":
                    suffix = ""
                else:
                    suffix = "64"
                if triple.startswith("nanomips"):
                    cpu = "nanomips-generic"
                    if endian == "eb":
                        suffix = "%seb" % suffix
                    qemu_exec = os.path.join(qemu_root, "bin",
                                             "qemu-system-nanomips%s" % suffix)
                else:
                    if endian == "el":
                        suffix = "%sel" % suffix
                    qemu_exec = os.path.join(qemu_root, "bin",
                                             "qemu-system-mips%s" % suffix)
                env['DEJAGNU_SIM'] = qemu_exec
                env['DEJAGNU_SIM_OPTIONS'] = "-cpu %s -semihosting -nographic -kernel" % cpu
                if abi in ("32", "p32"):
                    env['DEJAGNU_SIM_LDSCRIPT'] = "-Tuhi32.ld"
                elif abi == "n32":
                    env['DEJAGNU_SIM_LDSCRIPT'] = "-Tuhi64_n32.ld"
                else:
                    env['DEJAGNU_SIM_LDSCRIPT'] = "-Tuhi64_64.ld"
                env['DEJAGNU_SIM_LINK_FLAGS'] = "-Wl,--defsym,__memory_size=32M"
        elif self.version == "GNUSIM":
            extra_command.append(
                "SIM=%s" %
                os.path.join(toolchain_root, "bin", "%s-run" % triple))
            if abi in ("32", "p32"):
                board = "mips-sim-mti32"
            elif abi == "n32":
                board = "mips-sim-mti64_n32"
            elif abi == "64":
                board = "mips-sim-mti64_64"
            else:
                self.error("Unknown ABI")

        # Add the HOSTCC and HOSTCFLAGS variables for build programs
        self.setHostCC(test_installed)

        command = [
            test_installed, "--without-gfortran", "--without-objc",
            "--without-gcc",
            "--with-g++=%s" % gpp_exec,
            "--prefix=%s" % toolchain_root,
            "--target=%s" % triple,
            "--target_board=%s%s" % (board, cflags)
        ]

        if testSelection != "":
            command.append(testSelection)

        command.extend(extra_command)

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

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

        self.registerLogFile(os.path.join(self.getWorkPath(), "g++.log"),
                             compress=True)
        self.registerLogFile(os.path.join(self.getWorkPath(), "g++.sum"),
                             compress=True)

        summary = self.parse(os.path.join(self.getWorkPath(), "g++.log"))

        return self.success(summary)
Beispiel #18
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:
Beispiel #19
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
Beispiel #20
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
Beispiel #21
0
class A117837(Action):
    def __init__(self, data):
        Action.__init__(self, data)
        self.actionid = 117837
        self.name = "GOLD Test"

    # Execute the action.
    def run(self):
        triple = self.config.getVariable("Triple")
        toolchain_root = self.config.getVariable("Toolchain Root")
        # Execute a command overriding some environment variables
        for i in range(30):
            result = self.execute(command=[
                CONFIG.git, "clone",
                "--reference=%s/mips_tool_chain.git" %
                CONFIG.gitref, "--branch=master",
                "%s/mips_tool_chain.git" % CONFIG.gitremote, "mips_tool_chain"
            ])
            if result == 0:
                break
            else:
                time.sleep(random.randint(1, 30))

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

        # Now construct the work area
        result = self.execute(command=[
            "build_scripts/make_workarea %s %s" %
            (self.getWorkPath(), CONFIG.gitremote)
        ],
                              workdir=os.path.join(self.getWorkPath(),
                                                   "mips_tool_chain"),
                              shell=True)
        if result != 0:
            self.error("Unable to make work area")

        result = self.execute(command=[CONFIG.git, "checkout", "master"],
                              workdir=os.path.join(self.getWorkPath(), "src",
                                                   "mips_tool_chain"))

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

        result = self.execute(workdir=os.path.join(self.getWorkPath(), "src",
                                                   "mips_tool_chain"),
                              command=[CONFIG.git, "rev-parse", "HEAD"])
        if result == 0:
            self.config.setVariable("Toolchain Build rev",
                                    self.fetchOutput().strip())

        target = self.config.getVariable("Triple")

        build = os.path.join(self.getWorkPath(), "obj-%s" % target)
        install = "/none/"

        # Add in the path of any host compiler specified
        try:
            host_triple = self.config.getVariable("Host Triple")
            if host_triple != "":
                host_version = self.config.getVariable("Host Version")
                host_bin = "/projects/mipssw/toolchains/%s/%s/bin" % (
                    host_triple, host_version)
                host_path = host_bin
        except ConfigException, e:
            host_triple = ""
            host_path = ""
            pass

        # Prepare for main tools build
        options = [
            "--path=%s" % host_path,
            "--git_home=%s" % CONFIG.gitremote,
            "--build=%s" % build,
            "--prefix=%s" % install,
            "--target=%s" % target,
            "--jobs=%d" % self.concurrency
        ]

        # Set the host tools if specified
        if host_triple != "":
            options.append("--host=%s" % host_triple)
            # For linux hosted builds we expect the newly built tools to execute on
            # the current distro as the C library used should be older than the
            # native one.  We do this by forcing the build and host to match.
            if "pc-linux-gnu" in host_triple:
                options.append("--build_triple=%s" % host_triple)

        # Gather the location of all the packages
        gold = os.path.join(self.testrun.getSharedPath("GOLD"), "gold")
        options.append("--src=gold:%s" % gold)

        # Build GOLD
        cmd = ["b/build_toolchain", "build"]
        cmd.extend(options)

        if self.execute(command=[
                " ".join(cmd + ["gold", "--make_target_install=skip"])
        ],
                        shell=True) != 0:
            self.error("Failed to build gold")

        env = {}
        env['PATH'] = CONFIG.makeSearchPath([
            os.path.join(toolchain_root, "bin"), host_path, os.environ['PATH']
        ])

        cmd = [
            "make",
            "TEST_READELF=%s-readelf" % triple,
            "TEST_OBJDUMP=%s-objdump" % triple,
            "TEST_OBJCOPY=%s-objcopy" % triple,
            "TEST_STRIP=%s-strip" % triple,
            "TEST_AR=%s-ar" % triple,
            "TEST_NM=%s-nm" % triple,
            "TEST_AS=%s-as" % triple, "check"
        ]

        testsuite_path = os.path.join(build, "gold", "gold", "testsuite")
        self.execute(env=env, command=cmd, workdir=testsuite_path)

        logfile = os.path.join(testsuite_path, "test-suite.log")
        self.registerLogFile(logfile)
        results = {}
        with open(logfile, "r") as fh:
            for line in fh:
                # 1 of 12 tests failed.
                if "tests failed" in line:
                    parts = line.split(" ")
                    results["FAIL"] = int(parts[0])
                    results["PASS"] = int(parts[2])
                # All 12 tests passed.
                elif "tests passed" in line:
                    parts = line.split(" ")
                    results["PASS"] = int(parts[1])

        return self.success(results)
Beispiel #22
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
Beispiel #23
0
    def run(self):
        host = self.getResource('Execution Host')
        p4port = str(host.getAttributeValue('P4PORT'))
        COBIT_INST_ROOT = self.config.getVariable("COBIT_INST_ROOT")

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

        if self.version == 'CHANGELIST':
            root = self.getWorkPath()

            command = ['p4_cmp', 'fetch', '--writable', 'EEMBC']
            if self.version == 'CHANGELIST':
                changelist = self.config.getVariable('EEMBC_FETCH_CHANGELIST')
                command.append('--changeset=%s' % changelist)
                command.append(
                    '--location=//meta/swcore/code/restricted/eembc/MAIN/eembc/xyEEMBC.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("EEMBC Source", root)

            result = self.execute(command=["scripts/initialise.sh"],
                                  workdir="%s/eembc" % root)

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

            return True
        else:
            workdir = self.getWorkPath()
            # The version to fetch is anything up to the first space, anything
            # following the space is a comment does not affect the get_source
            # command
            neo_cmp_ver = self.version.split(" ")[0]

            # The environment is set at this point
            # P4PORT and P4USER are required
            if not self.neoGetSource(workdir, "EEMBC", neo_cmp_ver, env):
                self.error("Failed to get source")
            self.config.setVariable("EEMBC Source", workdir)

            result = self.execute(command=["scripts/initialise.sh"],
                                  workdir="%s/eembc" % workdir)

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

            return True