Exemplo n.º 1
0
 def run_check_flow(self, suite, ini_dict):
     for key, case_list in ini_dict.items():
         partial_path, public_opts = key
         print "parsing %s/%s, %s" % (suite, self.case_ini, partial_path)
         if self.check_designs:
             my_cnt = Counter(case_list)
             for design, cnt in my_cnt.items():
                 if cnt > 1:
                     print "repeated design: %s, %d" % (design, cnt)
             continue
         failed_designs = 0
         for case in case_list:
             case_list = case.split()
             real_case = case_list[0]
             real_case = self.p_more.sub("", real_case)
             case_url = "%s/%s/%s/%s" % (self.default_svn, suite,
                                         partial_path, real_case)
             _exists, _no_use = get_status_output("svn ls %s" % case_url)
             if _exists:
                 print "NotFound %s" % case_url
                 failed_designs += 1
             if failed_designs > 10:
                 print "... More than 10 designs not be found"
                 break
         print "-" * 10
         print
Exemplo n.º 2
0
 def parse_suite_ini_file(self, suite):
     print "---------------"
     print suite
     suite_url = "%s/%s" % (self.svn, suite)
     for item in (self.case_ini, self.cmd_ini):
         ini_url = "%s/%s" % (suite_url, item)
         _exists, _no_use = get_status_output("svn ls %s" % ini_url)
         if _exists:
             continue
         if export_file_from_svn(ini_url):
             pass
     if not_exists(self.case_ini, "file"):
         return 1
     if not os.path.isfile(self.cmd_ini):
         cmd_dict = dict()
         pass  # just give the warning message
     else:
         sts, cmd_dict = get_conf_options(self.cmd_ini, key_lower=False)
         if sts:
             return 1
     # -------------------
     cmd_section = cmd_dict.get("cmd", dict())
     ini_dict = ini2dict(self.case_ini)
     if self.run_check:
         self.run_check_flow(suite, ini_dict)
     else:
         self.dump_to_file(suite, ini_dict, cmd_section)
     # -------------------
     os.remove(self.case_ini)
     if os.path.isfile(self.cmd_ini):
         os.remove(self.cmd_ini)
Exemplo n.º 3
0
def get_svn_dirs_files(svn_path):
    svn_dirs, svn_files = list(), list()
    svn_ls_cmd = "svn ls %s" % svn_path
    sts, text = get_status_output(svn_ls_cmd)
    if sts:
        say_it("- Error. Failed to run %s" % svn_ls_cmd)
        return svn_dirs, svn_files
    p_dir = re.compile("\W$")
    for item in text:
        if p_dir.search(item):
            svn_dirs.append(p_dir.sub("", item))
        else:
            svn_files.append(item)
    return svn_dirs, svn_files
Exemplo n.º 4
0
    def run_check_flow(self):
        # // run check flow always!
        report_path = os.getcwd();
        report = "check_flow.csv"
        check_py = os.path.join(os.path.dirname(__file__),'..','tools','check', "check.py")
        check_py = os.path.abspath(check_py)
        if xTools.not_exists(check_py, "source script file"):
            return 1
        cmd_kwargs = dict()
        cmd_kwargs["top_dir"] = "--top-dir=%s" % self.job_dir
        cmd_kwargs["design"] = "--design=%s" % self.design

        _check_conf = self.scripts_options.get("check_conf")
        if _check_conf:
            cmd_kwargs["conf_file"] = "--conf-file=%s" % _check_conf
        else:
            ### the conf file will be used as as family_device_package.conf
            [self.family2,self.device2,self.package2] = ["","",""]
            if not self.family:
                try:
                    [self.family2,self.device2,self.package2] = self.scripts_options.get("devkit","").split(",")
                except:
                    pass
            if self.family2.strip():
                self.family = self.family2
            if self.device2.strip():
                self.device = self.device2
            if self.package2.strip():
                self.package = self.package2
            _check_conf = self.family.strip()+"_"+self.device.strip()+"_"+self.package.strip()+".conf"
            if(os.path.isfile(os.path.join(self.src_design,_check_conf))):
                cmd_kwargs["conf_file"] ="--conf-file="+ _check_conf.replace(".conf","")
            else:
                #cmd_kwargs["conf_file"] = ""
                pass
        cmd_kwargs["report_path"] = "--report-path=%s" % report_path
        cmd_kwargs["tag"] = "--tag=%s" % self.tag
        cmd_kwargs["report"] = "--report=%s" % report
        cmd_line = r"%s %s " % (sys.executable, check_py)
        for key, value in cmd_kwargs.items():
            cmd_line += " %s " % value
        cmd_line = xTools.win2unix(cmd_line, 0)
        xTools.say_it(" Launching %s" % cmd_line)
        sts, text = xTools.get_status_output(cmd_line)
        xTools.say_it(text)
        return sts
