Exemplo n.º 1
0
    def commit_generate(self):

        self.force_result = SysUtils.ifthen(
            SysUtils.success(self.force_retcode), "PASS", "FAIL"
        )
        self.force_level = SummaryLevel.Any

        if SysUtils.failed(self.force_retcode):
            self.force_level = SummaryLevel.Fail

        Msg.lout(self, "user", "Performance Summary Item Commit Generate")
        if SysUtils.success(self.force_retcode):
            Msg.info(
                "Instructions: %d, Default: %d, Secondary: %d, "
                "Elapsed Time: %0.5f Seconds\n\n"
                % (
                    self.total,
                    self.default,
                    self.secondary,
                    self.force_end - self.force_start,
                )
            )
            return 1

        return 0
Exemplo n.º 2
0
    def execute(self):

        # super().execute()
        # Msg.dbg("ExecuteController::exec_gen(%s)" % (arg_task_file))

        # NOTE: Do not change force_cmd may need to reuse!!
        my_log = "gen.log"  # arg_testname.replace(".py", ".gen.log")
        my_elog = "gen.err"  # arg_testname.replace(".py", ".gen.log")

        my_cmd = self.force_cmd % (self.task_file)  # , my_log)
        # Msg.info("ForceCommand = " + str({ GenerateKeys.gen_cmd: my_cmd, GenerateKeys.gen_log: my_log, GenerateKeys.gen_elog: my_elog }), True)

        Msg.info(
            "GenCmd = " + str({
                GenerateKeys.gen_app: "force",
                GenerateKeys.gen_cmd: my_cmd,
                GenerateKeys.gen_log: my_log,
                GenerateKeys.gen_elog: my_elog,
                "max-instr": self.ctrl_item.max_instr,
                "min-instr": self.ctrl_item.min_instr
            }), True)
        my_return = SysUtils.exec_process(my_cmd, my_log, my_elog,
                                          self.ctrl_item.timeout, True)
        # the return from exec_process is a tuple, see generate_executor.py, retcode, stdout, stderr, start-time, end-time
        my_results = self.extract_results(my_return, "./" + my_log,
                                          "./" + my_elog)
        Msg.info("GenResult = " + str(my_results))
        Msg.flush()

        return SysUtils.success(int(my_return[GenerateResult.process_retcode]))
Exemplo n.º 3
0
    def prepare(self):

        if self.root.startswith("$(") and self.root.endswith(")"):
            self.root = PathUtils.exclude_trailing_path_delimiter(
                SysUtils.envar(self.root[2:-1], None))

        self.default_fsdb_do = PathUtils.append_path(self.root,
                                                     self.default_fsdb_do)

        if self.regr.startswith("$(") and self.regr.endswith(")"):
            self.regr = PathUtils.exclude_trailing_path_delimiter(
                SysUtils.envar(self.regr[2:-1], "logs"))
        else:
            self.regr = "logs"

        if self.cfg.startswith("$(") and self.cfg.endswith(")"):
            self.cfg = PathUtils.exclude_trailing_path_delimiter(
                SysUtils.envar(self.cfg[2:-1], "target_config"))
        else:
            self.cfg = "config_name"

        if self.name.startswith("$(") and self.name.endswith(")"):
            self.name = PathUtils.exclude_trailing_path_delimiter(
                SysUtils.envar(self.name[2:-1], "uvm_simv_opt"))
        else:
            self.cfg = "uvm_simv_opt"

        self.path = PathUtils.exclude_trailing_path_delimiter(self.path)
        self.tgt = PathUtils.exclude_trailing_path_delimiter(self.tgt)

        self._debug_command = self.cmd % (self.root, self.path, self.regr,
                                          self.tgt, self.debug_cfg,
                                          self.debug_name)
Exemplo n.º 4
0
    def copyWavesFsdbDoFile(self):
        dofile_path = self.rtl.get("fsdb_do")

        if dofile_path is not None and type(dofile_path) is str:
            SysUtils.exec_cmd(
                "cp %s %s/%s_waves_fsdb.do" %
                (dofile_path, PathUtils.current_dir(), self.task_name))
