Esempio n. 1
0
    def set_current_test(self, arg_test_id, arg_test_log, arg_sim_cmd):

        Msg.dbg("RegressionSummary:: set_current_test( %s, %s, %s " %
                (str(arg_test_id), str(arg_test_log), str(arg_sim_cmd)))
        self.curr_test_id = arg_test_id
        self.curr_test_log = arg_test_log
        self.sim_cmd = arg_sim_cmd
Esempio n. 2
0
    def populate(self, arg_dict):
        self.work_dir = arg_dict[CtrlItmKeys.fdir]
        #Msg.trace()
        Msg.user("self.work_dir: %s" % (self.work_dir),
                 "ParentData::populate()")
        self.test_root = arg_dict[CtrlItmKeys.test_root]
        self.mode = arg_dict[CtrlItmKeys.mode]
        self.force_path = arg_dict[CtrlItmKeys.force_path]
        self.action = arg_dict[CtrlItmKeys.action]
        self.process_queue = arg_dict[CtrlItmKeys.process_queue]
        self.force_cmd = arg_dict[CtrlItmKeys.force_cmd]
        self.process_max = arg_dict.get(CtrlItmKeys.process_max,
                                        CtrlItmDefs.process_max)
        self.iss_path = arg_dict.get(CtrlItmKeys.iss_path,
                                     CtrlItmDefs.iss_path)

        if not SysUtils.found(self.iss_path.find(self.test_root)):
            # Msg.user( "Test Root Not Found ..." )
            # if not then prepend the test root
            self.iss_path = PathUtils.include_trailing_path_delimiter(
                self.test_root) + PathUtils.exclude_leading_path_delimiter(
                    self.iss_path)
        Msg.user("Final Iss Path: %s" % (self.iss_path), "ISS_PATH")
        self.timeout = arg_dict.get(CtrlItmKeys.timeout, CtrlItmDefs.timeout)
        return self
Esempio n. 3
0
    def process_group_items( self, arg_ofile, arg_items ):

        # Msg.trace("PerformanceSummaryItem::process_group_items")

        my_grp_count   = 0
        my_grp_elapsed = 0
        try:
            for my_item in arg_items:

                my_item_elapsed = my_item.force_end - my_item.force_start
                my_item_count   = my_item.total

                my_grp_elapsed += my_item_elapsed
                my_grp_count   += my_item_count

                my_line = "\nTask: %s, Instructions: %d, Elapsed: %0.3f\n" % ( my_item.task_id, my_item_count, my_item_elapsed )
                arg_ofile.write( my_line )
                # Msg.dbg( my_line )
                #end: for my_task in my_group["tasks"]:

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

        return my_grp_count, my_grp_elapsed
Esempio n. 4
0
    def process_groups( self, arg_ofile ):

        my_total_count = 0
        my_total_elapsed = 0

        my_groups = self.groups.task_groups();


        # Msg.trace("PerformanceSummaryItem::process_groups")
        for my_group, my_items in my_groups.items():
            try:
                my_str = "\nBegin Group: %s\n" % ( my_group )
                arg_ofile.write( my_str )
                Msg.blank( "info" )
                Msg.info( my_str )

                my_grp_count, my_grp_elapsed = self.process_group_items( arg_ofile, my_items )

                my_total_count   += my_grp_count
                my_total_elapsed += my_grp_elapsed

                my_line =  "\nGroup Instructions: %3d\n" % ( my_grp_count )
                my_line += "Group Elapsed Time: %0.3f\n" % ( my_grp_elapsed )
                my_line += "Group Instructions per Second:  %0.3f\n"  % ( SysUtils.ifthen( bool( my_grp_elapsed ), my_grp_count / my_grp_elapsed, 0 ))
                my_line += "End Group: %s\n" % ( my_group )

                Msg.info( my_line )
                arg_ofile.write( my_line )

            except Exception as arg_ex:

                Msg.error_trace()
                Msg.err( "Unable to process, Group: %s, Reason: %s" % (  my_group, type( arg_ex )))

        return my_total_count, my_total_elapsed
