Exemple #1
0
    def locate_control_file(self):
        # populate the initial control file, if none is specified then use
        # the default
        my_fctrl_path = self.option_def(CmdLine.Switches[CmdLine.control_name],
                                        CtrlItmDefs.fctrl_name)
        Msg.user("Control Path: %s (1)" % (str(my_fctrl_path)), "INITIAL_DIRS")

        # if the control file contains a path then split that into the
        # directory and the file
        my_fctrl_dir, my_fctrl_file = PathUtils.split_path(my_fctrl_path)
        Msg.user(
            "Control File Split, Directory: %s, FileName: %s" %
            (str(my_fctrl_dir), str(my_fctrl_file)),
            "INITIAL_DIRS",
        )

        # important to realize that if the default control file is used, it is
        # necessary to find the right file
        if my_fctrl_dir is None:
            # if the control file does not contain a path then need to assume
            # the default path of
            my_fctrl_dir = self.locate_directory(
                CmdLine.Switches[CmdLine.control_dir],
                EnVars.test_base,
                Defaults.test_base,
            )
        else:
            my_fctrl_dir = PathUtils.include_trailing_path_delimiter(
                PathUtils.real_path(my_fctrl_dir))

        return my_fctrl_dir, my_fctrl_file
Exemple #2
0
def test_summary(aParameters):
    forrest_log = aParameters.forrest_log
    msg_level = aParameters.msg_lev
    if msg_level is not None:
        Msg.set_level(Msg.translate_levelstr(msg_level))

    print("Forrest log file is: %s" % forrest_log)

    work_dir, my_tmp = PathUtils.split_path(forrest_log)
    frun_path = PathUtils.append_path(
        PathUtils.include_trailing_path_delimiter(work_dir), "_def_frun.py")

    # test - timeout
    summary_queue_args = {
        "frun-path":
        frun_path,
        "process-log":
        forrest_log,
        "process-result": (
            0,
            None,
            "Process Timeout Occurred",
            1555792446.313606,
            1555792446.313606,
            SysUtils.PROCESS_TIMEOUT,
        ),
    }
    summary_queue_item = SummaryQueueItem(summary_queue_args)
    summary_item = SummaryItem({})
    summary_item.load(summary_queue_item)
Exemple #3
0
    def resolveFileLocation(aClass, aInputString, aPrefixDirectoryList):
        # validate the input
        if not isinstance(aPrefixDirectoryList, list):
            raise Exception(
                "Parameter aPrefixDirectoryList needs to be a list of strings"
            )

        # is the input string itself a usable absolute path?
        if aInputString.startswith("/") and PathUtils.check_found(
            aInputString
        ):
            return aInputString, True

        # is the input string a relative path meaningful with one of the
        # prefix directories prepended?
        intermed_dir, file_name = PathUtils.split_path(aInputString)
        for directory in aPrefixDirectoryList:
            joined_path, outcome = (
                FileLocator.checkNestedPath(
                    [directory, intermed_dir, file_name]
                )
                if intermed_dir is not None
                else FileLocator.checkNestedPath([directory, file_name])
            )
            if outcome:
                return joined_path, True

        # the input string does not form an existing filepath
        return aInputString, False
Exemple #4
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
Exemple #5
0
    def clean_up(self):

        clean_up_rules = self.summary.cleanUpRules
        if self.passed and not clean_up_rules.shouldKeepAll():
            # list all the files and delete them except for _def_frun.py and
            # the processor log (forrest.log)

            my_dir = PathUtils.include_trailing_path_delimiter(self.work_dir)
            Msg.user("Dir: %s" % (str(my_dir)), "FILES-TO-REMOVE")
            my_file_path = str(my_dir) + "*"
            Msg.user("Path: %s" % (my_file_path), "FILES-TO-REMOVE")

            my_file_list = PathUtils.list_files(my_file_path)
            Msg.user("Files: %s" % (str(my_file_list)), "FILES-TO-REMOVE")

            process_log_base = PathUtils.base_name(self.process_log)
            clean_up_rules.setBaseNamesToKeep(
                ["_def_frun.py", "PASS", process_log_base])

            for my_file in my_file_list:
                if clean_up_rules.shouldKeepFile(my_file):
                    Msg.user("File: %s KEPT" % clean_up_rules.lastBaseName())
                else:
                    Msg.user("File: %s REMOVED" %
                             clean_up_rules.lastBaseName())
                    PathUtils.remove(my_file)
