예제 #1
0
    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
예제 #2
0
    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
예제 #3
0
    def query_result_log(self, arg_hfile):

        my_seed = None
        my_total = 0
        my_secondary = 0
        my_default = 0

        my_results = []

        for my_line in arg_hfile:
            Msg.dbg("Process Line: %s" % my_line)

            if SysUtils.found(
                    my_line.find("]Secondary Instructions Generated")):
                # get the count for the secondary instruction type
                my_lpos = my_line.find(':')
                my_count = int(my_line[my_lpos + 2:].strip())
                my_secondary = my_count
                Msg.user("Secondary Instructions: %d" % (my_secondary))

            elif SysUtils.found(
                    my_line.find("]Default Instructions Generated")):
                # get the count for the default instruction type
                my_lpos = my_line.find(':')
                my_count = int(my_line[my_lpos + 2:].strip())
                my_default = my_count
                Msg.user("Default Instructions: %d" % (my_default))

            if SysUtils.found(my_line.find("]Total Instructions Generated")):
                # get the total count any instruction type
                my_lpos = my_line.find(':')
                my_count = int(my_line[my_lpos + 2:].strip())
                my_total = my_count
                Msg.user("Total Instructions: %d" % (my_count))

            if SysUtils.found(my_line.find("Initial seed")):
                my_seed = my_line.replace("[notice]",
                                          "").replace("Initial seed = ",
                                                      "").strip()

            if (my_seed is None or my_total == 0 or my_secondary == 0
                    or my_default == 0):
                continue

        return (my_seed, my_total, my_secondary, my_default)
예제 #4
0
    def initialize_summary(self):

        my_keep = self.option_def(CmdLine.Switches[CmdLine.keep],
                                  Defaults.keep)
        clean_up_rules = CleanUpRules(my_keep)

        if SysUtils.found(self.mode.find(Modes.perf)):
            self.mode = Modes.perf
            self.options[CtrlItmKeys.no_sim] = True
            self.summary = PerformanceSummary(self.output_dir, clean_up_rules)
        elif SysUtils.found(self.mode.find(Modes.regress)):
            self.mode = Modes.regress
            self.summary = RegressionSummary(self.output_dir, clean_up_rules)
        else:
            self.mode = Modes.count
            self.m_app_info.mMode = "count"
            self.summary = RegressionSummary(self.output_dir, clean_up_rules)

        if self.summary is not None:
            self.summary.set_on_fail_proc(self.on_fail_proc)
            self.summary.set_is_term_proc(self.is_term_proc)
예제 #5
0
    def initialize_summary(self):

        my_keep = self.option_def( CmdLine.Switches[CmdLine.keep], Defaults.keep )
        clean_up_rules = CleanUpRules(my_keep)

        if SysUtils.found( self.mode.find( Modes.perf )):
            self.mode = Modes.perf
            self.options[CtrlItmKeys.no_sim] = True
            self.summary = PerformanceSummary( self.output_dir, clean_up_rules )
        elif SysUtils.found( self.mode.find( Modes.regress )):
            self.mode = Modes.regress
            self.summary = RegressionSummary( self.output_dir, clean_up_rules )
        else:
            self.mode = Modes.count
            self._mAppsInfo.mMode = "count"
            self.summary = RegressionSummary( self.output_dir, clean_up_rules )

        if self.summary is not None:

            self.summary.set_on_fail_proc( self.on_fail_proc )
            # {{{TODO}}} expand this to use the terminated proc as a way to determine whether or not to stop
            # processing more items instead of the insane way it works now.
            self.summary.set_is_term_proc( self.is_term_proc )
예제 #6
0
 def query_errors(self, arg_hfile):
     my_error = None
     for my_line in arg_hfile:
         if SysUtils.found(my_line.find("[fail]")):
             return my_line.replace("[fail]", "").strip()