Пример #1
0
    def __init__(self, suite, hooks, archive_instance, archive_config):  #pylint: disable=unused-argument
        """Initialize HookTestArchival."""
        self.archive_instance = archive_instance
        archive_config = utils.default_if_none(archive_config, {})

        self.on_success = archive_config.get("on_success", False)

        self.tests = []
        self.archive_all = False
        if "tests" in archive_config:
            # 'tests' is either a list of tests to archive or a bool (archive all if True).
            if not isinstance(archive_config["tests"], bool):
                for test in archive_config["tests"]:
                    self.tests += globstar.glob(test)
            elif archive_config["tests"]:
                self.archive_all = True

        self.hooks = []
        if "hooks" in archive_config:
            # 'hooks' is either a list of hooks to archive or a bool (archive all if True).
            if not isinstance(archive_config["hooks"], bool):
                self.hooks = archive_config["hooks"]
            elif archive_config["hooks"]:
                for hook in hooks:
                    self.hooks.append(hook["class"])

        self._tests_repeat = {}
        self._lock = threading.Lock()
    def _find_executable(self):
        if config.INSTALL_DIR is not None:
            binary = os.path.join(config.INSTALL_DIR, "server_selection_json_test")
            if os.name == "nt":
                binary += ".exe"

            if os.path.isfile(binary):
                return binary

        execs = globstar.glob(self.EXECUTABLE_BUILD_PATH + '.exe')
        if not execs:
            execs = globstar.glob(self.EXECUTABLE_BUILD_PATH)
        if len(execs) != 1:
            raise errors.StopExecution(
                "There must be a single server_selection_json_test binary in {}".format(execs))
        return execs[0]
Пример #3
0
def cleanup_tags(lifecycle, evg_conf):
    """Remove the tags that do not correspond to a valid test/task/variant/distro combination."""
    for test_kind in lifecycle.get_test_kinds():
        for test_pattern in lifecycle.get_test_patterns(test_kind):
            if not globstar.glob(test_pattern):
                # The pattern does not match any file in the repository.
                lifecycle.remove_test_pattern(test_kind, test_pattern)
                continue
            for tag in lifecycle.get_tags(test_kind, test_pattern):
                if not _is_tag_still_relevant(evg_conf, tag):
                    lifecycle.remove_tag(test_kind, test_pattern, tag)
Пример #4
0
def clean_up_tags(lifecycle_tags, evg_conf):
    """Remove the tags that do not correspond to a valid test/task/variant/distro combination."""
    lifecycle = lifecycle_tags.lifecycle
    for test_kind in lifecycle.get_test_kinds():
        for test_pattern in lifecycle.get_test_patterns(test_kind):
            if not globstar.glob(test_pattern):
                # The pattern does not match any file in the repository.
                lifecycle_tags.clean_up_test(test_kind, test_pattern)
                continue
            for tag in lifecycle.get_tags(test_kind, test_pattern):
                if not _is_tag_still_relevant(evg_conf, tag):
                    lifecycle_tags.clean_up_tag(test_kind, test_pattern, tag)
    def __init__(self, logger, json_filename, mql_executable=None):
        """Initialize the MqlModelHaskellTestCase with the executable to run."""

        interface.ProcessTestCase.__init__(self, logger,
                                           "MQL Haskell Model test",
                                           json_filename)

        self.json_test_file = json_filename

        # Determine the top level directory where we start a search for a mql binary
        self.top_level_dirname = os.path.join(
            os.path.normpath(json_filename).split(os.sep)[0], "")

        # Our haskell cabal build produces binaries in an unique directory
        # .../dist-sandbox-<some hex hash>/...
        # so we use a glob pattern to fish out the binary
        mql_executable = utils.default_if_none(
            mql_executable, "mql-model/dist/dist*/build/mql/mql")
        execs = globstar.glob(mql_executable)
        if len(execs) != 1:
            raise errors.StopExecution(
                "There must be a single mql binary in {}".format(execs))

        self.program_executable = execs[0]