pytest.register_assert_rewrite("isctest")
import isctest
+from isctest.vars.dirs import SYSTEM_TEST_DIR_GIT_PATH
# Silence warnings caused by passing a pytest fixture to another fixture.
"upforwd/",
]
PRIORITY_TESTS_RE = re.compile("|".join(PRIORITY_TESTS))
-SYSTEM_TEST_DIR_GIT_PATH = "bin/tests/system"
SYSTEM_TEST_NAME_RE = re.compile(f"{SYSTEM_TEST_DIR_GIT_PATH}" + r"/([^/]+)")
SYMLINK_REPLACEMENT_RE = re.compile(r"/tests(_.*)\.py")
def env():
"""Dictionary containing environment variables for the test."""
env = dict(isctest.vars.ALL)
- env["builddir"] = f"{env['TOP_BUILDDIR']}/{SYSTEM_TEST_DIR_GIT_PATH}"
- env["srcdir"] = f"{env['TOP_SRCDIR']}/{SYSTEM_TEST_DIR_GIT_PATH}"
os.environ.update(env)
return env
pass
# Create a temporary directory with a copy of the original system test dir contents
- system_test_root = Path(
- f"{isctest.vars.ALL['TOP_BUILDDIR']}/{SYSTEM_TEST_DIR_GIT_PATH}"
- )
+ system_test_root = Path(os.environ["builddir"])
testdir = Path(
tempfile.mkdtemp(prefix=f"{system_test_name}_tmp_", dir=system_test_root)
)
shutil.rmtree(testdir)
shutil.copytree(system_test_root / system_test_name, testdir)
+ isctest.vars.dirs.set_system_test_name(testdir.name)
# Create a convenience symlink with a stable and predictable name
module_name = SYMLINK_REPLACEMENT_RE.sub(r"\1", request.node.name)
# pylint: enable=import-error
from .basic import BASIC_VARS
+from .dirs import DIR_VARS
from .openssl import OPENSSL_VARS
from .ports import PORT_VARS
return iter(self.keys())
-ALL = VarLookup(AC_VARS, BASIC_VARS, OPENSSL_VARS, PORT_VARS)
+ALL = VarLookup(AC_VARS, BASIC_VARS, OPENSSL_VARS, PORT_VARS, DIR_VARS)
--- /dev/null
+# Copyright (C) Internet Systems Consortium, Inc. ("ISC")
+#
+# SPDX-License-Identifier: MPL-2.0
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, you can obtain one at https://mozilla.org/MPL/2.0/.
+#
+# See the COPYRIGHT file distributed with this work for additional
+# information regarding copyright ownership.
+
+import os
+
+# pylint: disable=import-error
+from .autoconf import AC_VARS # type: ignore
+
+# pylint: enable=import-error
+
+
+SYSTEM_TEST_DIR_GIT_PATH = "bin/tests/system"
+
+DIR_VARS = {
+ "builddir": f"{AC_VARS['TOP_BUILDDIR']}/{SYSTEM_TEST_DIR_GIT_PATH}",
+ "srcdir": f"{AC_VARS['TOP_SRCDIR']}/{SYSTEM_TEST_DIR_GIT_PATH}",
+ "SYSTESTDIR": None,
+}
+
+
+def set_system_test_name(name: str):
+ DIR_VARS["SYSTESTDIR"] = name
+ os.environ["SYSTESTDIR"] = name
. ../../conf.sh
-SYSTESTDIR=legacy
-
echo_i "sign edns512"
zone=edns512
. ../../conf.sh
-SYSTESTDIR=legacy
-
echo_i "sign edns512-notcp"
zone=edns512-notcp
. ../../conf.sh
-SYSTESTDIR=verify
-
dumpit() {
echo_d "${debug}: dumping ${1}"
cat "${1}" | cat_d
. ../../conf.sh
-SYSTESTDIR=wildcard
-
dssets=
# RFC 4592 example zone.