Esempio n. 5
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()
Esempio n. 6
0
    def initialize_sim(self):

        # Msg.dbg( "ExecuteController::initialize_sim()")
        if not self.ctrl_item.no_sim:
            my_tmlog = "iss.railhouse"  #arg_testname.replace( ".py", ".log" )
            self.sim_log = "iss_sim.log"

            self.sim_cmd = "%s -T %s -C %s -i %d --exit_loop=%d" % (
                self.ctrl_item.parent_data.iss_path, my_tmlog,
                self.ctrl_item.num_cores, self.ctrl_item.max_instr,
                self.ctrl_item.exit_loop)

            if not self.ctrl_item.iss is None and type(
                    self.ctrl_item.iss) is dict:
                for my_key in self.ctrl_item.iss.keys():
                    if not my_key == CtrlItmKeys.iss_path:
                        Msg.user("sim_cmd: %s, key: %s " %
                                 (str(self.sim_cmd), str(my_key)))
                        self.sim_cmd += " %s %s" % (
                            str(my_key),
                            SysUtils.ifthen(
                                self.ctrl_item.iss[my_key] is None, "",
                                str(self.ctrl_item.iss[my_key])))

            self.sim_cmd += "%s%s"  #
Esempio n. 7
0
 def run(self):
     Msg.dbg("ThreadTestRun::run()")
     with UnitTest_HiThread():
         pass
     with UnitTest_HiEvent():
         pass
     with UnitTest_HiMutex():
         pass
Esempio n. 8
0
 def init_thread( self ):
     Msg.info( "HiEvent: Creating Test Thread ..." )
     myThreadProcs = { "on-start"   : self.thread_start          # start thread sequence (outside thread space)
                     , "on-execute" : self.thread_execute        # thread termination handler (inside thread space)
                     , "on-done"    : self.thread_done           # thread terminated handler (outside thread space)
                     , "on-finished": self.thread_finished       # thread before finished handler (inside thread space)
                     }
     self.thread = ThreadFactory( "EventTestThread", True, myThreadProcs )
Esempio n. 9
0
    def process_errors(self, arg_ofile):

        if len(self.errors) > 0:
            arg_ofile.write("\n")
            Msg.blank()
            for my_eitem in self.errors:
                my_err_line = str(my_eitem.get_err_line())
                Msg.info(my_err_line)
                arg_ofile.write("%s\n" % (my_err_line))
Esempio n. 10
0
    def load_iss_result(self, arg_dict):

        # Msg.lout( arg_dict, "user", "ISS Results Dictionary ... " )
        self.iss_log = arg_dict["iss-log"]
        try:
            self.iss_retcode = int(arg_dict["iss-retcode"])
        except:
            self.iss_retcode = -1
            Msg.err("ISS Return Code in unrecognizable format")
Esempio n. 11
0
    def run_test(self):
        Msg.info("HiThread(Loop): Start Unit Test ... ")
        myThreadProcs = {
            "on-start":
            self.thread_start  # start thread sequence (outside thread space)
            ,
            "on-execute": self.
            thread_execute  # thread termination handler (inside thread space)
            ,
            "on-finished": self.
            thread_finished  # thread before finished handler (inside thread space)
            ,
            "on-done": self.
            thread_done  # thread terminated handler (outside thread space)
        }

        myThreadOpts = {
            "heartbeat-rate": 2,
            "sleep-period": 100,
            "daemon": False  # run once threads should not be daemons
            ,
            "active": False  # do not start the thread until ready
        }
        Msg.info("UnitTest_LoopThread << Creating Thread With Loop... ")
        myThread = ThreadFactory("LoopThread", False, myThreadProcs,
                                 myThreadOpts)

        Msg.info("UnitTest_LoopThread << Initializing Thread ... ")
        myThread.start_thread()

        # wait for thread to terminate
        myThread.wait_for()
        Msg.info("UnitTest_LoopThread >> Thread Completed ... ")
Esempio n. 12
0
    def run_test(self):
        Msg.info("HiThread(NoLoop): Start Unit Test ... ")

        myThreadProcs = {
            "on-start":
            self.thread_start  # start thread sequence (outside thread space)
            ,
            "on-execute": self.
            thread_execute  # thread termination handler (inside thread space)
            ,
            "on-finished": self.
            thread_finished  # thread before finished handler (inside thread space)
            ,
            "on-done": self.
            thread_done  # thread terminated handler (outside thread space)
        }

        Msg.info("UnitTest_NoLoopThread >> Creating NoLoop Thread ... ")
        myThread = ThreadFactory("NoLoopThread", True, myThreadProcs)

        Msg.info("UnitTest_NoLoopThread >> Initializing Thread ... ")
        myThread.start_thread()

        # wait for thread to terminate
        myThread.wait_for()
        Msg.info("UnitTest_NoLoopThread >> Thread Completed ... ")
