コード例 #1
0
ファイル: summary.py プロジェクト: mfkiwl/force-riscv
    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
コード例 #2
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)
コード例 #3
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
コード例 #4
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
コード例 #5
0
    def load(self, arg_ctrl_item):
        super().load(arg_ctrl_item)
        # Msg.user( "FileController::load(1)" )

        self.parent_fctrl = self.ctrl_item.file_path()
        # Msg.user( "FileController::load(2)" )
        Msg.user("File Path: %s" % (self.parent_fctrl), "FCTRL-LOADER")

        try:
            my_content = open(self.parent_fctrl).read()

            # Msg.user( "FileController::load(3)" )
        except Exception as arg_ex:
            # Msg.user( "FileController::load(4)" )
            Msg.err("Message: %s, Control File Path: %s" %
                    (str(arg_ex), self.parent_fctrl))
            my_err_queue_item = SummaryErrorQueueItem({
                "error":
                arg_ex,
                "message":
                "Control File Not Found ...",
                "path":
                self.ctrl_item.file_path(),
                "type":
                str(type(arg_ex))
            })

            ## Msg.user( "FileController::load(5)" )
            if self.mProcessQueue.summary is not None:
                self.mProcessQueue.summary.queue.enqueue(my_err_queue_item)
            return False
        finally:
            # Msg.user( "FileController::load(6)" )
            pass

        try:
            # Msg.user( "FileController::load(7)" )
            my_glb, my_loc = SysUtils.exec_content(my_content, False,
                                                   self.mControlFileLocals)
            # Msg.user( "FileController::load(8)" )

        except Exception as arg_ex:
            # Msg.user( "FileController::load(9)" )
            my_exc_type, my_exc_val, my_exc_tb = sys.exc_info()
            my_ex = arg_ex

            Msg.err("Message: %s, Control File Path: %s" %
                    (str(arg_ex), self.parent_fctrl))
            Msg.blank()

            ## Msg.user( "FileController::load(10)" )
            my_err_queue_item = SummaryErrorQueueItem({
                "error":
                arg_ex,
                "message":
                "Control File not processed...",
                "path":
                self.ctrl_item.file_path(),
                "type":
                str(my_exc_type)
            })

            if self.mProcessQueue.summary is not None:
                self.mProcessQueue.summary.queue.enqueue(my_err_queue_item)
            return False

        finally:
            # Msg.user( "FileController::load(12)" )
            pass

        self.fcontrol = my_loc["control_items"]

        #propagate local variables
        for key in my_loc.keys():
            self.mControlFileLocals.update({key: my_loc[key]})

        # Msg.user( "FileController::load(13)" )
        return True