Пример #1
0
    def locate_frun(self, arg_frun_path):

        Msg.user("Directory set to %s" % (PathUtils.current_dir()))
        # if the control file contains a path then split that into the directory and the file
        my_frun_dir, my_frun_name = PathUtils.split_path(arg_frun_path)
        # always convert to full path
        my_cur_dir = PathUtils.real_path(PathUtils.current_dir())

        # gots to have a source directory as part of the file name
        if my_frun_dir is None:
            my_frun_dir = my_cur_dir

        else:
            # always convert to full path. If the frun was loaded correctly then we can conclude that
            # the path tendered is either a relative path from the starting directory or a full path
            # to that file. If it is not a full path then it will need to be converted to a full path
            # and all links removed
            my_frun_dir = PathUtils.real_path(my_frun_dir)

        # Msg.user( "FRun Dir: %s, FRun Name: %s, Cur Dir: %s" % ( str( my_frun_dir ), str( my_frun_name ), my_cur_dir ), "FRUN-DIR")

        # change into the directory to generate and simulate
        if not PathUtils.chdir(my_frun_dir):
            raise Exception("F-Run Directory[%s] Not Found" %
                            (str(my_frun_dir)))

        self.frun_name = my_frun_name
        self.frun_dir = my_frun_dir
Пример #2
0
 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)
Пример #3
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))
Пример #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
Пример #5
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
Пример #6
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
Пример #7
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
Пример #8
0
    def initialize_processor_cmd( self ):

        # the default task processor is "forrest_run.py"
        # the default directory is the same directory as the master_run
        # the processor can be replaced with a command line argument which may or may not contain a path
        # if it does not contain a path then the default path will be used
        # if a directory is passed on the command line in all cases that will be the location of the processor
        my_run_dir  = None
        my_run_name = None
        my_tmp_name = None
        my_tmp_path = None

        my_run_path = self.option_def( CmdLine.Switches[CmdLine.run_name], None )

        if my_run_path is not None:
            my_run_dir, my_run_name = PathUtils.split_path( my_run_path )
            Msg.user( "Client Dir: %s, Client Name: %s (1)" % (str(my_run_dir), str(my_run_name)), "PROCESS_CMD" )

        if my_run_dir is None:
            my_tmp_path = self.locate_directory( CmdLine.Switches[CmdLine.run_dir], EnVars.run_path, self.module_dir)
            # Msg.user( "Temp Path: [%s] (1)" % (str(my_tmp_path)), "PROCESS_CMD" )

            if PathUtils.check_exe( my_tmp_path ):
                my_run_dir, my_tmp_name = PathUtils.split_path( my_tmp_path )
                # Msg.user( "Client Dir: %s, Client Name: %s (2)" % (str(my_run_dir), str(my_tmp_name)), "PROCESS_CMD" )
            else:
                my_run_dir = my_tmp_path
                # Msg.user( "Client Dir: %s, Client Name: %s (3)" % (str(my_run_dir), str(my_run_name)), "PROCESS_CMD" )

        if my_run_name is None:
            my_run_name = my_tmp_name if my_tmp_name is not None else Defaults.run_name

        # Msg.user( "Client Dir: %s, Client Name: %s (4)" % (str(my_run_dir), str(my_run_name)), "PROCESS_CMD" )
        my_process_cmd = PathUtils.real_path( PathUtils.append_path( PathUtils.include_trailing_path_delimiter( my_run_dir ), my_run_name  ))
        Msg.user( "Process Cmd: %s (1)" % (str(my_process_cmd)), "PROCESS_CMD" )

        my_msg_lev = self.option_def( CmdLine.Switches[CmdLine.client_lev], None)

        if my_msg_lev is not None :
            if my_msg_lev == True:
                my_process_cmd += Msg.get_level_as_str()
                # Msg.user( "Process Cmd: %s (2)" % (str(my_process_cmd)), "PROCESS_CMD" )

            else :
                my_process_cmd += " -l " + my_msg_lev
                Msg.user( "Process Cmd: %s" % (str(my_process_cmd)), "PROCESS_CMD" )

        if self._mAppsInfo.mConfigPath is not None:
            my_process_cmd += " -w %s" % self._mAppsInfo.mConfigPath
        my_process_cmd += " -f %s"

        self.processor_name = my_run_name.replace( ".py", "" ).replace( "_run", "" )
        self.process_cmd = my_process_cmd

        Msg.dbg( "Process Cmd: %s" % (str(self.process_cmd)))
