Use a dedicated file for each autoconf variable

To avoid any escaping issues or messing with a language-specific format
when the variable has to be parsed, create a dedicated file for each
variable that is obtained from autoconf.
This commit is contained in:
Tom Krizek
2024-03-25 14:56:08 +01:00
committed by Nicki Křížek
parent b99cdfab9d
commit 2a09f632ab
16 changed files with 54 additions and 27 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -0,0 +1 @@
@CURL@

View File

@@ -0,0 +1 @@
@FSTRM_CAPTURE@

View File

@@ -0,0 +1 @@
@NC@

View File

@@ -0,0 +1 @@
@PERL@

View File

@@ -0,0 +1 @@
@PYTEST@

View File

@@ -0,0 +1 @@
@PYTHON@

View File

@@ -0,0 +1 @@
@SHELL@

View File

@@ -0,0 +1 @@
@abs_top_builddir@

View File

@@ -0,0 +1 @@
@abs_top_srcdir@

View File

@@ -0,0 +1 @@
@XSLTPROC@

View File

@@ -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()

View File

@@ -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@",
}

View File

@@ -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