def initialize_output(self): self.mode = self.option_def(CmdLine.Switches[CmdLine.mode], None) self.output_root = PathUtils.exclude_trailing_path_delimiter( self.option_def(CmdLine.Switches[CmdLine.target_dir], PathUtils.current_dir())) Msg.user("Output Root: %s" % (str(self.output_root))) # check launcher type here since we need to know if we are running # with LSF Msg.user("Before Launcher Type", "MASTERRUN") self.launcher_type = self.option_def( CmdLine.Switches[CmdLine.run_launcher], Defaults.run_launcher) Msg.user("Launcher Type: %s" % (str(self.launcher_type)), "MASTERRUN") # ok the root output directory has been established. # next check to see if there is an expiration if there is handle that # and exit the session my_expire = self.option_def(CmdLine.Switches[CmdLine.expire], None) my_session_type = (Formats.perf_output_dir if SysUtils.found( self.mode.find(Modes.perf)) else Formats.regress_output_dir) if my_expire is not None: self.handle_expire(my_expire, my_session_type) raise Exception( "Problem with handle_expire, should have terminated .....") # Continuing create the full output directory which if exists should # be archived or removed my_output_base = Formats.main_output_dir % self.output_root self.output_dir = "%s/%s/" % ( PathUtils.exclude_trailing_path_delimiter(my_output_base), PathUtils.exclude_trailing_path_delimiter(my_session_type), ) Msg.user("Target Output Dir: %s" % (str(self.output_dir))) mod_time = None # if there is no expire setting then if PathUtils.check_dir(self.output_dir): # check modification time of the directory, if it is created very # recently, delay a bit when running on LSF. # since client machines might hold a stale directory handler still. mod_time = PathUtils.time_modified(self.output_dir) if self.option_def(CmdLine.Switches[CmdLine.no_archive], Defaults.no_archive): PathUtils.rmdir(self.output_dir, True) # remove output directory tree else: PathUtils.archive_dir(self.output_dir) PathUtils.mkdir(self.output_dir) if mod_time is not None: self.waitForLfs(mod_time) return True
def prepare(self): if self.root.startswith("$(") and self.root.endswith(")"): self.root = PathUtils.exclude_trailing_path_delimiter( SysUtils.envar(self.root[2:-1], None)) self.default_fsdb_do = PathUtils.append_path(self.root, self.default_fsdb_do) if self.regr.startswith("$(") and self.regr.endswith(")"): self.regr = PathUtils.exclude_trailing_path_delimiter( SysUtils.envar(self.regr[2:-1], "logs")) else: self.regr = "logs" if self.cfg.startswith("$(") and self.cfg.endswith(")"): self.cfg = PathUtils.exclude_trailing_path_delimiter( SysUtils.envar(self.cfg[2:-1], "target_config")) else: self.cfg = "config_name" if self.name.startswith("$(") and self.name.endswith(")"): self.name = PathUtils.exclude_trailing_path_delimiter( SysUtils.envar(self.name[2:-1], "uvm_simv_opt")) else: self.cfg = "uvm_simv_opt" self.path = PathUtils.exclude_trailing_path_delimiter(self.path) self.tgt = PathUtils.exclude_trailing_path_delimiter(self.tgt) self._debug_command = self.cmd % (self.root, self.path, self.regr, self.tgt, self.debug_cfg, self.debug_name)