Пример #9
0
 def post(self):
     if self.ctrl_item.compile_rtl.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))
Пример #10
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 = {}
Пример #11
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)
Пример #12
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)
Пример #13
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
Пример #14
0
def convert_meta_args(aConversionParms):
    if aConversionParms.meta_args is None:
        if (aConversionParms.plusargs is not None) and len(
                aConversionParms.cmp_plusargs):
            pass
        else:
            print('Meta args not specified.')
            sys.exit(1)

    meta_args = aConversionParms.meta_args

    if aConversionParms.rtl_root is None:
        rtl_root = os.environ.get("PROJ_ROOT", None)
        if rtl_root is None:
            print('No RTL root defined.')
            sys.exit(1)
    else:
        rtl_root = aConversionParms.rtl_root

    if not PathUtils.check_dir(rtl_root):
        print("RTL root does not exist or is not a directory: %s" % rtl_root)
        sys.exit(1)

    script_dir, script_name = PathUtils.split_path(
        PathUtils.real_path(sys.argv[0]))
    make_file_path = PathUtils.include_trailing_path_delimiter(
        script_dir) + "applications/rtl/MetaArgs.make"
    if not PathUtils.check_file(make_file_path):
        print("File not exist: %s" % make_file_path)
        sys.exit(1)

    #print("meta args %s, rtl root %s, make file: %s" % (meta_args, rtl_root, make_file_path))

    meta_args_conv = MetaArgsConversion(rtl_root, make_file_path)
    if aConversionParms.net:
        conversion_result = meta_args_conv.convertNetResult(meta_args)
    elif len(aConversionParms.cmp_plusargs):
        if (aConversionParms.plusargs
                is not None) and len(aConversionParms.plusargs) > 0:
            conversion_result = meta_args_conv.comparePlusAndPlus(
                aConversionParms.plusargs, aConversionParms.cmp_plusargs)
        else:
            conversion_result = meta_args_conv.compareMetaAndPlus(
                meta_args, aConversionParms.cmp_plusargs)
    else:
        conversion_result = meta_args_conv.convertRawResult(meta_args, True)
    print(conversion_result)
Пример #15
0
    def __init__(self, aCmdLineOptions):
        super().__init__(ForceCmdLineOptions.cOptions, aCmdLineOptions)

        force_path = self.mAppParameters.parameter("path")
        force_bin_dir, _ = PathUtils.split_path(force_path)
        force_dir = PathUtils.real_path(
            PathUtils.include_trailing_path_delimiter(force_bin_dir) + "../"
        )

        if not PathUtils.check_exe(force_path):
            raise Exception(force_path + " does not exist or is not executable, confirm valid exe")

        # determine svn revision information and store as a parameter
        version_data = VersionCtrlUtils.get_scm_revisions(force_dir)
        version_output = VersionCtrlUtils.get_version_output(version_data)

        Msg.info("Force Version Data:\n%s" % version_output)

        self.mAppParameters.setParameter("version", version_data)
        self.mAppParameters.setParameter("version_dir", force_dir)
Пример #16
0
    def __init__(self, arg_force_path, arg_switches, arg_opts, arg_msg_lev,
                 arg_def_lev, arg_short_lev):

        # print( "Force Path: %s"      % (str(arg_force_path )))
        # print( "Module Switches: %s" % (str(arg_switches   )))
        # print( "Options: %s"         % (str(arg_opts       )))
        # print( "Message Level: %s"   % (str(arg_msg_lev    )))
        # print( "Default Level: %s"   % (str(arg_def_lev    )))
        # print( "Short Level: %s"     % (str(arg_short_lev  )))

        # extract the arguments and the parameters
        self.opts, self.args = getopt.getopt(sys.argv[1:], arg_opts,
                                             arg_switches)
        self.module_dir, self.module_name = PathUtils.split_path(
            PathUtils.real_path(sys.argv[0]))

        # set the message level
        self.load_message_levels(arg_msg_lev, arg_def_lev, arg_short_lev)

        # save the force path
        self.force_path = arg_force_path
Пример #17
0
    def checkNestedPath(aClass, aPathList):
        #validate the input
        if type(aPathList) != list:
            raise Exception(
                "Input to FileLocator.checkNestedPath must be a list")
        if len(aPathList) < 2:
            raise Exception(
                "Input to FileLocator.checkNesterPath needs to be a list more than 1 item long"
            )

        joined_path = str(aPathList[0])

        for path in aPathList[1:]:
            joined_path = PathUtils.real_path(
                PathUtils.append_path(joined_path, path))

        #validate the joined path
        if not PathUtils.check_found(joined_path):
            return joined_path, False
        else:
            return joined_path, True