Exemplo n.º 5
0
    def execute(self):

        if not PathUtils.check_file("./_def_frun.py"):
            Msg.user(
                "[FrunToCtrlExecutor::skip] skipping since no _def_frun.py found"
            )
            return True

        my_cmd = self.mFrunToCtrlCmd
        if my_cmd is None:
            Msg.user(
                "[FrunToCtrlExecutor::skip] skipping since no path was given")
            return True

        Msg.user("FrunToCtrlCommand = " + str({"frun-to-ctrl-cmd": my_cmd}))
        Msg.flush()

        self.log = "frun_to_ctrl_result.log"
        self.elog = "frun_to_ctrl_result.err"

        my_result = SysUtils.exec_process(my_cmd, self.log, self.elog,
                                          self.ctrl_item.timeout, True)
        Msg.user("FrunToCtrlResult = " + str(my_result))
        Msg.flush()

        return SysUtils.success(int(my_result[0]))
Exemplo n.º 6
0
    def run(self):

        # Msg.user( "Worker Thread Instance Id: %s, (1)" % ( str( id( self ))) , "WORK-THREAD" )
        my_sum_qitem = None
        try:
            self.setupWorkDir()

            my_launcher = self.create_launcher()
            Msg.user("Launcher Id 1: %s" % (str(id(my_launcher))),
                     "WORK-THREAD")
            # Msg.user( "Worker Thread Instance Id: %s, (2)" % ( str( id( self ))) , "WORK-THREAD" )
            my_launcher.launch()
            Msg.user("Launcher Id 2: %s" % (str(id(my_launcher))),
                     "WORK-THREAD")
            # Msg.user( "Worker Thread Instance Id: %s, (3)" % ( str( id( self ))) , "WORK-THREAD" )
            my_process_result = my_launcher.extract_results()
            Msg.user("Process Result: %s" % (my_process_result), "WORK-THREAD")
            Msg.user("Launcher Id 3: %s" % (str(id(my_launcher))),
                     "WORK-THREAD")
            #
            self.launcher = my_launcher

            Msg.user("Process Result: %s" % (my_process_result), "WORK-THREAD")
            my_sum_qitem = SummaryQueueItem(my_process_result)
            Msg.user("Created Summary Queue Item", "WORK-THREAD")

        except Exception as arg_ex:

            Msg.error_trace(str(arg_ex))
            Msg.err("Message: %s, Control File Path: %s" %
                    (str(arg_ex), self.queue_item.work_dir))
            my_sum_qitem = SummaryErrorQueueItem({
                "error":
                arg_ex,
                "message":
                "Error Processing Task ...",
                "path":
                self.queue_item.ctrl_item.file_path(),
                "type":
                str(type(arg_ex))
            })
        finally:

            # my_launcher = None
            my_attempt = 0
            while (self.summary.queue.enqueue(my_sum_qitem) == False):
                SysUtils.sleep(100)
                #heartbeat
                my_attempt += 1
                if (my_attempt % 10) == 0:
                    Msg.dbg("Attempt %d to insert into summary queue" %
                            (my_attempt))

            self.thread_count.delta(-1)
            Msg.user("Thread Count Decremented", "WORK-THREAD")

            self.done_semaphore.release()
            Msg.user("Semaphore Released", "WORK-THREAD")
            Msg.user("Launcher Id 5: %s" % (str(id(self.launcher))),
                     "WORK-THREAD")
Exemplo n.º 7
0
 def waitForLfs(self, aModTime):
     if self.launcher_type == LauncherType.Lsf:
         time_diff = int ( DateTime.Time() - aModTime )
         if time_diff < MasterRun.cLsfWaitTime:
             sec_delay = MasterRun.cLsfWaitTime - time_diff
             Msg.info ("Using LSF, delaying %d seconds so that stale output/regression file handle will expire..." % sec_delay)
             SysUtils.sleep_seconds_with_progress(sec_delay)
             Msg.info ("Waiting done, resumed master run")