Esempio n. 13
0
    def commit_generate( self ):

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

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

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

        return 0
Esempio n. 14
0
    def run(self):
        # Block on process queue while we have threads running and stuff to do

        # == Replaced ==>> while True:
        # == Replaced ==>>     # Pop off the top of the process queue (should block if the queue is empty)
        # == Replaced ==>>     try:
        # == Replaced ==>>         next_item = self.summary_queue.dequeue(0)
        # == Replaced ==>>     except TimeoutError:
        # == Replaced ==>>         if (workers_done_event.isSet()):
        # == Replaced ==>>             summary_done_event.Signal()
        # == Replaced ==>>             return
        # == Replaced ==>>         else:
        # == Replaced ==>>             self.HeartBeat()
        # == Replaced ==>>             continue
        # == Replaced ==>>     my_item = self.summary.create_summary_item()
        # == Replaced ==>>     my_item.load( next_item )
        # == Replaced ==>>     self.summary.commit_item( my_item )
        # == Replaced ==>>     next_item = None

        try:
            while True:  #not workers_done_event.isSet():
                # Pop off the top of the process queue (should block if the queue is empty)
                try:
                    # my_item = self.summary.create_summary_item()
                    # my_qitem = self.summary_queue.dequeue(0)
                    # my_item.load( my_qitem )
                    # self.summary.commit_item( my_item )
                    # my_qitem = None
                    # my_qitem = self.summary_queue.dequeue(0)

                    my_qitem = self.summary_queue.dequeue(0)
                    if isinstance(my_qitem, SummaryErrorQueueItem):
                        Msg.user(str(my_qitem.error_info), "SUMMARY_ERROR")
                        my_eitem = SummaryErrorItem()
                        my_eitem.load(my_qitem)
                        self.summary.commit_error_item(my_eitem)
                    else:
                        my_item = self.summary.create_summary_item()
                        my_item.load(my_qitem)
                        self.summary.commit_item(my_item)
                    my_qitem = None
                except TimeoutError as arg_ex:
                    # {{{TODO}}} Implement proper heartbeat
                    # Msg.dbg( str( arg_ex ) )
                    if (workers_done_event.isSet()):
                        break
                    else:
                        self.HeartBeat()
                        continue
                except Exception as arg_ex:
                    Msg.error_trace()
                    Msg.err(str(arg_ex))
                    raise
                except:
                    Msg.error_trace()
                    raise
        finally:
            summary_done_event.Signal()
Esempio n. 15
0
    def write_control_file(self, arg_frun_file, arg_content):

        #arg_filename = "_def_frun.py"
        with open(arg_frun_file, "w") as my_ofile:
            try:
                return (my_ofile.write(arg_content) > 0)

            except Exception as arg_ex:
                Msg.error_trace()
                Msg.err("Error Writing Control File, " + str(arg_ex))
                # reraise exception to prevent creating tasks in queue if the control file cannot be written

            finally:
                my_ofile.close()

        return False
Esempio n. 16
0
    def load_gen_result(self, arg_dict):

        # Msg.lout( arg_dict, "dbg", "Generate Results Dictionary ... " )
        try:
            self.force_retcode = int(str(arg_dict["force-retcode"]).strip())
        except:
            self.force_retcode = -1
            Msg.err("Generate Return Code in unrecognizable format")

        self.force_stdout = arg_dict["force-stdout"]
        self.force_stderr = arg_dict["force-stderr"]

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

        self.force_start = float(arg_dict.get("force-start", 0.00))
        self.force_end = float(arg_dict.get("force-end", 0.00))
Esempio n. 17
0
    def load_force_elog( self ):
        self.force_msg = None
        my_elog = "%s%s" % ( PathUtils.include_trailing_path_delimiter( self.work_dir ), self.force_elog )
        # Msg.dbg( my_elog )

        if SysUtils.failed( self.force_retcode ):
            Msg.fout( my_elog, "dbg" )
            with open(  my_elog , "r" ) as my_flog:
                try:
                    for my_line in my_flog:

                        if SysUtils.found( my_line.find( "[fail]" )):
                            self.force_msg = my_line.replace( "[fail]", "" ).strip()
                            # Msg.dbg( "Message: %s" % ( str( self.force_msg  )))
                            break
                finally:
                    my_flog.close()