Пример #18
0
    def __init__(self, aCmdLineOptions):
        super().__init__(ForceCmdLineOptions.cOptions, aCmdLineOptions)

        force_path = self.mAppParameters.parameter('path')
        force_bin_dir, _ = PathUtils.split_path(force_path)
        force_dir = PathUtils.real_path(
            PathUtils.include_trailing_path_delimiter(force_bin_dir) + '../')

        if not PathUtils.check_exe(force_path):
            raise Exception(
                force_path +
                " does not exist or is not executable, confirm valid exe")

        #determine svn revision information and store as a parameter
        version_info = VersionCtrlUtils.get_svn_revision(force_dir)
        if version_info[1] is not None:
            Msg.info("Failed to determine Force svn version: " +
                     version_info[1])
            self.mAppParameters.setParameter("version", -1)
        else:
            self.mAppParameters.setParameter("version", version_info[0])
        self.mAppParameters.setParameter("version_dir", force_dir)
Пример #19
0
    def report(self, aAppsInfo, aMyTag):

        mr_info = aAppsInfo.mTagToReportInfo.get("master_run", None)
        if mr_info:
            self.mTotalCycleCount = mr_info.get("total_cycle_count", None)
            self.mTotalInstructionCount = mr_info.get("total_instruction_count", None)
            self.mReportBaseName = mr_info.get("initial_control_file", None)
            self.mRegressionOutputDirectory = mr_info.get("output_dir", None)

        force_info = aAppsInfo.mTagToReportInfo.get("generator", None)
        if force_info: #force info was in the report info dictionary
            self.mForceSvnVersion = force_info.get("version", None)
        else: #force info was obtainable from the config object
            force_info = aAppsInfo.mTagToApp.get('generator')
            self.mForceSvnVersion = force_info.parameter('version')

        rtl_config = aAppsInfo.mTagToApp.get('rtl', None)
        if rtl_config:
            self.mRtlWasEnabled = rtl_config.parameter('rtl')
        
            #If the rtl app was active, check if the user disabled reporting
            if self.mRtlWasEnabled:
                self.mReportingWasSkipped = rtl_config.parameter('rtl.report.skip')

                #If reporting was enabled, continue to resolve information
                if not self.mReportingWasSkipped:
                    self.mReportDumpXml = rtl_config.parameter('rtl.report.xml')
                    rtl_report_name = rtl_config.parameter('rtl.report.name')

                    if rtl_report_name == "master_run" and self.mReportBaseName:
                        rtl_report_name = self.mReportBaseName.strip(".py")

                    time_stamp = datetime.utcnow()
                    time_string = "_%0.4d%0.2d%0.2d_%0.2d%0.2d" % (time_stamp.year, time_stamp.month, time_stamp.day, time_stamp.hour, time_stamp.minute)

                    revision_stamp = ""
                    if self.mForceSvnVersion:
                        revision_stamp = "_r" + str(self.mForceSvnVersion)

                    rtl_report_name = rtl_report_name + time_string + revision_stamp

                    rtl_control_data = {}
                    rtl_config.processControlData(rtl_control_data)
                    report_script_path = rtl_control_data.get('report_script_path', None)
                    report_script_path = PathUtils.real_path(aAppsInfo.mMainAppPath + "/" + report_script_path)
                    report_directory = PathUtils.real_path(self.mRegressionOutputDirectory + "/../../")

                    #What about the report path?  We get that from the master_run output_dir
                    report_command = report_script_path + " --report-dir " + report_directory + " --name " + rtl_report_name
                    if self.mReportDumpXml:
                        report_command += " --dump-xml"

                    Msg.dbg("Main app path: " + str(aAppsInfo.mMainAppPath))
                    Msg.dbg("Report script path: " + str(report_script_path))
                    Msg.dbg("Report directory: " + str(report_directory))
                    Msg.dbg("Reporting command: " + str(report_command))
        
                    #actually execute the report script
                    report.callFromPython(report_command)

                    #create or append metrics file
                    rtl_metrics_path = rtl_control_data.get('rtl_metrics_path', None)
                    home = os.path.expanduser('~')
                    rtl_metrics_path = rtl_metrics_path.replace('~', home) 

                    if not os.path.isfile(rtl_metrics_path):
                        with open(rtl_metrics_path, 'w+') as outfile:
                            outfile.write("||---------------------------------------------|--------------------|--------------------||\n")
                            outfile.write("||                                   Regression|        Total Cycles|  Total Instructions||\n")
                            outfile.write("||---------------------------------------------|--------------------|--------------------||\n")

                    with open(rtl_metrics_path, 'a') as outfile:
                        outfile.write("||")
                        for space in range(45 - len(rtl_report_name)):
                            outfile.write(" ")
                        outfile.write(rtl_report_name + "|")
                        for space in range(20 - len(str(self.mTotalCycleCount))):
                            outfile.write(" ")
                        outfile.write(str(self.mTotalCycleCount) + "|" )
                        for space in range(20 - len(str(self.mTotalInstructionCount))):
                            outfile.write(" ")
                        outfile.write(str(self.mTotalInstructionCount) + "||\n")                                                 
