]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Export env variables in system tests
authorTom Krizek <tkrizek@isc.org>
Tue, 25 Oct 2022 16:00:27 +0000 (18:00 +0200)
committerTom Krizek <tkrizek@isc.org>
Tue, 1 Nov 2022 18:51:52 +0000 (19:51 +0100)
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.

(cherry picked from commit 37d14c69c050a6c2bc0ebbbdc80a788bb6795b7e)

bin/tests/system/conf.sh.common
bin/tests/system/conf.sh.in

index 8860ab2fee1ed2adcdd9ddb6bf244f0560ee6f5a..298126418ba5ac418058e8bca17e3dcc417b0bd5 100644 (file)
@@ -148,25 +148,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
@@ -280,26 +280,26 @@ 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.
-DEFAULT_HMAC=hmac-sha256
+export DEFAULT_HMAC=hmac-sha256
 
 #
 # Useful functions in test scripts
@@ -716,49 +716,3 @@ copy_setports() {
         -e "s/${atsign}DISABLED_BITS${atsign}/${DISABLED_BITS}/g" \
         $1 > $2
 }
-
-#
-# Export command paths
-#
-export ARPANAME
-export BIGKEY
-export CDS
-export CHECKZONE
-export CYGWIN
-export DESCRIPTION
-export DIG
-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 PK11DEL
-export PK11GEN
-export PK11LIST
-export PSSUSPEND
-export PYTHON
-export RESOLVE
-export RNDC
-export RRCHECKER
-export SIGNER
-export SUBDIRS
-export TMPDIR
-export TSIGKEYGEN
-export VERIFY
-export WIRETEST
index b9641c42b2d91fd65b79f00ca8820f40bc1d2e9d..bde33520a8c4798bfb539331ed11e4e71776aac7 100644 (file)
 #
 
 # Find the top of the BIND9 tree.
-TOP=@abs_top_builddir@
-TOP_SRCDIR=@abs_top_srcdir@
+export TOP=@abs_top_builddir@
+export TOP_SRCDIR=@abs_top_srcdir@
 
 # Provide TMPDIR variable for tests that need it.
-TMPDIR=${TMPDIR:-/tmp}
+export TMPDIR=${TMPDIR:-/tmp}
 
 # This is not the windows build.
-CYGWIN=""
+export CYGWIN=""
 
 # Load common values shared between windows and unix/linux.
 . $TOP/bin/tests/system/conf.sh.common
 
