예제 #1
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
예제 #2
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
예제 #3
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)
예제 #4
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
예제 #5
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"
예제 #6
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 setupWorkDir( self ):
     work_dir = self.queue_item.work_dir
     PathUtils.mkdir( work_dir )
     # write out the control file
     PathUtils.touch( "%sSTARTED" % PathUtils.include_trailing_path_delimiter( work_dir ))
     if not PathUtils.write_file( self.queue_item.frun_path, self.queue_item.content, "Frun Control" ):
         raise Exception("Failed to write frun file: %s" % self.queue_item.frun_path)
예제 #8
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
예제 #9
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
예제 #10
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)
예제 #11
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
예제 #12
0
    def build(self):

        # First get the raw process command
        my_process_cmd, my_process_log = super().build()

        # check to see if operating in the red zone
        if self.red_zone:
            # Red Zone with LSF Enabled requires some extra work
            my_lsf_log = (
                PathUtils.include_trailing_path_delimiter(self.frun_dir)
                + self.lsf_log
            )
            Msg.user("lsf.log: %s" % (my_lsf_log))

            # first build the bsub command line
            my_bsub = "bsub -K"

            # Apply SLA if applicable
            if len(self.sla):
                my_bsub += " -sla %s" % self.sla

            my_bsub += ' -q %s -G %s -C %d -o %%s "%%s"' % (
                self.queue,
                self.group,
                self.core_file_size,
            )

            Msg.user("BSub Command Line: %s" % (str(my_bsub)), "LSF-LAUNCHER")

            # append the processor log file as path of the processor command
            my_cmd = "%s --logfile %s" % (my_process_cmd, my_process_log)

            my_process_cmd = my_bsub % (my_lsf_log, my_cmd)
            self.process_log = my_process_log
            my_process_log = (
                PathUtils.include_trailing_path_delimiter(self.frun_dir)
                + self.shell_log
            )

        Msg.user("Process Log: %s" % (str(my_process_log)), "LSF-LAUNCHER")
        Msg.user(
            "Process Command Line: %s" % (str(my_process_cmd)), "LSF-LAUNCHER"
        )

        return my_process_cmd, my_process_log
예제 #13
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
예제 #14
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))
예제 #15
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)))
    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
예제 #17
0
 def init_app_setup(self):
     if not self.m_app_setup:
         self.m_app_setup = ApplicationsSetup(self.mCmdLineParms, sys.argv,
                                              self.mConfigArgs, True, True)
         self.m_app_info = self.m_app_setup.getApplicationsInfo()
         self.m_app_info.mMainAppPath = (
             PathUtils.include_trailing_path_delimiter(self.module_dir) +
             "../..")
         self.m_app_info.mProcessMax = self.option_def(
             CmdLine.Switches[CmdLine.process_max], None, self.to_int)
         self.m_app_info.mTestBaseDir = None
         self.m_app_info.mToolPath = self.module_dir
예제 #18
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)
예제 #19
0
    def instruction_counts(self):
        my_lines = None
        my_glog = "%s%s" % (
            PathUtils.include_trailing_path_delimiter(self.work_dir),
            self.force_log,
        )

        Msg.user("Path: %s" % my_glog)

        with open(my_glog, "r") as my_log:
            my_lines = my_log.readlines()
            Msg.dbg("Line %d: %s" % (len(my_lines), my_lines[-1]))
            my_log.close()
        try:
            my_results = [
                my_tmp for my_tmp in my_lines
                if re.search(" Instructions Generated", my_tmp)
            ]
            Msg.lout(my_results, "dbg")
            if not my_results:
                raise Exception('Instruction Count Not Found in "gen.log"')

            # ok there are instruction counts located
            for my_line in my_results:
                my_line = my_line.strip()

                # find the instruction type (Total, Default, Secondary)
                my_lpos = my_line.find("]")
                my_rpos = my_line.find("Instr")
                my_type = PerformanceInstructionType.instruction_type(
                    (my_line[my_lpos + 1:my_rpos - 1]).strip())

                # get the count for this instruction type
                my_lpos = my_line.find(":")
                my_count = int(my_line[my_lpos + 2:].strip())

                if my_type == PerformanceInstructionType.Total:
                    self.count = my_count
                elif my_type == PerformanceInstructionType.Secondary:
                    self.secondary = my_count
                elif my_type == PerformanceInstructionType.Default:
                    self.default = my_count

        except ValueError:
            Msg.error_trace()
            Msg.err("Unable to extract instruction count from %s" %
                    (int(my_lines[-1])))

        return 0