Exemple #6
0
    def __init__(self, arg_CommandLineParameters, aSysArgv):

        self.mProgramPath, self.mProgramName = PathUtils.split_path(
            PathUtils.real_path(aSysArgv[0])
        )
        self.CommandLineParameters = arg_CommandLineParameters
        self.cmd_line_parser = None
        self.ap_args = None
        self.ap_unknown = None
        self.ap_opts = AttributeContainer()

        self.cmd_line_parser = CmdLineParser(
            self.CommandLineParameters,
            self.CommandLineParameters.group_names,
            self.CommandLineParameters.group_descriptions,
            self.CommandLineParameters.group_parameters,
            add_help=True,
        )
        self.ap_args, self.ap_unknown = self.cmd_line_parser.parse_known_args(aSysArgv[1:])
        self.cmd_line_parser.set_parameters(self.ap_opts)
        try:
            if len(self.ap_unknown) > 0:
                raise Exception(
                    "Only Command Options are allowed: ["
                    + os.path.realpath(aSysArgv[0])
                    + "]\n       Found Argument(s): "
                    + str(self.get_unknown_arguments())
                )
        except Exception as e:
            print(str(e))
            sys.exit(40)  # 40 was the code originally used for getopt errors
Exemple #7
0
    def process_task(self, arg_task_file, aTaskDir):
        try:
            # get the subdirectory index
            my_ndx = self.mAppsInfo.getNextIndex(aTaskDir)

            # form sub task directory
            sub_task_dir = PathUtils.append_path(
                PathUtils.include_trailing_path_delimiter(aTaskDir),
                "%05d" % my_ndx)

            # save the task template file name with path to the control item
            self.ctrl_item.fname = arg_task_file
            # prepare control item content, TODO don't really need it.
            my_content = self.ctrl_item.prepare(self.mAppsInfo, arg_task_file)
            my_queue_item = ProcessQueueItem(sub_task_dir, self.ctrl_item,
                                             self.mAppsInfo, my_content)
            self.mProcessQueue.enqueue(my_queue_item)

        except Exception as arg_ex:
            Msg.error_trace()
            Msg.err(str(arg_ex))
            # reraise to prevent adding to summary instance
            raise

        finally:
            pass
Exemple #8
0
    def process_task_file(self, arg_task_file, aParentDir):
        try:
            # NOTE: a task file can be but is not limited to being an test template file
            # set base task directory and extract the task id and update directory
            my_task_name = PathUtils.base_name(arg_task_file)
            my_task_dir = my_task_name.replace(".py", "")

            # Msg.info("suffix: %s" % ( str( self.ctrl_item.suffix )))
            if self.ctrl_item.suffix is not None:
                my_task_dir = my_task_dir.replace(
                    "_force", "_%s_force" % (str(self.ctrl_item.suffix)))

            full_task_dir = PathUtils.append_path(
                PathUtils.include_trailing_path_delimiter(aParentDir),
                my_task_dir)

            # Msg.dbg( "Changed to Base Dir, my_task_name(%s), my_task_dir(%s)" % (my_task_name, my_task_dir))

            # check for exiting sub-directories, and extract the task iteration count to prevent
            # unintended modifications to the original passed on the commafrom common.path_utils import PathUtilsnd line for this task or
            # acquired from a control file item

            self.process_task(arg_task_file, full_task_dir)

        finally:
            pass