Exemplo n.º 8
0
    def process_summary_totals( self, arg_ofile, arg_instr_count, arg_cycle_count ):
        Msg.blank("info")

        # generator totals
        my_gfails =  self.gen_total - self.gen_passed
        my_lines =  "\nGenerate    : %3d\n" % ( self.gen_total )
        my_lines += "Generate Fails: %3d\n" % ( my_gfails )
        my_lines += "Generate Success Rate : %5.2f%%\n" % ( SysUtils.percent( self.gen_passed, self.gen_total ))
        my_lines += "\n"

        my_sfails = 0
        if self.iss_total >0:
            # ISS sim totals
            my_sfails =  self.iss_total - self.iss_passed
            my_lines += "ISS Sim   : %3d\n" % ( self.iss_total )
            my_lines += "ISS Sim Fails: %3d\n" % ( my_sfails )
            my_lines += "ISS Sim Success Rate : %5.2f%%\n" % ( SysUtils.percent( self.iss_passed, self.iss_total ))
            my_lines += "\n"

            my_lines += "Total Instructions Emulated: %3d\n" % ( arg_instr_count )
            my_lines += "\n"

        my_rfails = 0
        if self.rtl_total >0:
            # RTL sim totals
            my_rfails =  self.rtl_total - self.rtl_passed
            my_lines += "RTL Sim   : %3d\n" % ( self.rtl_total )
            my_lines += "RTL Sim Fails: %3d\n" % ( my_rfails )
            my_lines += "RTL Sim Success Rate : %5.2f%%\n" % ( SysUtils.percent( self.rtl_passed, self.rtl_total ))
            my_lines += "\n"

            my_lines += "Total Cycle Count: %3d\n" % ( arg_cycle_count )
            my_lines += "\n"

        my_cfails = 0
        if self.trace_cmp_total > 0:
            # simulation totals
            my_cfails = self.trace_cmp_total - self.trace_cmp_passed
            my_lines += "Compared     : %3d\n" % ( self.trace_cmp_total )
            my_lines += "Compare Fails: %3d\n" % ( my_cfails )
            my_lines += "Compare Success Rate : %5.2f%%\n" % ( SysUtils.percent( self.trace_cmp_passed, self.trace_cmp_total ))
            my_lines += "\n"


        # task totals
        my_task_total = ( self.task_total)
        my_total_fails =  my_gfails + my_sfails + my_cfails + my_rfails
        my_lines += "Total Tasks     : %3d\n" % ( my_task_total )
        my_lines += "Task Fails      : %3d\n"   % ( my_total_fails )
        my_lines += "Task Success Rate: %5.2f%%\n" % ( SysUtils.percent( my_task_total - my_total_fails, ( my_task_total )))
        my_lines += "\n"
        my_lines += "Total Run Time: %0.5f Seconds" % ( DateTime.Time() - self.start_time )

        Msg.blank("info")
        Msg.info( my_lines )
        Msg.blank("info")

        arg_ofile.write( my_lines )
Exemplo n.º 9
0
    def execute(self):
        if not PathUtils.check_file("sim.log"):
            Msg.info(
                "[TracediffRiscVExecutor::skip] skipping since no sim.log found"
            )
            return True
        if not PathUtils.check_file("fpix_sim.log"):
            Msg.info(
                "[TracediffRiscVExecutor::skip] skipping since fpx_sim.log not found"
            )
            return True

        my_cmd = "diff -y fpix_sim.log sim.log | grep -ve \"---\" | grep -vie \"exi\" | grep -vie \"exe\" | grep -ve \"_t\""

        self.log = "tracediff_result.log"  # arg_testname.replace( ".py", ".pgen.log" )
        self.elog = "tracediff_result.err"  # arg_testname.replace( ".py", ".gen.log" )

        my_result = SysUtils.exec_process(my_cmd, self.log, self.elog,
                                          self.ctrl_item.timeout, True)
        my_use_result = None

        vbar_symbol_count = 0
        exception_count = 0
        success = False
        with open(self.log, 'r') as results_file:
            for line in results_file:
                vbar_symbol_count += line.count('|')
                if "Excpt ID 0x2" in line:
                    exception_count = exception_count + 1
            if vbar_symbol_count == 0 and exception_count == 0:
                success = True
            my_use_result = list(my_result)
            my_use_result[0] = int(
                not success
            )  #This inversion is necessary because int 0 means success to the Summary class.

        with open(self.log, 'a') as out_file:
            if success == False:
                out_file.write(
                    "tracediff_riscv.log fail, look for | symbols or 'Excpt ID 0x2'; "
                    + str(vbar_symbol_count) + " mismatches, and up to " +
                    str(exception_count) + " suspicious exceptions.")
            else:
                out_file.write(
                    "tracediff_riscv.log success, only bootcode difference between standalone and interactive as expected."
                )

        Msg.info("CMPCommand = " + str({"trace-cmp-cmd": my_cmd}))
        my_extract_results = self.extract_results(my_use_result,
                                                  "./" + self.log, None)
        Msg.info("CMPResult = " + str(my_extract_results))

        Msg.flush()

        #return SysUtils.success(0) #[0,1,2] #Doesn't seem to really matter what this is, the Summary system needs fixing.
        return SysUtils.success(int(my_result[ToolResult.process_retcode]))
