def rename_elfs(self, arg_suffix): # before proceeding it is necessary to remove any existing renamed files to eliminate the possibility of causing # a chain and messing up the results for my_mask in ["*.ELF", "*.S", "*.img"]: my_match_files = PathUtils.list_files(my_mask) Msg.lout(my_match_files, "user", "Simulate File List") for my_src_file in my_match_files: Msg.user( "Match File: %s, Suffix: %s" % (str(my_src_file), str(arg_suffix)), "MATCH") if SysUtils.found( my_src_file.find("_%s_force" % (str(arg_suffix)))): PathUtils.remove(my_src_file) continue # Now rename all the files that are found for my_mask in ["*.ELF", "*.S", "*.img"]: my_match_files = PathUtils.list_files(my_mask) for my_src_file in my_match_files: my_tgt_file = my_src_file.replace( "_force", "_%s_force" % (str(arg_suffix))) PathUtils.rename(my_src_file, my_tgt_file) # raise Exception("Type %s test case for base test: %s not found." % (arg_extension, arg_test_name)) return True
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)
def load(self, arg_ctrl_item): super().load(arg_ctrl_item) # Msg.dbg( "TaskController::load()") self.task_list = PathUtils.list_files( PathUtils.append_path(self.ctrl_item.fctrl_dir, self.ctrl_item.fctrl_name)) return True
def locate_test_case( self, arg_extension, arg_test_name ): Msg.user( "IssExecutor::locate_test_case( Extension: %s, Test Name: %s )" % ( str( arg_extension ), str( arg_test_name ))) my_match_files = PathUtils.list_files( arg_extension ) Msg.lout( my_match_files, "user", "Simulate File List" ) if arg_test_name.endswith( "_force" ): arg_test_name = arg_test_name.replace( "_force", "" ) for my_file in my_match_files: Msg.user( "Match File: %s, Test Name: %s" % ( str( my_file ), str( arg_test_name ))) if ( my_file.find( arg_test_name ) != -1 ): return my_file raise Exception("Type %s test case for base test: %s not found." % (arg_extension, arg_test_name)) return None
def load(self, arg_ctrl_item): super().load(arg_ctrl_item) # Msg.dbg( "TaskController::load()") self.task_list = PathUtils.list_files( PathUtils.append_path(self.ctrl_item.fctrl_dir, self.ctrl_item.fctrl_name)) # # Msg.user( "File Count: " + str( len( self.task_list )), "TASKCTRL" ) # my_usr_lbl = Msg.set_label( "user", "TASKCTRL" ) # Msg.lout(self.task_list, "user", "File List to Process with this Controller" ) # Msg.set_label( "user", my_usr_lbl ) # # import sys # sys.exit(-1) # return True