Exemple #9
0
    def resolve_file_location(self, aAppsInfo, aParentPath):

        control_file_name = self.fctrl_name
        control_dir = self.fctrl_dir

        if control_file_name.startswith("$/"):
            control_file_name = control_file_name.replace("$/", aAppsInfo.mTestBaseDir)

        the_dir, the_filename = PathUtils.split_path(control_file_name)

        if the_dir is None:
            control_file_name = control_dir + "/" + the_filename

        prefix_list = [
            aParentPath,
            aAppsInfo.mTestBaseDir,
            aAppsInfo.mToolPath,
            aAppsInfo.mMainAppPath,
        ]
        control_file_path, path_valid = FileLocator.resolveFileLocation(
            control_file_name, prefix_list
        )

        control_dir, control_file_name = PathUtils.split_path(control_file_path)
        control_dir = PathUtils.include_trailing_path_delimiter(control_dir)

        if not path_valid:
            raise Exception(
                "File [%s] Not Found at Locations Specified %s"
                % (control_file_name, str(prefix_list))
            )

        self.fctrl_name = control_file_name
        self.fctrl_dir = control_dir
        self.item_path = control_file_path
 def __init__(self, arg_msg_lev, arg_def_lev):
     self.m_app_setup = None
     self.m_app_info = None
     self.module_dir, self.module_name = PathUtils.split_path(
         PathUtils.real_path(sys.argv[0]))
     self.init_app_setup()
     self.load_message_levels(arg_msg_lev, arg_def_lev)
Exemple #11
0
    def load(self, arg_ctrl_item):
        super().load(arg_ctrl_item)
        # Msg.dbg( "TaskController::load()")

        self.task_list = PathUtils.list_files(
            PathUtils.append_path(self.ctrl_item.fctrl_dir,
                                  self.ctrl_item.fctrl_name))
        return True
Exemple #12
0
    def __init__(self):
        try:
            self.mCmdLineParms = CommandLineParameters
            self.mConfigArgs = retrieveConfigArgument(sys.argv[1:])
            self.mAppsSetup = ApplicationsSetup(self.mCmdLineParms, sys.argv, self.mConfigArgs, True, True)
            self._mAppsInfo = self.mAppsSetup.getApplicationsInfo()
        except SystemExit as aSysExit:
            sys.exit(int(str(aSysExit)))
        except:
            print("[ERROR] - An Unhandled Error has Occurred during applications setup of " + str(sys.argv[0]))
            traceback.print_exc(file=sys.stdout)
            sys.exit(44)

        self.module_dir, self.module_name = PathUtils.split_path(PathUtils.real_path(sys.argv[0]))
        # self._mAppsInfo = apps_info
        self.load_message_levels(CmdLine.Switches[CmdLine.msg_lev], Defaults.msg_level)

        #print( "Got here (2.1)" )

        # persistent values
        self._mAppsInfo.mMainAppPath = PathUtils.include_trailing_path_delimiter(self.module_dir) + "../.." # TODO still keep main app path for now.
        self._mAppsInfo.mProcessMax = self.option_def( CmdLine.Switches[CmdLine.process_max], None, self.to_int )
        self._mAppsInfo.mTestBaseDir = None
        self._mAppsInfo.mToolPath = self.module_dir
        self.fctrl_dir = None
        self.mode = None
        self.summary = None
        self.process_queue = None
        self.client_lev = False
        self.default_root = ""

        self.ctrl_item = ControlItem()

        # no propogate values
        self.num_runs = None
        self.sum_level = None

        self.item_data = {}
        self.options = {}

        self.max_fails = 0
        self.limit_fails = False
        self.crit_sec = HiCriticalSection()
        self.processor_name = None
        self.fctrl = None

        self.terminated = False

        # this is a proc that will decrement the fails counter until it is 0
        # if the proc is None then this will not occur
        self.on_fail_proc = None
        self.is_term_proc = None

        # if an external terminate event is captured then this call back will shutdown
        # master run and all associated threads gracefully
        global shutdown_proc
        shutdown_proc = self.trigger_shutdown