예제 #20
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)
예제 #21
0
    def __init__(self, aAppsInfo):
        # print( "Got here (2.0)" )
        super().__init__(CmdLine.Switches[CmdLine.msg_lev], Defaults.msg_level,
                         aAppsInfo)
        #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.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
예제 #22
0
    def handle_expire(self, arg_expire, arg_mask):

        try:
            Msg.user(
                "Expire: %s, Mask: %s" % (str(arg_expire), str(arg_mask)),
                "EXPIRE",
            )
            my_output_base = Formats.main_output_dir % self.output_root
            Msg.user("Expire [1], Output Base: %s" % (str(my_output_base)),
                     "EXPIRE")
            Msg.info("Output Directories Cleanup, Please wait ...")

            if int(arg_expire) == Expire.all:

                Msg.info("Building Directory List, [%s]" % (my_output_base))
                my_dirs = PathUtils.list_dirs(my_output_base)
                Msg.dbg("All Dirs: %s" % (str(my_dirs)), "EXPIRE")

                for my_dir in my_dirs:
                    if my_dir.startswith(arg_mask):
                        my_full_dir = "%s%s" % (
                            PathUtils.include_trailing_path_delimiter(
                                my_output_base),
                            my_dir,
                        )
                        Msg.info("Removing: %s" % (my_full_dir))
                        PathUtils.rmdir(my_full_dir, True)

            else:

                Msg.info("Checking for Expired Directories: %s" %
                         (my_full_dir))
                my_expiredate = DateTime.DateDelta(int(my_expire))
                PathUtils.expire(my_full_dir, my_expiredate)

        except Exception as ex:
            Msg.error_trace()
            Msg.err(str(ex))

        finally:
            Msg.info("Operation Complete, Restart Master Run to continue ...")
            sys.exit(1)
예제 #23
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)
예제 #24
0
    def __init__(self, aCmdLineOptions):
        super().__init__(CompileCmdLineOptions.cOptions, aCmdLineOptions)

        default_path = "$PROJ_ROOT/verif/top/sim"
        if (self.mAppParameters.parameter("compile")
                or self.mAppParameters.parameter("compile.options") or
                self.mAppParameters.parameter("compile.path") != default_path):
            compile_path = self.mAppParameters.parameter("compile.path")
            compile_path = PathUtils.expandVars(compile_path)
            compile_makefile = PathUtils.include_trailing_path_delimiter(
                compile_path) + "Makefile"

            if not PathUtils.check_file(compile_makefile):
                raise Exception(compile_makefile + " does not exist.")

            self.mAppParameters.setParameter("compile.path", compile_path)
            self.mAppParameters.setParameter(
                "compile.options",
                PathUtils.expandVars(
                    self.mAppParameters.parameter("compile.options")),
            )
예제 #25
0
    def __init__(self, aCmdLineOptions):
        super().__init__(CompileCmdLineOptions.cOptions, aCmdLineOptions)

        default_path = '$PROJ_ROOT/verif/top/sim'
        if self.mAppParameters.parameter(
                'compile') or self.mAppParameters.parameter(
                    'compile.options') or self.mAppParameters.parameter(
                        'compile.path') != default_path:
            compile_path = self.mAppParameters.parameter('compile.path')
            compile_path = PathUtils.expandVars(compile_path)
            compile_makefile = PathUtils.include_trailing_path_delimiter(
                compile_path) + 'Makefile'

            if not PathUtils.check_file(compile_makefile):
                raise Exception(compile_makefile + ' does not exist.')

            self.mAppParameters.setParameter('compile.path', compile_path)
            self.mAppParameters.setParameter(
                'compile.options',
                PathUtils.expandVars(
                    self.mAppParameters.parameter('compile.options')))
예제 #26
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)
예제 #27
0
 def build(self):
     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