예제 #1
0
    def check_parent_dir(self, arg_fctrl_dir):

        Msg.dbg("Checking for control file in parent directory")
        Msg.user(
            "Test Root[%s], Work Dir[%s]" %
            (str(self.parent_data.test_root), str(self.parent_data.work_dir)),
            "CHECK-PARENT-DIR")

        if arg_fctrl_dir.startswith(".."):

            my_search_dir = arg_fctrl_dir
            my_work_dir = PathUtils.append_path(self.parent_data.test_root,
                                                self.parent_data.work_dir)
            my_test_root = self.parent_data.test_root
            Msg.user(
                "Updated Test Root[%s], Full Work Dir[%s], Search Dir[%s]" %
                (my_test_root, my_work_dir, my_search_dir), "CHECK-PARENT-DIR")

            while my_search_dir.startswith(".."):

                # First get the parent directory
                # The search [updated] directory started with [..] split path for both the work directory and the search directory
                # this fact that the [updated] search directory still begins with a [..], means that the work directory
                my_test_root, my_dumy = PathUtils.split_dir(my_test_root)
                my_work_dir, my_dumy = PathUtils.split_dir(my_work_dir)
                my_search_dir = my_search_dir[3:]
                Msg.user(
                    "Updated Test Root[%s], Full Work Dir[%s], Search Dir[%s]"
                    % (my_test_root, my_work_dir, my_search_dir),
                    "CHECK-PARENT-DIR")

                my_filepath = str(
                    PathUtils.append_path(
                        my_work_dir,
                        PathUtils.append_path(my_search_dir, self.fctrl_name)))
                Msg.user("File Path[%s] ... " % (my_filepath),
                         "CHECK-PARENT-DIR")

                if PathUtils.check_found(my_filepath):
                    self.fctrl_dir = PathUtils.append_path(
                        my_work_dir, my_search_dir)
                    return True

                my_filepath = str(
                    PathUtils.append_path(
                        my_test_root,
                        PathUtils.append_path(my_search_dir, self.fctrl_name)))
                Msg.user("File Path[%s] ... " % (my_filepath),
                         "CHECK-PARENT-DIR")

                if PathUtils.check_found(my_filepath):
                    self.fctrl_dir = PathUtils.append_path(
                        my_test_root, my_search_dir)
                    return True

            raise Exception(
                "Control Item File[%s] Not Found in Parent Directory: [%s]" %
                (self.fctrl_name, arg_fctrl_dir))

        return False
예제 #2
0
    def load_task_info(self):

        self.task_id = None
        self.task_index = None
        self.work_dir = None
        self.work_dir, my_tmp = PathUtils.split_path(self.frun_path)
        my_tmp, my_index = PathUtils.split_dir(self.work_dir)
        my_tmp, self.task_id = PathUtils.split_dir(my_tmp)
        self.task_index = int(my_index)