-ARPANAME=$TOP/bin/tools/arpaname
-CDS=$TOP/bin/dnssec/dnssec-cds
-CHECKCONF=$TOP/bin/check/named-checkconf
-CHECKDS=$TOP/bin/python/dnssec-checkds
-CHECKZONE=$TOP/bin/check/named-checkzone
-COVERAGE=$TOP/bin/python/dnssec-coverage
-DDNSCONFGEN=$TOP/bin/confgen/ddns-confgen
-DELV=$TOP/bin/delv/delv
-DIG=$TOP/bin/dig/dig
-DNSTAPREAD=$TOP/bin/tools/dnstap-read
-DSFROMKEY=$TOP/bin/dnssec/dnssec-dsfromkey
-FEATURETEST=$TOP/bin/tests/system/feature-test
-FSTRM_CAPTURE=@FSTRM_CAPTURE@
-HOST=$TOP/bin/dig/host
-IMPORTKEY=$TOP/bin/dnssec/dnssec-importkey
-JOURNALPRINT=$TOP/bin/tools/named-journalprint
-KEYFRLAB=$TOP/bin/dnssec/dnssec-keyfromlabel
-KEYGEN=$TOP/bin/dnssec/dnssec-keygen
-KEYMGR=$TOP/bin/python/dnssec-keymgr
-MDIG=$TOP/bin/tools/mdig
-NAMED=$TOP/bin/named/named
-NSEC3HASH=$TOP/bin/tools/nsec3hash
-NSLOOKUP=$TOP/bin/dig/nslookup
-NSUPDATE=$TOP/bin/nsupdate/nsupdate
-NZD2NZF=$TOP/bin/tools/named-nzd2nzf
-PK11DEL="$TOP/bin/pkcs11/pkcs11-destroy -s ${SLOT:-0} -p ${HSMPIN:-1234} -w 0"
-PK11GEN="$TOP/bin/pkcs11/pkcs11-keygen -q -s ${SLOT:-0} -p ${HSMPIN:-1234}"
-PK11LIST="$TOP/bin/pkcs11/pkcs11-list -s ${SLOT:-0} -p ${HSMPIN:-1234}"
-RESOLVE=$TOP/bin/tests/system/resolve
-REVOKE=$TOP/bin/dnssec/dnssec-revoke
-RNDC=$TOP/bin/rndc/rndc
-RNDCCONFGEN=$TOP/bin/confgen/rndc-confgen
-RRCHECKER=$TOP/bin/tools/named-rrchecker
-SETTIME=$TOP/bin/dnssec/dnssec-settime
-SIGNER=$TOP/bin/dnssec/dnssec-signzone
-TSIGKEYGEN=$TOP/bin/confgen/tsig-keygen
-VERIFY=$TOP/bin/dnssec/dnssec-verify
-WIRETEST=$TOP/bin/tests/wire_test
-
-BIGKEY=$TOP/bin/tests/system/rsabigexponent/bigkey
-GENCHECK=$TOP/bin/tests/system/rndc/gencheck
-KEYCREATE=$TOP/bin/tests/system/tkey/keycreate
-KEYDELETE=$TOP/bin/tests/system/tkey/keydelete
-MAKEJOURNAL=$TOP/bin/tests/makejournal
-PIPEQUERIES=$TOP/bin/tests/system/pipelined/pipequeries
+export ARPANAME=$TOP/bin/tools/arpaname
+export CDS=$TOP/bin/dnssec/dnssec-cds
+export CHECKCONF=$TOP/bin/check/named-checkconf
+export CHECKDS=$TOP/bin/python/dnssec-checkds
+export CHECKZONE=$TOP/bin/check/named-checkzone
+export COVERAGE=$TOP/bin/python/dnssec-coverage
+export DDNSCONFGEN=$TOP/bin/confgen/ddns-confgen
+export DELV=$TOP/bin/delv/delv
+export DIG=$TOP/bin/dig/dig
+export DNSTAPREAD=$TOP/bin/tools/dnstap-read
+export DSFROMKEY=$TOP/bin/dnssec/dnssec-dsfromkey
+export FEATURETEST=$TOP/bin/tests/system/feature-test
+export FSTRM_CAPTURE=@FSTRM_CAPTURE@
+export HOST=$TOP/bin/dig/host
+export IMPORTKEY=$TOP/bin/dnssec/dnssec-importkey
+export JOURNALPRINT=$TOP/bin/tools/named-journalprint
+export KEYFRLAB=$TOP/bin/dnssec/dnssec-keyfromlabel
+export KEYGEN=$TOP/bin/dnssec/dnssec-keygen
+export KEYMGR=$TOP/bin/python/dnssec-keymgr
+export MDIG=$TOP/bin/tools/mdig
+export NAMED=$TOP/bin/named/named
+export NSEC3HASH=$TOP/bin/tools/nsec3hash
+export NSLOOKUP=$TOP/bin/dig/nslookup
+export NSUPDATE=$TOP/bin/nsupdate/nsupdate
+export NZD2NZF=$TOP/bin/tools/named-nzd2nzf
+export PK11DEL="$TOP/bin/pkcs11/pkcs11-destroy -s ${SLOT:-0} -p ${HSMPIN:-1234} -w 0"
+export PK11GEN="$TOP/bin/pkcs11/pkcs11-keygen -q -s ${SLOT:-0} -p ${HSMPIN:-1234}"
+export PK11LIST="$TOP/bin/pkcs11/pkcs11-list -s ${SLOT:-0} -p ${HSMPIN:-1234}"
+export RESOLVE=$TOP/bin/tests/system/resolve
+export REVOKE=$TOP/bin/dnssec/dnssec-revoke
+export RNDC=$TOP/bin/rndc/rndc
+export RNDCCONFGEN=$TOP/bin/confgen/rndc-confgen
+export RRCHECKER=$TOP/bin/tools/named-rrchecker
+export SETTIME=$TOP/bin/dnssec/dnssec-settime
+export SIGNER=$TOP/bin/dnssec/dnssec-signzone
+export TSIGKEYGEN=$TOP/bin/confgen/tsig-keygen
+export VERIFY=$TOP/bin/dnssec/dnssec-verify
+export WIRETEST=$TOP/bin/tests/wire_test
+
+export BIGKEY=$TOP/bin/tests/system/rsabigexponent/bigkey
+export GENCHECK=$TOP/bin/tests/system/rndc/gencheck
+export KEYCREATE=$TOP/bin/tests/system/tkey/keycreate
+export KEYDELETE=$TOP/bin/tests/system/tkey/keydelete
+export MAKEJOURNAL=$TOP/bin/tests/makejournal
+export PIPEQUERIES=$TOP/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
@@ -93,45 +93,43 @@ SUBDIRS="$SEQUENTIALDIRS $PARALLELDIRS"
 
 
 # Things that are different on Windows
-KILL=kill
-DIFF=diff
-DOS2UNIX=true
+export KILL=kill
+export DIFF=diff
+export DOS2UNIX=true
 # There's no trailing period on Windows
-TP=.
+export TP=.
 
 # 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@
 
 # 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=@PERL@
+export PERL=@PERL@
 
 # Windows process management leave empty
-PSSUSPEND=
+export PSSUSPEND=
 
-PYTHON=@PYTHON@
-PYTEST=@PYTEST@
+export PYTHON=@PYTHON@
+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}
-NZD=@NZD_TOOLS@
-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 NZD=@NZD_TOOLS@
+export CRYPTO=@CRYPTO@