def main():
    signal.signal(signal.SIGINT, sig_interrupt_handler)
    my_pwd = None

    print(
        "\n=======================================\n\tInitializing ....\n=======================================\n"
    )
    try:
        my_module = MasterRun()

        # save current working directory
        my_pwd = PathUtils.current_dir()

        Msg.dbg("Original Directory: " + my_pwd)
        Msg.dbg("Processing Command Line and Loading Control File")
        my_module.load()

        if not PathUtils.chdir(my_module.output_dir, True):
            Msg.dbg("Unable to change into: " + my_module.output_dir +
                    ", using the current directory for output")

        Msg.info("\nConcurrent Operations: %s" %
                 (str(my_module.m_app_info.mProcessMax)))
        my_module.run()

        Msg.info("Test Completed ....\n")

    except FileNotFoundError as arg_ex:
        # Msg.error_trace("[ERROR] -  " + str(arg_ex) )
        Msg.err(str(arg_ex))
        Msg.blank()

    except LoadError as arg_ex:
        # Msg.error_trace("[ERROR] -  " + str(arg_ex) )
        Msg.err(str(arg_ex))
        Msg.blank()

    except Exception as arg_ex:

        from force_init import force_usage

        Msg.err("[ERROR] - An Unhandled Error has Occurred during run of " +
                str(sys.argv[0]))
        traceback.print_exc(file=sys.stdout)

    except:
        # traceback.print_exc( file=sys.stdout )
        # print( "An Unhandled Exception Occurred ..." )
        pass

    finally:
        # TODO
        # change back to original directory

        if my_pwd is not None:
            # Msg.dbg( "Restoring Original Directory: " + my_pwd )
            PathUtils.chdir(my_pwd)
Exemple #14
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]))
Exemple #15
0
    def load_task_info(self):

        self.task_id = None
        self.task_index = None
        self.work_dir, my_tmp = PathUtils.split_path(self.frun_path)
        my_tmp, my_index = PathUtils.split_dir(self.work_dir)
        my_tmp, self.task_id = PathUtils.split_dir(my_tmp)
        self.task_index = int(my_index)
        self.task_path = PathUtils.include_trailing_path_delimiter(
            str(self.work_dir))
Exemple #16
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)
    def __init__( self, aWorkDir, arg_ctrl_item, aAppsInfo, arg_content  ):
        super().__init__()
        self.work_dir = aWorkDir
        self.frun_path = PathUtils.append_path(PathUtils.include_trailing_path_delimiter(self.work_dir), "_def_frun.py")
        
        self.ctrl_item = arg_ctrl_item
        self.mAppsInfo = aAppsInfo

        self.parent_fctrl = arg_ctrl_item.parent_fctrl
        self.fctrl_item   = arg_ctrl_item.fctrl_item
        self.item_group   = arg_ctrl_item.group
        self.content      = arg_content
Exemple #18
0
 def initialize_task(self):
     # Msg.user( "ExecuteController::initialize_task(1)" )
     my_task_file = PathUtils.append_path(self.ctrl_item.fctrl_dir,
                                          self.ctrl_item.fctrl_name)
     # Msg.user( "ExecuteController::initialize_task(2)" )
     my_tmp, my_task_ndx = PathUtils.split_path(self.ctrl_item.fctrl_dir)
     # Msg.user( "ExecuteController::initialize_task(3)" )
     my_task_name = self.ctrl_item.fctrl_name.replace(".py", "")
     # Msg.user( "ExecuteController::initialize_task(5)" )
     Msg.user("Task File: %s, Task Name: %s, Task Index: %s" %
              (my_task_file, my_task_name, my_task_ndx))
     return (my_task_file, my_task_name, my_task_ndx)
Exemple #19
0
    def __init__(self, aAppsInfo):
        self.module_dir, self.module_name = PathUtils.split_path(
            PathUtils.real_path(sys.argv[0]))
        self._mAppsInfo = aAppsInfo
        self.load_message_levels(CmdLine.Switches[CmdLine.msg_lev],
                                 Defaults.msg_level)

        self.frun_name = None
        self.frun_dir = None

        self.item_data = {}
        self.options = {}
Exemple #20
0
    def __init__(self, arg_msg_lev, arg_def_lev, aAppsInfo):

        # print( "Message Level: %s"   % (str(arg_msg_lev    )))
        # print( "Default Level: %s"   % (str(arg_def_lev    )))

        # extract the module dir and name
        self.module_dir, self.module_name = PathUtils.split_path(
            PathUtils.real_path(sys.argv[0]))

        self._mAppsInfo = aAppsInfo

        # set the message level
        self.load_message_levels(arg_msg_lev, arg_def_lev)