Esempio n. 18
0
    def check_full_path(self, arg_fctrl_dir):
        # handle fully qualified path if found
        Msg.dbg("Checking for control file with real path[%s][%s]" %
                (str(arg_fctrl_dir), str(self.fctrl_name)))
        if arg_fctrl_dir.startswith("/"):
            # there is only one scenario where the control directory starts with the path delimiter and that is the path
            # is a real path from the root directory of the system, the control file must exist at that location
            if PathUtils.check_found(
                    PathUtils.append_path(arg_fctrl_dir, self.fctrl_name)):
                self.fctrl_dir = arg_fctrl_dir
                return True

            raise Exception(
                "Control Item File: [%s] count not be located Not Found at [%s]"
                % (self.fctrl_name, arg_fctrl_dir))

        return False
Esempio n. 19
0
    def load_item_values(self, arg_item_dict):

        my_options = arg_item_dict.get(CtrlItmKeys.options,
                                       CtrlItmDefs.options)
        my_parent_vals = arg_item_dict.get(CtrlItmKeys.parent_vals, {})
        Msg.lout(my_parent_vals, "dbg", "Parent Values from Control Item")
        Msg.lout(self.parent_data, "dbg", "Persistent Data")

        # Control File Location
        self.fctrl_dir = my_options.get(
            CtrlItmKeys.fdir,
            SysUtils.ifthen(self.parent_data.work_dir is None,
                            CtrlItmDefs.fctrl_dir, self.parent_data.work_dir))

        # Populated from control item options
        self.iterations = my_options.get(CtrlItmKeys.iterations,
                                         CtrlItmDefs.iterations)

        # Populated from control item options or parent
        self.exit_loop = my_options.get(
            CtrlItmKeys.exit_loop,
            my_parent_vals.get(CtrlItmKeys.exit_loop, CtrlItmDefs.exit_loop))
        self.group = my_options.get(
            CtrlItmKeys.group,
            my_parent_vals.get(CtrlItmKeys.group, CtrlItmDefs.group))
        self.min_instr = my_options.get(
            CtrlItmKeys.min_instr,
            my_parent_vals.get(CtrlItmKeys.min_instr, CtrlItmDefs.min_instr))
        self.max_instr = my_options.get(
            CtrlItmKeys.max_instr,
            my_parent_vals.get(CtrlItmKeys.max_instr, CtrlItmDefs.max_instr))
        self.num_cores = my_options.get(
            CtrlItmKeys.num_cores,
            my_parent_vals.get(CtrlItmKeys.num_cores, CtrlItmDefs.num_cores))
        self.no_asm = my_options.get(
            CtrlItmKeys.no_asm,
            my_parent_vals.get(CtrlItmKeys.no_asm, CtrlItmDefs.no_asm))
        self.no_sim = my_options.get(
            CtrlItmKeys.no_sim,
            my_parent_vals.get(CtrlItmKeys.no_sim, CtrlItmDefs.no_sim))
        self.timeout = my_options.get(
            CtrlItmKeys.timeout,
            my_parent_vals.get(CtrlItmKeys.timeout, CtrlItmDefs.timeout))
Esempio n. 20
0
    def commit_simulate( self ):

        self.instr_count, self.iss_message = self.extract_iss_info()
        Msg.user( "Instr Count: %d, Message: %s" % (self.instr_count, self.iss_message ))
        try:

            # check the return code for error
            if SysUtils.success( self.iss_retcode ):
                # Check to see for instruction overrun
                if int( self.instr_count ) < self.max_instr:
                    if int( self.instr_count ) >= self.min_instr:
                        self.iss_result = "PASS"
                        self.iss_level  = SummaryLevel.Any
                        return 1

            self.iss_result = "FAIL"
            self.iss_level  = SummaryLevel.Fail
            return 0
        finally:
            pass