Exemplo n.º 10
0
    def commit(self):

        my_gen_cnt = 0
        my_gen_ret = 0
        my_sim_cnt = 0
        my_sim_ret = 0
        my_rtl_cnt = 0
        my_rtl_ret = 0
        my_trace_cmp_ret = 0
        my_trace_cmp_cnt = 0
        my_tgt_name = ""
        self.passed = True

        if self.has_generate():
            #Msg.user( "if self.has_generate(): True" )
            my_gen_cnt = 1
            my_gen_ret = self.commit_generate()
            self.passed = self.passed and bool(my_gen_ret)

        if self.has_simulate():
            #Msg.user( "if self.has_simulate(): True" )
            my_sim_cnt = 1
            my_sim_ret = self.commit_simulate()
            self.passed = self.passed and bool(my_sim_ret)

        if self.has_rtl():
            #Msg.user( "if self.has_rtl(): True" )
            my_rtl_cnt = 1
            my_rtl_ret = self.commit_rtl()
            self.passed = self.passed and bool(my_rtl_ret)

        # Msg.user( "SummaryItem::commit - [20]", "GOT HERE" )
        if self.has_trace_cmp():
            # Msg.user( "SummaryItem::commit - [21]", "GOT HERE"  )
            my_trace_cmp_cnt = 1
            # Msg.user( "SummaryItem::commit - [22]", "GOT HERE"  )
            my_trace_cmp_ret = self.commit_trace_cmp()
            self.passed = self.passed and bool(my_trace_cmp_ret)

        # Msg.user( "SummaryItem::commit - [24]", "GOT HERE"  )
        my_src_name = "%s%s" % (self.task_path, "STARTED")
        my_tgt_name = "%s%s" % (self.task_path,
                                SysUtils.ifthen(
                                    self.passed, "PASS",
                                    SysUtils.ifthen(self.signal_id is None,
                                                    "FAIL", "INCOMPLETE")))

        PathUtils.move(my_src_name, my_tgt_name)

        if not self.passed:
            self.summary.do_on_fail(self)

        return (my_gen_cnt, my_gen_ret, my_sim_cnt, my_sim_ret, my_rtl_cnt,
                my_rtl_ret, my_trace_cmp_cnt, my_trace_cmp_ret)
Exemplo n.º 11
0
    def commit_trace_cmp( self ):

        # Msg.dbg( "RegressionSummaryItem::commit_generate" )
        self.trace_cmp_result = SysUtils.ifthen( SysUtils.success( self.trace_cmp_retcode ), "PASS", SysUtils.ifthen( self.signal_id is None, "FAIL", "INCOMPLETE" ) )
        self.trace_cmp_level = SummaryLevel.Any

        if SysUtils.failed( self.trace_cmp_retcode ):
            self.trace_cmp_level = SummaryLevel.Fail
            Msg.user( "self.trace_cmp_retcode = %s" % ( str( self.trace_cmp_retcode )) )

        Msg.user( "self.trace_cmp_level = %s" % ( str( SummaryLevel.Fail)) )
        return SysUtils.ifthen( SysUtils.success( self.trace_cmp_retcode ), 1 , 0 )