Exemple #21
0
    def _optPathChecks(self, aValue, aProgramPath):
        opt_value = aValue

        if (len(opt_value) > 0) and (opt_value[0] != "/"):
            opt_value = PathUtils.include_trailing_path_delimiter(aProgramPath) + opt_value
        opt_value = PathUtils.real_path(opt_value)

        if not PathUtils.valid_path(opt_value):
            raise FileNotFoundError("Path resolution for [%s] failed, [%s] could not be located" % (self._optionString(), opt_value))

        if PathUtils.check_dir(opt_value):
            opt_value = PathUtils.include_trailing_path_delimiter(opt_value)

        return opt_value
Exemple #22
0
    def __init__(self, aCmdLineOptions):
        super().__init__(FrunToCtrlCmdLineOptions.cOptions, aCmdLineOptions)

        if self.mAppParameters.parameter('frun-to-ctrl'):
            frun_to_ctrl_path = PathUtils.include_trailing_path_delimiter(
                aCmdLineOptions.mProgramPath
            ) + "../frun_to_ctrl/frun_to_ctrl.py"

            if not PathUtils.check_exe(frun_to_ctrl_path):
                raise Exception(
                    frun_to_ctrl_path +
                    " does not exist or is not executable, confirm valid exe")
            frun_to_ctrl_path = PathUtils.real_path(frun_to_ctrl_path)
            self.mAppParameters.setParameter('path', frun_to_ctrl_path)
Exemple #23
0
 def build(self):
     """build the command line launcher with initial values"""
     my_cmd = self.process_cmd % (self.frun_path)
     Msg.user("Process Command: %s" % (str(my_cmd)), "LAUNCHER")
     my_log = (PathUtils.include_trailing_path_delimiter(self.frun_dir) +
               self.process_log)
     return my_cmd, my_log
    def process_summary(self, arg_sum_level=SummaryLevel.Fail):

        # Msg.user( "process_summary()", "REG-SUMMARY" )
        my_utcdt = DateTime.UTCNow()
        my_file_name = "%sregression_summary.log" % (
            PathUtils().include_trailing_path_delimiter(self.summary_dir)
        )
        # Msg.user( "Master Log File: %s" % ( my_file_name ))
        my_ofile = None
        myLines = []
        # First try to open file
        with open(my_file_name, "w") as my_ofile:
            try:
                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_instr_count, my_cycle_count = self.process_summary_tasks(
                    my_ofile, arg_sum_level
                )
                self.process_summary_totals(my_ofile, my_instr_count, my_cycle_count)

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

            finally:
                my_ofile.close()
Exemple #25
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]))
    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()
Exemple #27
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))
Exemple #28
0
    def convertRawResult(self, aMetaArgs, aFilter=False):
        current_dir = PathUtils.current_dir()
        PathUtils.chdir(self._mTopSimPath)
        result, is_valid = SysUtils.get_command_output(self._mMakeCommand + aMetaArgs)
        PathUtils.chdir(current_dir)

        if not is_valid:
            print("Converting meta args: %s to raw result failed." % aMetaArgs)
            sys.exit(1)

        if aFilter:
            args_list = result.split(" ")
            args_list = self.filterList(args_list)
            result = " ".join(args_list)

        return result
Exemple #29
0
def retrieve_config_argument(aArguments):
    config_argument = CmdLineUtils.basic_command_line_argument_retrieval(
        aArguments, "-c", "--config", str, 1)

    # PathUtils.resolvePath() - retrieve the entire file path from a string
    return (PathUtils.resolvePath(config_argument.config[0])
            if config_argument.config is not None else None)
Exemple #30
0
 def __init__(self, aRtlRoot, aMakefile):
     self._mRtlRoot = aRtlRoot
     self._mMakefile = aMakefile
     self._mBaseResultSet = None  # Raw result produced with an empty meta args string
     self._mMakeCommand = 'make -f %s output_run_opts ' % self._mMakefile
     self._mTopSimPath = PathUtils.include_trailing_path_delimiter(
         self._mRtlRoot) + "verif/top/sim"