diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 27dcb698c7..8ae413727f 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -271,11 +271,11 @@ stages: # change directory to the workspace before including this .find_python: &find_python - - PYTHON="$(sed -n -E 's|^[[:space:]]*"PYTHON":[[:space:]]*"([^"]*)",[[:space:]]*$|\1|p' bin/tests/system/isctest/vars/autoconf.py)" + - PYTHON="$(cat bin/tests/system/isctest/vars/.ac_vars/PYTHON)" - test -x "$PYTHON" .find_pytest: &find_pytest - - PYTEST="$(sed -n -E 's|^[[:space:]]*"PYTEST":[[:space:]]*"([^"]*)",[[:space:]]*$|\1|p' bin/tests/system/isctest/vars/autoconf.py)" + - PYTEST="$(cat bin/tests/system/isctest/vars/.ac_vars/PYTEST)" - test -x "$PYTEST" .parse_tsan: &parse_tsan diff --git a/.reuse/dep5 b/.reuse/dep5 index 0de1a85da0..1becbd1686 100644 --- a/.reuse/dep5 +++ b/.reuse/dep5 @@ -47,6 +47,7 @@ Files: **/*.after* bin/tests/system/forward/CA/index.txt bin/tests/system/forward/CA/index.txt.attr bin/tests/system/forward/CA/serial + bin/tests/system/isctest/vars/.ac_vars/* bin/tests/system/journal/ns1/managed-keys.bind.in bin/tests/system/journal/ns1/managed-keys.bind.jnl.in bin/tests/system/journal/ns2/managed-keys.bind.in diff --git a/bin/tests/system/.gitignore b/bin/tests/system/.gitignore index 05ae7f8b4e..3c2db219b0 100644 --- a/bin/tests/system/.gitignore +++ b/bin/tests/system/.gitignore @@ -19,7 +19,8 @@ named.run /start.sh /stop.sh /ifconfig.sh -/isctest/vars/autoconf.py +/isctest/vars/.ac_vars/* +!/isctest/vars/.ac_vars/*.in # Ignore file names with underscore in their name except python or shell files. # This is done to ignore the temporary directories and symlinks created by the diff --git a/bin/tests/system/isctest/vars/.ac_vars/CURL.in b/bin/tests/system/isctest/vars/.ac_vars/CURL.in new file mode 100644 index 0000000000..0772e63bb0 --- /dev/null +++ b/bin/tests/system/isctest/vars/.ac_vars/CURL.in @@ -0,0 +1 @@ +@CURL@ diff --git a/bin/tests/system/isctest/vars/.ac_vars/FSTRM_CAPTURE.in b/bin/tests/system/isctest/vars/.ac_vars/FSTRM_CAPTURE.in new file mode 100644 index 0000000000..d6b9931d01 --- /dev/null +++ b/bin/tests/system/isctest/vars/.ac_vars/FSTRM_CAPTURE.in @@ -0,0 +1 @@ +@FSTRM_CAPTURE@ diff --git a/bin/tests/system/isctest/vars/.ac_vars/NC.in b/bin/tests/system/isctest/vars/.ac_vars/NC.in new file mode 100644 index 0000000000..b1181ca7dc --- /dev/null +++ b/bin/tests/system/isctest/vars/.ac_vars/NC.in @@ -0,0 +1 @@ +@NC@ diff --git a/bin/tests/system/isctest/vars/.ac_vars/PERL.in b/bin/tests/system/isctest/vars/.ac_vars/PERL.in new file mode 100644 index 0000000000..f6644c1d08 --- /dev/null +++ b/bin/tests/system/isctest/vars/.ac_vars/PERL.in @@ -0,0 +1 @@ +@PERL@ diff --git a/bin/tests/system/isctest/vars/.ac_vars/PYTEST.in b/bin/tests/system/isctest/vars/.ac_vars/PYTEST.in new file mode 100644 index 0000000000..f6700d5f65 --- /dev/null +++ b/bin/tests/system/isctest/vars/.ac_vars/PYTEST.in @@ -0,0 +1 @@ +@PYTEST@ diff --git a/bin/tests/system/isctest/vars/.ac_vars/PYTHON.in b/bin/tests/system/isctest/vars/.ac_vars/PYTHON.in new file mode 100644 index 0000000000..5d697c390e --- /dev/null +++ b/bin/tests/system/isctest/vars/.ac_vars/PYTHON.in @@ -0,0 +1 @@ +@PYTHON@ diff --git a/bin/tests/system/isctest/vars/.ac_vars/SHELL.in b/bin/tests/system/isctest/vars/.ac_vars/SHELL.in new file mode 100644 index 0000000000..e65178bcca --- /dev/null +++ b/bin/tests/system/isctest/vars/.ac_vars/SHELL.in @@ -0,0 +1 @@ +@SHELL@ diff --git a/bin/tests/system/isctest/vars/.ac_vars/TOP_BUILDDIR.in b/bin/tests/system/isctest/vars/.ac_vars/TOP_BUILDDIR.in new file mode 100644 index 0000000000..ad1e3ece17 --- /dev/null +++ b/bin/tests/system/isctest/vars/.ac_vars/TOP_BUILDDIR.in @@ -0,0 +1 @@ +@abs_top_builddir@ diff --git a/bin/tests/system/isctest/vars/.ac_vars/TOP_SRCDIR.in b/bin/tests/system/isctest/vars/.ac_vars/TOP_SRCDIR.in new file mode 100644 index 0000000000..ab6784b0e5 --- /dev/null +++ b/bin/tests/system/isctest/vars/.ac_vars/TOP_SRCDIR.in @@ -0,0 +1 @@ +@abs_top_srcdir@ diff --git a/bin/tests/system/isctest/vars/.ac_vars/XSLTPROC.in b/bin/tests/system/isctest/vars/.ac_vars/XSLTPROC.in new file mode 100644 index 0000000000..86d98e0a10 --- /dev/null +++ b/bin/tests/system/isctest/vars/.ac_vars/XSLTPROC.in @@ -0,0 +1 @@ +@XSLTPROC@ diff --git a/bin/tests/system/isctest/vars/autoconf.py b/bin/tests/system/isctest/vars/autoconf.py new file mode 100644 index 0000000000..7000ef2d72 --- /dev/null +++ b/bin/tests/system/isctest/vars/autoconf.py @@ -0,0 +1,29 @@ +# 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. + +from pathlib import Path +from typing import Dict + + +def load_ac_vars_from_files() -> Dict[str, str]: + ac_vars = {} + ac_vars_dir = Path(__file__).resolve().parent / ".ac_vars" + var_paths = [ + path + for path in ac_vars_dir.iterdir() + if path.is_file() and not path.name.endswith(".in") + ] + for var_path in var_paths: + ac_vars[var_path.name] = var_path.read_text(encoding="utf-8").strip() + return ac_vars + + +AC_VARS = load_ac_vars_from_files() diff --git a/bin/tests/system/isctest/vars/autoconf.py.in b/bin/tests/system/isctest/vars/autoconf.py.in deleted file mode 100644 index 5f1741bd73..0000000000 --- a/bin/tests/system/isctest/vars/autoconf.py.in +++ /dev/null @@ -1,23 +0,0 @@ -# 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. - -AC_VARS = { - "TOP_BUILDDIR": "@abs_top_builddir@", - "TOP_SRCDIR": "@abs_top_srcdir@", - "FSTRM_CAPTURE": "@FSTRM_CAPTURE@", - "SHELL": "@SHELL@", - "PYTHON": "@PYTHON@", - "PERL": "@PERL@", - "CURL": "@CURL@", - "NC": "@NC@", - "XSLTPROC": "@XSLTPROC@", - "PYTEST": "@PYTEST@", -} diff --git a/configure.ac b/configure.ac index 31c965697c..bf7405cc1b 100644 --- a/configure.ac +++ b/configure.ac @@ -1656,7 +1656,16 @@ AC_CONFIG_FILES([tests/unit-test-driver.sh], AC_CONFIG_FILES([bin/tests/Makefile bin/tests/system/Makefile - bin/tests/system/isctest/vars/autoconf.py + bin/tests/system/isctest/vars/.ac_vars/TOP_BUILDDIR + bin/tests/system/isctest/vars/.ac_vars/TOP_SRCDIR + bin/tests/system/isctest/vars/.ac_vars/FSTRM_CAPTURE + bin/tests/system/isctest/vars/.ac_vars/SHELL + bin/tests/system/isctest/vars/.ac_vars/PYTHON + bin/tests/system/isctest/vars/.ac_vars/PERL + bin/tests/system/isctest/vars/.ac_vars/CURL + bin/tests/system/isctest/vars/.ac_vars/NC + bin/tests/system/isctest/vars/.ac_vars/XSLTPROC + bin/tests/system/isctest/vars/.ac_vars/PYTEST bin/tests/system/dyndb/driver/Makefile bin/tests/system/dlzexternal/driver/Makefile bin/tests/system/hooks/driver/Makefile