Exemplo n.º 12
0
    def run(self):

        try:
            while (not self.process_queue.fully_loaded) or (
                    self.process_queue.fully_loaded and
                (self.thread_count.value() > 0
                 or self.process_queue.size() > 0)):
                try:
                    # if something tiggered a shutdown then exit the
                    # processing loop and stop processing more items.
                    if self.process_queue.summary.is_terminated():
                        Msg.user("Terminated", "PROCESS-THREAD")
                        break
                    # Pop off the top of the process queue (should block if
                    # the queue is empty)
                    my_queue_item = self.process_queue.dequeue(1)
                    # Launch a thread with the item. Sempahore will block if
                    # we've reached max workers
                    Msg.user("Waiting for Semaphore ....", "PROCESS-THREAD")

                    if my_queue_item.mAppsInfo.mMode == "count":
                        Msg.user(
                            "Counting %s" % my_queue_item.work_dir,
                            "PROCESS-THREAD",
                        )
                        my_queue_item.mAppsInfo.incrementTestCount()
                    else:
                        my_work_thread = ProcessWorkerThread(
                            self.summary,
                            self.semaphore,
                            self.thread_count,
                            my_queue_item,
                            self.process_queue.processor_name,
                            self.process_queue.process_cmd,
                            self.process_queue.use_lsf(),
                        )
                except TimeoutError:
                    pass

                finally:
                    pass

            # need to wait until all worker threads are done before continuing
            while self.thread_count.value() > 0:
                Msg.user(
                    "Thread Count: %d" % (self.thread_count.value()),
                    "PROCESS-THREAD",
                )
                SysUtils.sleep(100)

        finally:
            self.done_event.Signal()
Exemplo n.º 13
0
    def execute(self):
        try:
            cmd = 'make compile -C %s %s' % (self.mMakefilePath, self.mOptions)
            Msg.user('Compile command = ' + str({'compile-cmd':cmd}))

            result = SysUtils.exec_process(cmd, self.log, self.elog, self.ctrl_item.timeout, True)
            Msg.user('Compile result = ' + str(result))

        except:
            print('[CompileExecutor] problem in execute method: ', sys.exc_info()[0])
            raise

        return SysUtils.success(int(result[0]))
Exemplo n.º 14
0
    def heartbeat(self):

        # increment the heartbeat and when debug messages are enabled then a heartbeat message will be
        # posted every self.heartbeat-interval ticks. Whenever the heartbeat method is called the current_tick
        # is updated
        self.current_tick += 1

        if not bool(self.current_tick % self.heartbeat_rate):
            Msg.dbg("HiThread[%s] Still Working" % (self.name))

        # the sleep in SysUtils uses milliseconds as does the rest of the computing world instead of
        # fractions of a second. Thus this will pause this thread for 10 seconds allowing the process
        # thread some processor time
        SysUtils.sleep(self.sleep_period)
        return False
Exemplo n.º 15
0
    def get_plus_args(self):
        rtl_root = self.rtl.get("root")
        meta_args = self.rtl.get(
            "meta_args",
            "tc_mode=force railhouse=on rvbar=80000000 prefetch_drop_int=10 no_commit_cycles=6000"
        )  # by default set railhouse on

        # look for additional meta args if any
        add_meta_args = self.rtl.get("add_meta_args", "")
        if len(add_meta_args) > 0:
            meta_args = ' '.join([meta_args, add_meta_args])

        meta_converter = self.rtl.get("meta_converter")
        convert_cmd = meta_converter + " -r %s -m \"%s\"" % (rtl_root,
                                                             meta_args)
        plus_args, is_valid = SysUtils.get_command_output(convert_cmd)
        Msg.user("Meta args converting command: %s" % convert_cmd, "META-CONV")
        if not is_valid:
            Msg.user("Conversion failed.", "META-CONV")
            raise Exception("Meta conversion failed: %s" % meta_args)
        else:
            Msg.user("Converted to plus args: %s" % plus_args, "META-CONV")

        if self.rtl.get("filter"):
            plus_args = self.filterPlusArgs(plus_args)
            Msg.user("Filtered plus args: %s" % plus_args, "META-CONV")
        return plus_args