Esempio n. 21
0
    def load_process_info(self, arg_process_info):

        # update the user label and send iteration message to the screen if user is active
        # my_usr_lbl = Msg.set_label( "user", "PROCESS-RESULT" )
        # Msg.user( "Executing Iteration #%d of Test File: %s" % ( my_ndx + 1, arg_task_file ))

        Msg.dbg("self.process_result: (%s)" %
                (str(arg_process_info.get("process-result", None))))
        # Msg.set_label( "user", my_usr_lbl )

        self.process_cmd = arg_process_info.get("process-cmd", None)
        self.process_log = arg_process_info.get("process-log", None)
        self.process_result = arg_process_info.get("process-result", None)
        self.frun_path = arg_process_info.get("frun-path", None)
        self.parent_fctrl = arg_process_info.get("parent-fctrl", None)
        self.fctrl_item = arg_process_info.get("fctrl-item", None)
        self.item_group = arg_process_info.get("item-group", None)
        self.fctrl_content = arg_process_info.get("content", None)

        self.detail_flags = SummaryDetail.Nothing
Esempio n. 22
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
Esempio n. 23
0
    def process_task(self, arg_task_file):

        try:
            # get the subdirectory index
            my_ndx = int(PathUtils.next_subdir())

            # update the user label and send iteration message to the screen if user is active
            # my_usr_lbl = Msg.set_label( "user", "TEST-ITERATION" )
            # Msg.user( "Executing Iteration #%d of Test File: %s" % ( my_ndx + 1, arg_task_file ))
            # Msg.set_label( "user", my_usr_lbl )

            # create subdirectory and change into it
            PathUtils.chdir("%05d" % my_ndx, True)

            # save the task template file name with path to the control item
            self.ctrl_item.fname = arg_task_file

            # write out the control file
            # if the write was successful then enqueue the new control file name with real path
            my_ctrl_file = "%s_def_frun.py" % (
                PathUtils.include_trailing_path_delimiter(
                    PathUtils.current_dir()))
            PathUtils.touch("%sSTARTED" %
                            PathUtils.include_trailing_path_delimiter(
                                PathUtils.current_dir()))
            my_content = self.prepare(arg_task_file)
            if self.write_control_file(my_ctrl_file, my_content):
                # my_queue_item = ProcessQueueItem( my_ctrl_file, self.ctrl_item.parent_fctrl, self.ctrl_item.fctrl_item, self.ctrl_item.group, my_content )
                my_queue_item = ProcessQueueItem(
                    my_ctrl_file, self.ctrl_item, my_content
                )  # self.parent_fctrl, self.ctrl_item.fctrl_item, self.ctrl_item.group)
                self.ctrl_item.parent_data.process_queue.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:
            PathUtils.chdir("..")
Esempio n. 24
0
    def check_work_dir(self, arg_fctrl_dir):
        # check the work directory
        Msg.dbg(
            "Checking for control file using implict path[%s] of current control file"
            % (str(arg_fctrl_dir)))
        if not self.parent_data.work_dir is None:

            my_tmp_dir = PathUtils.append_path(self.parent_data.work_dir,
                                               arg_fctrl_dir)
            if not SysUtils.found(my_tmp_dir.find(self.parent_data.test_root)):
                # Prepend the test_root on the work directory
                my_tmp_dir = PathUtils.append_path(self.parent_data.test_root,
                                                   my_tmp_dir)

            if PathUtils.check_found(
                    PathUtils.append_path(my_tmp_dir, self.fctrl_name)):
                self.fctrl_dir = my_tmp_dir
                # Msg.dbg( "Using Control File Directory: %s" % ( self.fctrl_dir ))
                return True

        return False
    def extract_results(self, arg_result, arg_cmd, arg_log, arg_process_item,
                        arg_start_time, arg_end_time):
        Msg.dbg("Return Code %s, Command Line: |%s|, Log File: %s" %
                (str(arg_result), arg_cmd, arg_log))

        #Msg.fout( arg_log, "info" )
        my_summary_item = SummaryQueueItem({
            "process-cmd": arg_cmd,
            "process-log": arg_log,
            "process-result": arg_result,
            "frun-path": arg_process_item.frun_path,
            "parent-fctrl": arg_process_item.parent_fctrl,
            "fctrl-item": arg_process_item.fctrl_item,
            "item-group": arg_process_item.item_group,
            "content": arg_process_item.content,
            "start-time": arg_start_time,
            "end-time": arg_end_time
        })
        while (self.summary.queue.enqueue(my_summary_item) == False):
            self.HeartBeat()
            pass
