Exemple #1
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)
Exemple #2
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
Exemple #3
0
    def shouldKeepFile(self, fileName):
        self.fileBaseName = PathUtils.base_name(fileName)

        if self.fileBaseName in self.baseNamesToKeep:
            return True

        if self.keepNone:
            return False  # keep none of the rest

        if self.keepAll:
            return True

        for typeToKeep in self.typesToKeep:
            if self.fileBaseName.endswith(typeToKeep):
                return True

        return False
Exemple #4
0
 def _getReportName(self):
     report_name = "top_force_" + PathUtils.base_name(self._mTestDir)
     return report_name