Exemplo n.º 16
0
    def locate_directory( self, arg_cmd_switch, arg_envar, arg_default ):

        Msg.dbg( "arg_cmd_switch[%s], arg_envar[%s], arg_default[%s]" % (str(arg_cmd_switch), str(arg_envar), arg_default))
        my_tmp = self.option_def( arg_cmd_switch, None)
        # Msg.user( "Result Path: %s" % ( str( my_tmp )))

        if my_tmp is None:
            if arg_envar is not None:
                # Not passed on the command line check for envar and the default
                my_tmp = SysUtils.envar( arg_envar, arg_default, False )
            else:
                my_tmp = arg_default
            # If a relative path has been provided either in the environmental var or as the default that path needs
            # to be appended to the module path. Since all full paths begin with a path delimiter this is a valid test
            if my_tmp[0] != "/":
                my_tmp = PathUtils.include_trailing_path_delimiter( self.module_dir ) + my_tmp

        # OK here is where it gets a bit tricky, when passed on the command line the path is calculated from the
        # current directory, in all other cases from the module path. Since the app should be in the initial directory
        # calculating the real path should resolve to a fully qualified path. To remove all indirection use real path
        my_tmp = PathUtils.real_path( my_tmp )

        # At this point the path should be a fully qualified path
        # Msg.user( "Result Path: %s" % ( str( my_tmp )))
        #
        Msg.user( "Result Path: %s" % ( str( my_tmp )))
        if not PathUtils.valid_path( my_tmp ):
            raise FileNotFoundError( "Initial Directory for %s Resolution Failed[%s] could not be located" % ( arg_cmd_switch, my_tmp ))

        if not PathUtils.check_exe( my_tmp ):
            my_tmp = PathUtils.include_trailing_path_delimiter( my_tmp )

        return my_tmp
Exemplo n.º 17
0
    def load_config(self, arg_cfg_file):

        # ok there is a config file to load, there are two possibilities,
        # neither require path manipulation
        # 1. the config file is specified as a relative path from the launch
        #       directory
        # 2. the config file is specified as a fully qualified path

        try:
            # load the config file if it exists
            my_content = open(arg_cfg_file).read()

        except Exception as arg_ex:
            Msg.err("Unable to open Config File: %s" % (str(arg_cfg_file)))
            raise

        try:
            my_glb, my_loc = SysUtils.exec_content(my_content)
            self.load_config_data(my_loc)

        except Exception as arg_ex:
            Msg.err("Unable to Process Config File, Message: %s" %
                    (str(arg_ex)))
            raise

        return True
Exemplo n.º 18
0
    def get_scm_data(cls, scm_type, a_path, a_cmd, a_cwd=None):
        """Returns an initialized data structure to hold SCM version data.

        :param str scm_type: 'svn' or 'git'
        :param str a_path: Project base folder
        :param str a_cmd: Command to return scm status detail
        :param str a_cwd:
        :return: dict containing SCM data
        :rtype: dict
        """
        version_info = {
            "scm_type": scm_type,
            "status": False,
            "error_msg": None,
            "folder": a_path,
            "url": "",
        }
        cmd_output, valid = SysUtils.get_command_output(a_cmd, arg_cwd=a_path)

        if not valid:
            version_info["error_msg"] = "Command error: %s" % cmd_output
        elif not cmd_output:
            version_info["error_msg"] = "Revision info not found"

        return version_info, cmd_output
Exemplo n.º 19
0
 def post(self):
     if self.ctrl_item.compile.get('mp'):
         lsu_folder = PathUtils.real_path('%s/../../../rtl/lsu' % self.mMakefilePath)
         cmd = 'svn revert %s/lsu_scb_retire_ctrl.vp %s/lsu_scb_sca_array.vp %s/lsu_scb_scd_array.vp' % (lsu_folder, lsu_folder, lsu_folder)
         Msg.user('MP post-compile command = %s' % cmd)
         result = SysUtils.exec_process(cmd, self.log, self.elog, self.ctrl_item.timeout, True)
         Msg.user('MP post-compile command = %s' % str(result))
