2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-31 22:45:39 +00:00

Export env variables in system tests

Certain variables have to be exported in order for the system tests to
work. It makes little sense to export the variables in one place/script
while they're defined in another place.

Since it makes no harm, export all the variables to make the behaviour
more predictable and consistent. Previously, some variables were
exported as environment variables, while others were just shell
variables which could be used once the configuration was sourced from
another script. However, they wouldn't be exposed to spawned processes.

For simplicity sake (and for the upcoming effort to run system tests
with pytest), export all variables that are used. TESTS, PARALLEL_UNIX
and SUBDIRS variables are automake-specific, aren't used anywhere else
and thus not exported.
This commit is contained in:
Tom Krizek
2022-10-25 18:00:27 +02:00
parent bb1c6bbdc7
commit 37d14c69c0
2 changed files with 85 additions and 128 deletions

View File

@@ -131,25 +131,25 @@ zonechecks"
# Set up color-coded test output
#
if [ ${SYSTEMTEST_FORCE_COLOR:-0} -eq 1 ] || test -t 1 && type tput > /dev/null 2>&1 && tput setaf 7 > /dev/null 2>&1 ; then
COLOR_END=`tput setaf 4` # blue
COLOR_FAIL=`tput setaf 1` # red
COLOR_INFO=`tput bold` # bold
COLOR_NONE=`tput sgr0`
COLOR_PASS=`tput setaf 2` # green
COLOR_START=`tput setaf 4` # blue
COLOR_WARN=`tput setaf 3` # yellow
export COLOR_END=`tput setaf 4` # blue
export COLOR_FAIL=`tput setaf 1` # red
export COLOR_INFO=`tput bold` # bold
export COLOR_NONE=`tput sgr0`
export COLOR_PASS=`tput setaf 2` # green
export COLOR_START=`tput setaf 4` # blue
export COLOR_WARN=`tput setaf 3` # yellow
else
# set to empty strings so printf succeeds
COLOR_END=''
COLOR_FAIL=''
COLOR_INFO=''
COLOR_NONE=''
COLOR_PASS=''
COLOR_START=''
COLOR_WARN=''
export COLOR_END=''
export COLOR_FAIL=''
export COLOR_INFO=''
export COLOR_NONE=''
export COLOR_PASS=''
export COLOR_START=''
export COLOR_WARN=''
fi
SYSTESTDIR="`basename $PWD`"
export SYSTESTDIR="`basename $PWD`"
if type printf > /dev/null 2>&1
then
@@ -263,27 +263,27 @@ send() {
#
# Default algorithm for testing.
DEFAULT_ALGORITHM=ECDSAP256SHA256
DEFAULT_ALGORITHM_NUMBER=13
DEFAULT_BITS=256
export DEFAULT_ALGORITHM=ECDSAP256SHA256
export DEFAULT_ALGORITHM_NUMBER=13
export DEFAULT_BITS=256
# This is an alternative algorithm for test cases that require more than
# one algorithm (for example algorithm rollover). Must be different from
# DEFAULT_ALGORITHM.
ALTERNATIVE_ALGORITHM=RSASHA256
ALTERNATIVE_ALGORITHM_NUMBER=8
ALTERNATIVE_BITS=1280
export ALTERNATIVE_ALGORITHM=RSASHA256
export ALTERNATIVE_ALGORITHM_NUMBER=8
export ALTERNATIVE_BITS=1280
# This is an algorithm that is used for tests against the
# "disable-algorithms" configuration option. Must be different from above
# algorithms.
DISABLED_ALGORITHM=ECDSAP384SHA384
DISABLED_ALGORITHM_NUMBER=14
DISABLED_BITS=384
export DISABLED_ALGORITHM=ECDSAP384SHA384
export DISABLED_ALGORITHM_NUMBER=14
export DISABLED_BITS=384
# Default HMAC algorithm.
# also update common/rndc.conf and common/rndc.key when updating DEFAULT_HMAC
DEFAULT_HMAC=hmac-sha256
export DEFAULT_HMAC=hmac-sha256
#
# Useful functions in test scripts
@@ -719,44 +719,3 @@ copy_setports() {
-e "s/@DISABLED_BITS@/${DISABLED_BITS}/g" \
$1 > $2
}
#
# Export command paths
#
export ARPANAME
export BIGKEY
export CDS
export CHECKZONE
export DESCRIPTION
export DIG
export DNSTAPREAD
export FEATURETEST
export FSTRM_CAPTURE
export GENCHECK
export JOURNALPRINT
export KEYCREATE
export KEYDELETE
export KEYFRLAB
export KEYGEN
export KEYSETTOOL
export KEYSIGNER
export KRB5_CONFIG
export KRB5_KTNAME
export MAKEJOURNAL
export MDIG
export NAMED
export NSEC3HASH
export NSLOOKUP
export NSUPDATE
export NZD2NZF
export PERL
export PIPEQUERIES
export PYTHON
export RNDC
export RRCHECKER
export SIGNER
export SUBDIRS
export TMPDIR
export TSIGKEYGEN
export VERIFY
export WIRETEST

View File

@@ -17,57 +17,57 @@
#
# Find the top of the BIND9 tree.
TOP_BUILDDIR=@abs_top_builddir@
TOP_SRCDIR=@abs_top_srcdir@
export TOP_BUILDDIR=@abs_top_builddir@
export TOP_SRCDIR=@abs_top_srcdir@
# Provide TMPDIR variable for tests that need it.
TMPDIR=${TMPDIR:-/tmp}
export TMPDIR=${TMPDIR:-/tmp}
# Load common values
. $TOP_SRCDIR/bin/tests/system/conf.sh.common
ARPANAME=$TOP_BUILDDIR/bin/tools/arpaname
CDS=$TOP_BUILDDIR/bin/dnssec/dnssec-cds
CHECKCONF=$TOP_BUILDDIR/bin/check/named-checkconf
CHECKZONE=$TOP_BUILDDIR/bin/check/named-checkzone
DELV=$TOP_BUILDDIR/bin/delv/delv
DIG=$TOP_BUILDDIR/bin/dig/dig
DNSTAPREAD=$TOP_BUILDDIR/bin/tools/dnstap-read
DSFROMKEY=$TOP_BUILDDIR/bin/dnssec/dnssec-dsfromkey
FEATURETEST=$TOP_BUILDDIR/bin/tests/system/feature-test
FSTRM_CAPTURE=@FSTRM_CAPTURE@
HOST=$TOP_BUILDDIR/bin/dig/host
IMPORTKEY=$TOP_BUILDDIR/bin/dnssec/dnssec-importkey
JOURNALPRINT=$TOP_BUILDDIR/bin/tools/named-journalprint
KEYFRLAB=$TOP_BUILDDIR/bin/dnssec/dnssec-keyfromlabel
KEYGEN=$TOP_BUILDDIR/bin/dnssec/dnssec-keygen
MDIG=$TOP_BUILDDIR/bin/tools/mdig
NAMED=$TOP_BUILDDIR/bin/named/named
NSEC3HASH=$TOP_BUILDDIR/bin/tools/nsec3hash
NSLOOKUP=$TOP_BUILDDIR/bin/dig/nslookup
NSUPDATE=$TOP_BUILDDIR/bin/nsupdate/nsupdate
NZD2NZF=$TOP_BUILDDIR/bin/tools/named-nzd2nzf
REVOKE=$TOP_BUILDDIR/bin/dnssec/dnssec-revoke
RNDC=$TOP_BUILDDIR/bin/rndc/rndc
RNDCCONFGEN=$TOP_BUILDDIR/bin/confgen/rndc-confgen
RRCHECKER=$TOP_BUILDDIR/bin/tools/named-rrchecker
SETTIME=$TOP_BUILDDIR/bin/dnssec/dnssec-settime
SIGNER=$TOP_BUILDDIR/bin/dnssec/dnssec-signzone
TSIGKEYGEN=$TOP_BUILDDIR/bin/confgen/tsig-keygen
VERIFY=$TOP_BUILDDIR/bin/dnssec/dnssec-verify
WIRETEST=$TOP_BUILDDIR/bin/tests/wire_test
export ARPANAME=$TOP_BUILDDIR/bin/tools/arpaname
export CDS=$TOP_BUILDDIR/bin/dnssec/dnssec-cds
export CHECKCONF=$TOP_BUILDDIR/bin/check/named-checkconf
export CHECKZONE=$TOP_BUILDDIR/bin/check/named-checkzone
export DELV=$TOP_BUILDDIR/bin/delv/delv
export DIG=$TOP_BUILDDIR/bin/dig/dig
export DNSTAPREAD=$TOP_BUILDDIR/bin/tools/dnstap-read
export DSFROMKEY=$TOP_BUILDDIR/bin/dnssec/dnssec-dsfromkey
export FEATURETEST=$TOP_BUILDDIR/bin/tests/system/feature-test
export FSTRM_CAPTURE=@FSTRM_CAPTURE@
export HOST=$TOP_BUILDDIR/bin/dig/host
export IMPORTKEY=$TOP_BUILDDIR/bin/dnssec/dnssec-importkey
export JOURNALPRINT=$TOP_BUILDDIR/bin/tools/named-journalprint
export KEYFRLAB=$TOP_BUILDDIR/bin/dnssec/dnssec-keyfromlabel
export KEYGEN=$TOP_BUILDDIR/bin/dnssec/dnssec-keygen
export MDIG=$TOP_BUILDDIR/bin/tools/mdig
export NAMED=$TOP_BUILDDIR/bin/named/named
export NSEC3HASH=$TOP_BUILDDIR/bin/tools/nsec3hash
export NSLOOKUP=$TOP_BUILDDIR/bin/dig/nslookup
export NSUPDATE=$TOP_BUILDDIR/bin/nsupdate/nsupdate
export NZD2NZF=$TOP_BUILDDIR/bin/tools/named-nzd2nzf
export REVOKE=$TOP_BUILDDIR/bin/dnssec/dnssec-revoke
export RNDC=$TOP_BUILDDIR/bin/rndc/rndc
export RNDCCONFGEN=$TOP_BUILDDIR/bin/confgen/rndc-confgen
export RRCHECKER=$TOP_BUILDDIR/bin/tools/named-rrchecker
export SETTIME=$TOP_BUILDDIR/bin/dnssec/dnssec-settime
export SIGNER=$TOP_BUILDDIR/bin/dnssec/dnssec-signzone
export TSIGKEYGEN=$TOP_BUILDDIR/bin/confgen/tsig-keygen
export VERIFY=$TOP_BUILDDIR/bin/dnssec/dnssec-verify
export WIRETEST=$TOP_BUILDDIR/bin/tests/wire_test
BIGKEY=$TOP_BUILDDIR/bin/tests/system/rsabigexponent/bigkey
GENCHECK=$TOP_BUILDDIR/bin/tests/system/rndc/gencheck
KEYCREATE=$TOP_BUILDDIR/bin/tests/system/tkey/keycreate
KEYDELETE=$TOP_BUILDDIR/bin/tests/system/tkey/keydelete
MAKEJOURNAL=$TOP_BUILDDIR/bin/tests/system/makejournal
PIPEQUERIES=$TOP_BUILDDIR/bin/tests/system/pipelined/pipequeries
export BIGKEY=$TOP_BUILDDIR/bin/tests/system/rsabigexponent/bigkey
export GENCHECK=$TOP_BUILDDIR/bin/tests/system/rndc/gencheck
export KEYCREATE=$TOP_BUILDDIR/bin/tests/system/tkey/keycreate
export KEYDELETE=$TOP_BUILDDIR/bin/tests/system/tkey/keydelete
export MAKEJOURNAL=$TOP_BUILDDIR/bin/tests/system/makejournal
export PIPEQUERIES=$TOP_BUILDDIR/bin/tests/system/pipelined/pipequeries
# we don't want a KRB5_CONFIG setting breaking the tests
KRB5_CONFIG=/dev/null
export KRB5_CONFIG=/dev/null
# use local keytab instead of default /etc/krb5.keytab
KRB5_KTNAME=dns.keytab
export KRB5_KTNAME=dns.keytab
#
# Construct the lists of tests to run
@@ -94,39 +94,37 @@ tcp"
SUBDIRS="$PARALLEL_COMMON $PARALLEL_UNIX"
# Use the CONFIG_SHELL detected by configure for tests
SHELL=@SHELL@
export SHELL=@SHELL@
# CURL will be empty if no program was found by configure
CURL=@CURL@
export CURL=@CURL@
# NC will be empty if no program was found by configure
NC=@NC@
export NC=@NC@
# XMLLINT will be empty if no program was found by configure
XMLLINT=@XMLLINT@
export XMLLINT=@XMLLINT@
# XSLTPROC will be empty if no program was found by configure
XSLTPROC=@XSLTPROC@
export XSLTPROC=@XSLTPROC@
# PERL will be an empty string if no perl interpreter was found.
PERL=$(command -v "@PERL@")
export PERL=$(command -v "@PERL@")
PYTHON=$(command -v "@PYTHON@" || true)
PYTEST=@PYTEST@
export PYTHON=$(command -v "@PYTHON@" || true)
export PYTEST=@PYTEST@
#
# Determine if we support various optional features.
#
LIBXML2_LIBS="@LIBXML2_LIBS@"
HAVEXMLSTATS=${LIBXML2_LIBS:+1}
JSON_C_LIBS="@JSON_C_LIBS@"
HAVEJSONSTATS=${JSON_C_LIBS:+1}
MAXMINDDB_LIBS="@MAXMINDDB_LIBS@"
HAVEGEOIP2=${MAXMINDDB_LIBS:+1}
ZLIB_LIBS="@ZLIB_LIBS@"
HAVEZLIB=${ZLIB_LIBS:+1}
LMDB_LIBS="@LMDB_LIBS@"
NZD=${LMDB_LIBS:+1}
CRYPTO=@CRYPTO@
export HAVEXMLSTATS HAVEJSONSTATS
export LIBXML2_LIBS="@LIBXML2_LIBS@"
export HAVEXMLSTATS=${LIBXML2_LIBS:+1}
export JSON_C_LIBS="@JSON_C_LIBS@"
export HAVEJSONSTATS=${JSON_C_LIBS:+1}
export MAXMINDDB_LIBS="@MAXMINDDB_LIBS@"
export HAVEGEOIP2=${MAXMINDDB_LIBS:+1}
export ZLIB_LIBS="@ZLIB_LIBS@"
export HAVEZLIB=${ZLIB_LIBS:+1}
export LMDB_LIBS="@LMDB_LIBS@"
export NZD=${LMDB_LIBS:+1}
export CRYPTO=@CRYPTO@