Exemplo n.º 5
0
 def run_pre_post_process(self,pre=0):
     '''
     This function will run pre/post process for the cases. the scripts should be passed
     through the command.
     The run path is case result path(job_dir/design)!
     '''
     if pre == 1:
         cmd = self.scripts_options.get("pre_process")
     else:
         cmd = self.scripts_options.get("post_process")
     if cmd.find(".py")!= -1:
         if cmd.find("python") == -1:
             cmd = "%s %s" % (sys.executable, cmd)
         else:
             pass
     xTools.say_it("Launching %s" % cmd)
     sts, text = xTools.get_status_output(cmd)
     xTools.say_it(text)
     return sts
Exemplo n.º 6
0
def export_file_from_svn(svn_url):
    export_cmd = "svn export %s" % svn_url
    sts, text = get_status_output(export_cmd)
    if sts:
        say_it(text)
        return 1
Exemplo n.º 7
0
    def run_batch_file(self):
        testrun_path = os.path.join(self.design, "_scratch_cmd")
        if xTools.wrap_md(testrun_path, "TestRun Path"):
            return 1
        _recov = xTools.ChangeDir(testrun_path)
        squish_map_files, squish_conf_files = get_squish_file(
            os.path.join(self.design, "testdata"))
        if len(squish_map_files) != 1:
            xTools.say_it("Error. Found map files: %s" % squish_map_files)
            return 1
        if len(squish_conf_files) != 1:
            xTools.say_it("Error. Found conf files: %s" % squish_conf_files)
            return 1

        batch_kwargs = {
            "squishserver":
            self.squish_server,
            "squishrunner":
            self.squish_runner,
            "path_to_aut":
            os.path.join(self.diamond, "bin", self.nt_lin),
            "testcase":
            self.design,
            "reportgen":
            os.path.abspath("report_%s.xml" % time.strftime("%m%d%H%M")),
            "objectmap":
            squish_map_files[0],
            "language":
            get_focus(squish_conf_files[0], re.compile("LANGUAGE=(\w+)",
                                                       re.I)),
            "wrapper":
            get_focus(squish_conf_files[0], re.compile("WRAPPERS=(\w+)",
                                                       re.I)),
            # ------------
        }

        if self.on_win:
            batch_kwargs["set_path"] = r'set PATH=%%PATH%%;%s;%s\bin' % (
                os.path.join(self.diamond, "bin", self.nt_lin), self.squish)
            batch_kwargs[
                "run_server"] = r'start "Squishserver Window" /B "%s" --verbose' % self.squish_server
            batch_kwargs["sleep"] = "%s 5" % os.path.join(
                self.xlib, "sleep.exe")
            batch_kwargs["name_of_aut"] = "pnmain.exe"
        else:
            batch_kwargs["set_path"] = r'set PATH=$PATH:%s:%s/bin' % (
                os.path.join(self.diamond, "bin", self.nt_lin), self.squish)
            batch_kwargs["run_server"] = "%s &" % self.squish_server
            batch_kwargs["sleep"] = "sleep 5"
            batch_kwargs["name_of_aut"] = "diamond"

        batch_file = "run_squish.bat"
        xTools.write_file("run_squish.bat", RUN_SQUISH % batch_kwargs)
        if self.on_win:
            sts, txt = xTools.get_status_output(batch_file)
        else:
            sts, txt = xTools.get_status_output("sh %s" % batch_file)
        xTools.say_it("Status: %s" % sts)
        xTools.say_it(txt, "Detail:")
        xTools.write_file("runtime_console.log", txt)
        check_sts = get_final_status(txt)
        _recov.comeback()
        return check_sts