Exemplo n.º 20
0
    def rename_elfs(self, arg_suffix):

        # before proceeding it is necessary to remove any existing renamed files to eliminate the possibility of causing
        # a chain and messing up the results
        for my_mask in ["*.ELF", "*.S", "*.img"]:
            my_match_files = PathUtils.list_files(my_mask)
            Msg.lout(my_match_files, "user", "Simulate File List")
            for my_src_file in my_match_files:
                Msg.user(
                    "Match File: %s, Suffix: %s" %
                    (str(my_src_file), str(arg_suffix)), "MATCH")
                if SysUtils.found(
                        my_src_file.find("_%s_force" % (str(arg_suffix)))):
                    PathUtils.remove(my_src_file)
                    continue

        # Now rename all the files that are found
        for my_mask in ["*.ELF", "*.S", "*.img"]:
            my_match_files = PathUtils.list_files(my_mask)
            for my_src_file in my_match_files:
                my_tgt_file = my_src_file.replace(
                    "_force", "_%s_force" % (str(arg_suffix)))
                PathUtils.rename(my_src_file, my_tgt_file)

        # raise Exception("Type %s test case for base test: %s not found." % (arg_extension, arg_test_name))
        return True
    def process_summary(self, sum_level=SummaryLevel.Fail):

        my_file_name = "%sperformance_summary.log" % (
            PathUtils().include_trailing_path_delimiter(self.summary_dir))
        Msg.dbg("Master Log File: %s" % (my_file_name))
        my_utcdt = DateTime.UTCNow()
        my_ofile = None
        try:
            # First try to open file
            with open(my_file_name, "w") as my_ofile:

                my_ofile.write("Date: %s\n" % (DateTime.DateAsStr(my_utcdt)))
                my_ofile.write("Time: %s\n" % (DateTime.TimeAsStr(my_utcdt)))

                self.process_errors(my_ofile)
                my_total_count, my_total_elapsed = self.process_groups(
                    my_ofile)

                Msg.blank("info")
                my_line = "Total Instructions Generated: %3d\n" % (
                    my_total_count)
                my_line += "Total Elapsed Time:  %0.3f\n" % (my_total_elapsed)
                my_line += "Overall Instructions per Second:  %0.3f\n" % (
                    SysUtils.ifthen(bool(my_total_elapsed),
                                    my_total_count / my_total_elapsed, 0))

                Msg.info(my_line)
                my_ofile.write(my_line)

        except Exception as arg_ex:
            Msg.error_trace()
            Msg.err("Error Processing Summary, " + str(arg_ex))

        finally:
            my_ofile.close()
Exemplo n.º 22
0
    def load_process_line(self, arg_line):
        Msg.user("Process Result Line: %s" % (str(arg_line)), "SUM-TUPLE")
        if arg_line[0] == "[":
            return
        my_val = None
        try:
            my_glb, my_loc = SysUtils.exec_content(arg_line, True)
        except (SyntaxError, TypeError) as arg_ex:
            return
        except BaseException:
            raise

        # summary tuples are initialized in the __init__ as are the element
        # indexes the idea is to the tuple list for a match on the key. When
        # one is found the callback proc that is referenced is executed with
        # the line dictionary retrieved and the flags are updated as to what
        # this summary item contains

        for (my_key, my_proc, my_mask) in self.sum_tups:

            my_result = my_loc.get(my_key, None)

            if my_result is None:
                # nothing was returned continue causes the next element to be
                # checked if there is a next element
                continue

            my_proc(my_result)

            self.detail_flags |= int(my_mask)
            break

        return True
Exemplo n.º 23
0
    def load(self, arg_ctrl_item):
        super().load(arg_ctrl_item)

        # Msg.dbg("ForceProcessor::load()")
        my_cmd = self.ctrl_item.generator['path']

        my_cmd += " -t %s" + " --max-instr %d" % self.ctrl_item.max_instr
        my_cmd += " --num-chips %d --num-cores %d --num-threads %d" % (self.ctrl_item.num_chips, self.ctrl_item.num_cores, self.ctrl_item.num_threads)
        my_cmd += SysUtils.ifthen(self.ctrl_item.seed is None , "", (" -s %s" % (self.ctrl_item.seed)))
        # Msg.dbg("my_cmd: %s" %  (str(my_cmd)))

        if isinstance(self.ctrl_item.generator, dict):
            for my_key in self.ctrl_item.generator.keys():
                if my_key not in ['path']:
                    my_cmd += " %s %s " % (str(my_key), SysUtils.ifthen(self.ctrl_item.generator[ my_key ] is None, "", str(self.ctrl_item.generator[ my_key ])))
        self.force_cmd = my_cmd.strip()
Exemplo n.º 24
0
    def execute( self ):

        my_result = None
        test_passed = True

        try:
            self.build_cmd()

            self.copyWavesFsdbDoFile()
            self.outputRerunScript()
            
            # report the command line
            Msg.info( "RTLCommand = " + str( { "rtl-command": self.rtl_cmd } ))

            # execute the simulation
            my_result = SysUtils.exec_process( self.rtl_cmd, self.rtl_log, self.rtl_log, self.ctrl_item.timeout, True )

            Msg.user( "Results: %s" % ( str( my_result )), "RTLEX-RESULT" "")
            my_extract_results = self.extract_results( my_result, "./" + self.rtl_log, None )

            # report the results
            Msg.info( "RTLResult = " + str( my_extract_results ))

        except Exception as arg_ex:
            Msg.error_trace( "RTL Process Failure" )
            Msg.err( "RTL did not properly execute, Reason: %s" % ( str( arg_ex )))
            return False

        finally:
            pass

        #return SysUtils.success( int(my_result[ RtlResult.process_retcode ]) )
        return test_passed