Esempio n. 26
0
 def execute(self):
     Msg.info("LoopThread::execute() => Enter ")
     for i in range(3):
         Msg.info("Thread Work: %d:%d" % (self.max_loops, i + 1))
     self.check_finished()
     self.heartbeat()
     Msg.info("LoopThread::execute() => Leave")
Esempio n. 27
0
    def load(self, arg_queue_item):
        try:
            # my_usr_lbl = Msg.set_label( "user", "SUMMARY_ITEM" )
            self.load_process_info(arg_queue_item.process_info)
            # Msg.lout( self, "user", "Summary Item(load_process_info)" )
            self.load_task_info()
            # Msg.lout( self, "user", "Summary Item(load_task_info)" )
            self.load_process_log()

            # Msg.lout( self, "user", "Summary Item(load_process_log)" )
            self.load_force_log()

            # Msg.lout( self, "user", "Summary Item(load_force_log)" )
            self.load_force_elog()
            # Msg.lout( self, "user", "Summary Item(load_force_elog)" )
            self.prepare()
            self.report()
            # Msg.set_label( "user", my_usr_lbl )

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

        except:
            Msg.error_trace()
Esempio n. 28
0
    def exec_iss(self, arg_task_name):

        # Msg.dbg( "ExecuteController::exec_iss( %s )" % ( arg_task_name ) )
        # build rest of command for iss
        my_elf = "%s.Default.ELF" % (arg_task_name)
        # Msg.dbg( "Looking For: %s" % ( my_elf ))
        my_elf = SysUtils.ifthen(PathUtils.check_file(my_elf), " %s" % my_elf,
                                 "")
        # Msg.dbg( "Using ELF: %s" % ( my_elf ))

        my_elfns = "%s.Secondary.ELF" % (arg_task_name)
        # Msg.dbg( "Looking For: %s" % ( my_elfns ))
        my_elfns = SysUtils.ifthen(PathUtils.check_file(my_elfns),
                                   " %s" % my_elfns, "")
        my_cmd = self.sim_cmd % (my_elf, my_elfns)

        try:
            # execute the simulation
            Msg.info("ISSCommand = " + str({"iss-command": my_cmd}))
            my_log = self.sim_log
            my_elog = self.sim_log

            #my_ret_code = int( SysUtils.exec_cmd( my_cmd ) )
            my_result = SysUtils.exec_process(my_cmd, my_log, my_elog,
                                              self.ctrl_item.timeout, True)

            my_ret_code = int(my_result[0])
            my_std_out = str(my_result[1])
            my_std_err = str(my_result[2])
            my_start = str(my_result[3])
            my_end = str(my_result[4])

            Msg.info("ISSResult = " + str({
                "iss-retcode": my_ret_code,
                "iss-log": self.sim_log,
                "iss-stdout": my_std_out,
                "iss-stderr": my_std_err,
                "iss-start": my_start,
                "iss-end": my_end
            }))

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

        return True
Esempio n. 29
0
    def with_test( self ):

        # create a mutex
        my_mutex = HiMutex( "with_mutex" )
        # Msg.info( "Before With: Mutex[%s] is %s" % ( my_mutex.name, SysUtils.ifthen( my_mutex.locked(), "Locked", "Unlocked" )))
        Msg.info( "Before With: Mutex[%s]" % ( my_mutex.name ))

        with my_mutex :
            Msg.info( "In With: Mutex[%s]" % ( my_mutex.name ))
            # Msg.info( "In With: Mutex[%s] is %s" % ( my_mutex.name, SysUtils.ifthen( my_mutex.locked(), "Locked", "Unlocked" )))

        Msg.info( "After With: Mutex[%s]" % ( my_mutex.name ))
Esempio n. 30
0
 def process_task_list(self):
     for my_task_file in self.task_list:
         # Msg.dbg( "Process Task File: %s" % ( my_task_file ))
         my_curdir = PathUtils.current_dir()
         try:
             # self.process_task_file( my_task_file )
             self.process_task_file(my_task_file)
         except Exception as arg_ex:
             Msg.error_trace()
             Msg.err(str(arg_ex))
             Msg.blank()
         finally:
             PathUtils.chdir(my_curdir)