]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Use underscore for system test names
authorNicki Křížek <nicki@isc.org>
Tue, 17 Mar 2026 16:08:15 +0000 (17:08 +0100)
committerNicki Křížek <nicki@isc.org>
Wed, 18 Mar 2026 14:36:50 +0000 (15:36 +0100)
Change the convention for system test directory names to always use an
underscore rather than a hyphen. Names using underscore are valid python
package names and can be used with standard `import` facilities in
python, which allows easier code reuse.

The temporary directories for test execution and their convenience
symlinks have been switched to using hyphens rather than underscores to
keep the pytest collection, filtering and .gitignore working as
expected.

(cherry picked from commit 9f4c1d1993fe624c5d68cbc51521dd4761513cd2)

bin/tests/system/.gitignore
bin/tests/system/Makefile.am
bin/tests/system/README.md
bin/tests/system/conftest.py
dangerfile.py

index 40abc203beb023fc04f5436e018a4f33fd321ed0..c0fd8766386aa644cb3d398a3566fc1f86c7885d 100644 (file)
@@ -23,10 +23,9 @@ named.run
 /isctest/vars/.ac_vars/*
 !/isctest/vars/.ac_vars/*.in
 
-# Ignore file names with underscore in their name except python or shell files.
+# Ignore file names with a hyphen in their name except C files.
 # This is done to ignore the temporary directories and symlinks created by the
 # pytest runner, which contain underscore in their file names.
-/*_*
-!/*_*.py
-!/*_*.sh
-!/_common
+/*-*
+!/*-*.c
+!/custom-test-driver
index b64a6a9ad886d6c25a36689dbe71c777e849f27d..6ece4676b852865617e9fb9524a5419bbf1684b9 100644 (file)
@@ -75,13 +75,13 @@ rpz_dnsrps_LDADD =          \
 TESTS =                                \
        rpz                     \
        rpzrecurse              \
-       serve-stale             \
+       serve_stale             \
        timeouts                \
        upforwd                 \
        acl                     \
        additional              \
        addzone                 \
-       allow-query             \
+       allow_query             \
        auth                    \
        autosign                \
        builtin                 \
@@ -120,7 +120,7 @@ TESTS =                             \
        geoip2                  \
        glue                    \
        idna                    \
-       include-multiplecfg     \
+       include_multiplecfg     \
        inline                  \
        integrity               \
        ixfr                    \
@@ -151,25 +151,25 @@ TESTS =                           \
        proxy                   \
        pipelined               \
        qmin                    \
-       query-source            \
+       query_source            \
        reclimit                \
        redirect                \
        resolver                \
        rndc                    \
        rollover                \
-       rollover-algo-csk       \
-       rollover-algo-ksk-zsk   \
-       rollover-csk-roll1      \
-       rollover-csk-roll2      \
-       rollover-dynamic2inline \
-       rollover-enable-dnssec  \
-       rollover-going-insecure \
-       rollover-ksk-3crowd     \
-       rollover-ksk-doubleksk  \
-       rollover-lifetime       \
-       rollover-multisigner    \
-       rollover-straight2none  \
-       rollover-zsk-prepub     \
+       rollover_algo_csk       \
+       rollover_algo_ksk_zsk   \
+       rollover_csk_roll1      \
+       rollover_csk_roll2      \
+       rollover_dynamic2inline \
+       rollover_enable_dnssec  \
+       rollover_going_insecure \
+       rollover_ksk_3crowd     \
+       rollover_ksk_doubleksk  \
+       rollover_lifetime       \
+       rollover_multisigner    \
+       rollover_straight2none  \
+       rollover_zsk_prepub     \
        rootkeysentinel         \
        rpzextra                \
        rrchecker               \
@@ -190,7 +190,7 @@ TESTS =                             \
        synthfromdnssec         \
        tcp                     \
        tools                   \
-       transport-acl           \
+       transport_acl           \
        tsig                    \
        tsiggss                 \
        ttl                     \
@@ -232,4 +232,4 @@ LOG_COMPILER = $(srcdir)/run.sh
 test-local: check
 
 clean-local::
-       -find -L . -mindepth 1 -maxdepth 1 -type d -name "*_*" -and -not -name "_common" -exec rm -rf {} \;
+       -find -L . -mindepth 1 -maxdepth 1 -type d -name "*-*" -exec rm -rf {} \;
index dc5f782779cd41409d708db1d5f5b47492c9c1e5..70d02505f00a82c48776ede5fa6c4f7a308cef2f 100644 (file)
@@ -123,10 +123,10 @@ Each test module is executed inside a unique temporary directory which contains
 all the artifacts from the test run. If the tests succeed, they are deleted by
 default. To override this behaviour, pass `--noclean` to pytest.
 
-The directory name starts with the system test name, followed by `_tmp_XXXXXX`,
-i.e. `dns64_tmp_r07vei9s` for `dns64` test run. Since this name changes each
+The directory name starts with the system test name, followed by `-tmp-XXXXXX`,
+i.e. `dns64-tmp-r07vei9s` for `dns64` test run. Since this name changes each
 run, a convenience symlink that has a stable name is also created. It points to
-the latest test artifacts directory and has a form of `dns64_sh_dns64`
+the latest test artifacts directory and has a form of `dns64-sh_dns64`
 (depending on the particular test module).
 
 To clean up the temporary directories and symlinks, run `make clean-local` in
index 639a51d7675d3f24dcd1d0a5b5e6faa3da90f176..2b59002ee6133657cd230ae9e4e0ed757e9ba9e8 100644 (file)
@@ -54,7 +54,7 @@ PRIORITY_TESTS = [
 ]
 PRIORITY_TESTS_RE = Re("|".join(PRIORITY_TESTS))
 SYSTEM_TEST_NAME_RE = Re(f"{SYSTEM_TEST_DIR_GIT_PATH}" + r"/([^/]+)")
-SYMLINK_REPLACEMENT_RE = Re(r"/tests(_.*)\.py")
+SYMLINK_REPLACEMENT_RE = Re(r"/tests_(.*)\.py")
 
 # ----------------------- Global requirements ----------------------------
 
@@ -80,14 +80,14 @@ def pytest_ignore_collect(collection_path):
     # ignore these during test collection phase. Otherwise, test artifacts
     # from previous runs could mess with the runner. Also ignore the
     # convenience symlinks to those test directories. In both of those
-    # cases, the system test name (directory) contains an underscore, which
+    # cases, the system test name (directory) contains a hyphen, which
     # is otherwise and invalid character for a system test name.
     match = SYSTEM_TEST_NAME_RE.search(str(collection_path))
     if match is None:
         isctest.log.warning("unexpected test path: %s (ignored)", collection_path)
         return True
     system_test_name = match.groups()[0]
-    return "_" in system_test_name
+    return "-" in system_test_name
 
 
 def pytest_collection_modifyitems(items):
@@ -388,14 +388,14 @@ def system_test_dir(request, system_test_name, expected_artifacts):
     # Create a temporary directory with a copy of the original system test dir contents
     system_test_root = Path(os.environ["builddir"]).resolve()
     testdir = Path(
-        tempfile.mkdtemp(prefix=f"{system_test_name}_tmp_", dir=system_test_root)
+        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", str(request.node.path))
+    module_name = SYMLINK_REPLACEMENT_RE.sub(r"-\1", str(request.node.path))
     symlink_dst = system_test_root / module_name
     symlink_dst.unlink(missing_ok=True)
     symlink_dst.symlink_to(os.path.relpath(testdir, start=system_test_root))
index 27e2d31c1cac0b6317fbb6e491cade8e571c009d..b9dea1127333f17c5bb42ca41e909fc0bb387da0 100644 (file)
@@ -493,10 +493,10 @@ for testname in testnames:
         or testname == "isctest"
     ):
         continue
-    if "_" in testname:
+    if "-" in testname:
         fail(
-            f"System test directory `{testname}` may not contain an underscore, "
-            "use hyphen instead."
+            f"System test directory `{testname}` may not contain a hyphen, "
+            "use underscore instead."
         )
     if not glob.glob(f"{dirpath}/**/tests_*.py", recursive=True):
         fail(