Exemplo n.º 25
0
    def load_process_line(self, arg_line):

        Msg.user("Process Result Line: %s" % (str(arg_line)), "SUM-TUPLE")

        my_val = None
        try:
            my_glb, my_loc = SysUtils.exec_content(arg_line, True)
        except SyntaxError as arg_ex:
            return
        except:
            raise

        # summary tuples are initialized in the __init__ as are the element indexes
        # the idea is to the tuple list for a match on the key. When one is found
        # the callback proc that is referenced is executed with the line dictionary
        # retrieved and the flags are updated as to what this summary item contains

        for (my_key, my_proc, my_mask) in self.sum_tups:

            # Msg.user( "Key: %s, Proc: %s, Mask: %s" % (str( my_key ), str( my_proc is not None ) , (str( my_mask ))), "SUM-TUPLE" )
            my_result = my_loc.get(my_key, None)
            # Msg.user( "Key: %s, Result: %s" % ( str( my_key ), str( my_result )), "SUM-TUPLE" )

            if my_result is None:
                # nothing was returned continue causes the next element to be checked
                # if there is a next element
                continue

            my_proc(my_result)

            self.detail_flags |= int(my_mask)
            break

        return True
Exemplo n.º 26
0
    def load(self):

        # Msg.dbg( "ForrestRun::load" )

        my_frun_path = self.option_def(CmdLine.Switches[CmdLine.control_name],
                                       None)
        if my_frun_path is None:
            raise Exception(
                "F-Run Control File Not Found on the Forrest Run Command Line: Given Path: %s",
                str((my_frun_path)))

        # good to here
        self.locate_frun(my_frun_path)

        Msg.user("File Path: %s" % (my_frun_path))

        my_content = open(self.frun_name).read()
        my_glb, my_loc = SysUtils.exec_content(my_content)
        Msg.dbg(str(my_loc))

        self.fcontrol = my_loc["control_items"]

        my_ctrl_dict = self.fcontrol[0]

        my_ctrl_item = ControlItem()
        my_ctrl_item.load(self._mAppsInfo, my_ctrl_dict)

        # Msg.lout( my_ctrl_dict, "user", "Forrest Parent Data ...." )

        self.check_simulator()

        self.fctrl = ExecuteController(self._mAppsInfo)
        self.fctrl.set_frun(self.frun_name)
        self.fctrl.load(my_ctrl_item)
Exemplo n.º 27
0
    def iss_success(self):

        if SysUtils.success(self.iss_retcode):
            # Check to see for instruction overrun
            if int(self.instr_count) < self.max_instr:
                if int(self.instr_count) >= self.min_instr:
                    return True
        return False
Exemplo n.º 28
0
    def execute(self):
        try:
            cmd = "make compile -C %s %s" % (self.mMakefilePath, self.mOptions)
            Msg.user("Compile command = " + str({"compile-cmd": cmd}))

            result = SysUtils.exec_process(cmd, self.log, self.elog,
                                           self.ctrl_item.timeout, True)
            Msg.user("Compile result = " + str(result))

        except BaseException:
            print(
                "[CompileExecutor] problem in execute method: ",
                sys.exc_info()[0],
            )
            raise

        return SysUtils.success(int(result[0]))
Exemplo n.º 29
0
 def HMS(cls, arg_utcdt=None):
     my_utcdt = SysUtils.ifthen(arg_utcdt is None, datetime.utcnow(),
                                arg_utcdt)
     return "%0.2d%0.2d%0.2d" % (
         my_utcdt.hour,
         my_utcdt.minute,
         my_utcdt.second,
     )
Exemplo n.º 30
0
 def YMD(cls, arg_utcdt=None):
     my_utcdt = SysUtils.ifthen(arg_utcdt is None, datetime.utcnow(),
                                arg_utcdt)
     return "%0.4d%0.2d%0.2d" % (
         my_utcdt.year,
         my_utcdt.month,
         my_utcdt.day,
     )