Пример #20
0
    def report(self, a_apps_info, a_my_tag):

        if not self.setup_report(a_apps_info):
            return

        time_stamp = datetime.utcnow()
        time_string = "_%0.4d%0.2d%0.2d_%0.2d%0.2d" % (
            time_stamp.year,
            time_stamp.month,
            time_stamp.day,
            time_stamp.hour,
            time_stamp.minute,
        )

        version = ""
        revision_stamp = ""

        for item in self.m_force_scm_version:
            if item.get("status", False):
                version = item["version"]
                # prefer git data, otherwise keep looking for
                # valid version
                if item["scm_type"] == "git":
                    break
        if version:
            revision_stamp = "_r" + str(version)

        rtl_report_name = self.rtl_report_name + time_string + revision_stamp

        rtl_control_data = {}
        self.rtl_config.processControlData(rtl_control_data)
        report_script_path = rtl_control_data.get("report_script_path", None)
        report_script_path = PathUtils.real_path(a_apps_info.mMainAppPath +
                                                 "/" + report_script_path)
        report_directory = PathUtils.real_path(
            self.m_regression_output_directory + "/../../")

        # What about the report path?  We get that from the
        # master_run output_dir
        report_command = (report_script_path + " --report-dir " +
                          report_directory + " --name " + rtl_report_name)
        if self.m_report_dump_xml:
            report_command += " --dump-xml"

        Msg.dbg("Main app path: " + str(a_apps_info.mMainAppPath))
        Msg.dbg("Report script path: " + str(report_script_path))
        Msg.dbg("Report directory: " + str(report_directory))
        Msg.dbg("Reporting command: " + str(report_command))

        # actually execute the report script
        report.call_from_python(report_command)

        # create or append metrics file
        rtl_metrics_path = rtl_control_data.get("rtl_metrics_path", None)
        home = os.path.expanduser("~")
        rtl_metrics_path = rtl_metrics_path.replace("~", home)

        if not os.path.isfile(rtl_metrics_path):
            with open(rtl_metrics_path, "w+") as outfile:
                outfile.write("||------------------------------------------"
                              "---|--------------------|-------------------"
                              "-||\n")
                outfile.write("||                                   "
                              "Regression|        Total Cycles|  Total "
                              "Instructions||\n")
                outfile.write("||-------------------------------------------"
                              "--|--------------------|-------------------"
                              "-||\n")

        with open(rtl_metrics_path, "a") as outfile:
            outfile.write("||")
            for _ in range(45 - len(rtl_report_name)):
                outfile.write(" ")
            outfile.write(rtl_report_name + "|")
            for _ in range(20 - len(str(self.m_total_cycle_count))):
                outfile.write(" ")
            outfile.write(str(self.m_total_cycle_count) + "|")
            for _ in range(20 - len(str(self.m_total_instruction_count))):
                outfile.write(" ")
            outfile.write(str(self.m_total_instruction_count) + "||\n")
Пример #21
0
# Make third-party modules available for import
import sys
import traceback

import common.cmdline_utils as CmdLineUtils
from classes.ApplicationsSetup import ApplicationsSetup
from classes.control_item import ControlItem
from classes.exec_controller import ExecuteController
from classes.module_run import ModuleRun
from common.msg_utils import Msg
from common.path_utils import PathUtils
from common.sys_utils import SysUtils
from force_init import the_force_root
from forrest_init import CmdLine, Defaults, CommandLineParameters

sys.path.append(PathUtils.real_path("../../3rd_party/py"))


class ForrestRun(ModuleRun):
    def __init__(self):
        super().__init__(CmdLine.Switches[CmdLine.msg_lev], Defaults.msg_level)

        self.frun_name = None
        self.frun_dir = None
        self.fctrl = None

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

        self.fcontrol = None