Move algorithm variables, add disabled algorithms

Move from conf.sh.in to conf.sh.common as they will also need to be
added to conf.sh.win32.  Add variables for testing disabled
algorithms.
This commit is contained in:
Matthijs Mekking 2019-01-15 10:39:08 +01:00
parent 924fdad0e5
commit 07c35f32f9
3 changed files with 61 additions and 78 deletions

View file

@ -127,6 +127,29 @@ digcomp() {
return $result
}
#
# Useful variables in test scripts
#
# Default algorithm for testing.
DEFAULT_ALGORITHM=ECDSAP256SHA256
DEFAULT_ALGORITHM_NUMBER=13
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
# 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
#
# Useful functions in test scripts
#
@ -279,6 +302,44 @@ get_named_xfer_stats() {
echo "messages=`grep "${PEER}" "${LOGFILE}" | sed -n "s/.*${ZONE}.* \([0-9][0-9]*\) messages.*/\1/p" | tail -1`"
echo "records=`grep "${PEER}" "${LOGFILE}" | sed -n "s/.*${ZONE}.* \([0-9][0-9]*\) records.*/\1/p" | tail -1`"
echo "bytes=`grep "${PEER}" "${LOGFILE}" | sed -n "s/.*${ZONE}.* \([0-9][0-9]*\) bytes.*/\1/p" | tail -1`"
# copy_setports - Copy Configuration File and Replace Ports
#
# Convenience function to copy a configuration file, replacing the tokens
# QUERYPORT, CONTROLPORT and EXTRAPORT[1-8] with the values of the equivalent
# environment variables. (These values are set by "run.sh", which calls the
# scripts invoking this function.)
#
# Usage:
# copy_setports infile outfile
#
copy_setports() {
# The indirect method of handling the substitution of the PORT variables
# (defining "atsign" then substituting for it in the "sed" statement) is
# required to prevent the "Configure" script (in the win32utils/ directory)
# from replacing the <at>PORT<at> substitution tokens when it processes
# this file and produces conf.sh.
atsign="@"
sed -e "s/${atsign}PORT${atsign}/${PORT}/g" \
-e "s/${atsign}EXTRAPORT1${atsign}/${EXTRAPORT1}/g" \
-e "s/${atsign}EXTRAPORT2${atsign}/${EXTRAPORT2}/g" \
-e "s/${atsign}EXTRAPORT3${atsign}/${EXTRAPORT3}/g" \
-e "s/${atsign}EXTRAPORT4${atsign}/${EXTRAPORT4}/g" \
-e "s/${atsign}EXTRAPORT5${atsign}/${EXTRAPORT5}/g" \
-e "s/${atsign}EXTRAPORT6${atsign}/${EXTRAPORT6}/g" \
-e "s/${atsign}EXTRAPORT7${atsign}/${EXTRAPORT7}/g" \
-e "s/${atsign}EXTRAPORT8${atsign}/${EXTRAPORT8}/g" \
-e "s/${atsign}CONTROLPORT${atsign}/${CONTROLPORT}/g" \
-e "s/${atsign}DEFAULT_ALGORITHM${atsign}/${DEFAULT_ALGORITHM}/g" \
-e "s/${atsign}DEFAULT_ALGORITHM_NUMBER${atsign}/${DEFAULT_ALGORITHM_NUMBER}/g" \
-e "s/${atsign}DEFAULT_BITS${atsign}/${DEFAULT_BITS}/g" \
-e "s/${atsign}ALTERNATIVE_ALGORITHM${atsign}/${ALTERNATIVE_ALGORITHM}/g" \
-e "s/${atsign}ALTERNATIVE_ALGORITHM_NUMBER${atsign}/${ALTERNATIVE_ALGORITHM_NUMBER}/g" \
-e "s/${atsign}ALTERNATIVE_BITS${atsign}/${ALTERNATIVE_BITS}/g" \
-e "s/${atsign}DISABLED_ALGORITHM${atsign}/${DISABLED_ALGORITHM}/g" \
-e "s/${atsign}DISABLED_ALGORITHM_NUMBER${atsign}/${DISABLED_ALGORITHM_NUMBER}/g" \
-e "s/${atsign}DISABLED_BITS${atsign}/${DISABLED_BITS}/g" \
$1 > $2
}
#

View file

@ -17,16 +17,6 @@
# Find the top of the BIND9 tree.
TOP=@abs_top_builddir@
# Default algorithm for testing
DEFAULT_ALGORITHM=ECDSAP256SHA256
DEFAULT_ALGORITHM_NUMBER=13
DEFAULT_BITS=256
# must be different from DEFAULT_ALGORITHM
ALTERNATIVE_ALGORITHM=RSASHA256
ALTERNATIVE_ALGORITHM_NUMBER=8
ALTERNATIVE_BITS=1280
ARPANAME=$TOP/bin/tools/arpaname
CDS=$TOP/bin/dnssec/dnssec-cds
CHECKCONF=$TOP/bin/check/named-checkconf
@ -146,36 +136,5 @@ HAVEJSONSTATS=@JSONSTATS@
ZLIB=@ZLIB@
NZD=@NZD_TOOLS@
# copy_setports - Copy Configuration File and Replace Ports
# Unfortunately it has to be different on Windows.
#
# Convenience function to copy a configuration file, replacing the tokens
# QUERYPORT, CONTROLPORT and EXTRAPORT[1-8] with the values of the equivalent
# environment variables. (These values are set by "run.sh", which calls the
# scripts invoking this function.)
#
# Usage:
# copy_setports infile outfile
copy_setports() {
sed -e "s/@PORT@/${PORT}/g" \
-e "s/@EXTRAPORT1@/${EXTRAPORT1}/g" \
-e "s/@EXTRAPORT2@/${EXTRAPORT2}/g" \
-e "s/@EXTRAPORT3@/${EXTRAPORT3}/g" \
-e "s/@EXTRAPORT4@/${EXTRAPORT4}/g" \
-e "s/@EXTRAPORT5@/${EXTRAPORT5}/g" \
-e "s/@EXTRAPORT6@/${EXTRAPORT6}/g" \
-e "s/@EXTRAPORT7@/${EXTRAPORT7}/g" \
-e "s/@EXTRAPORT8@/${EXTRAPORT8}/g" \
-e "s/@CONTROLPORT@/${CONTROLPORT}/g" \
-e "s/@DEFAULT_ALGORITHM@/${DEFAULT_ALGORITHM}/g" \
-e "s/@DEFAULT_ALGORITHM_NUMBER@/${DEFAULT_ALGORITHM_NUMBER}/g" \
-e "s/@DEFAULT_BITS@/${DEFAULT_BITS}/g" \
-e "s/@ALTERNATIVE_ALGORITHM@/${ALTERNATIVE_ALGORITHM}/g" \
-e "s/@ALTERNATIVE_ALGORITHM_NUMBER@/${ALTERNATIVE_ALGORITHM_NUMBER}/g" \
-e "s/@ALTERNATIVE_BITS@/${ALTERNATIVE_BITS}/g" \
$1 > $2
}
# The rest is shared between Windows and Unices
. $TOP/bin/tests/system/conf.sh.common

View file

@ -158,42 +158,5 @@ HAVEJSONSTATS=@JSONSTATS@
ZLIB=@ZLIB@
NZD=@NZD_TOOLS@
# copy_setports - Copy Configuration File and Replace Ports
# Unfortunately it has to be different on Windows.
#
# Convenience function to copy a configuration file, replacing the tokens
# QUERYPORT, CONTROLPORT and EXTRAPORT[1-8] with the values of the equivalent
# environment variables. (These values are set by "run.sh", which calls the
# scripts invoking this function.)
#
# Usage:
# copy_setports infile outfile
copy_setports() {
# The indirect method of handling the substitution of the PORT variables
# (defining "atsign" then substituting for it in the "sed" statement) is
# required because to prevent the "Configure" script (in the the
# bin9/win32utils directory) replacing the the <at>PORT<at> substitution
# tokens when it processes this file and produces conf.sh.
atsign="@"
sed -e "s/${atsign}PORT${atsign}/${PORT}/g" \
-e "s/${atsign}EXTRAPORT1${atsign}/${EXTRAPORT1}/g" \
-e "s/${atsign}EXTRAPORT2${atsign}/${EXTRAPORT2}/g" \
-e "s/${atsign}EXTRAPORT3${atsign}/${EXTRAPORT3}/g" \
-e "s/${atsign}EXTRAPORT4${atsign}/${EXTRAPORT4}/g" \
-e "s/${atsign}EXTRAPORT5${atsign}/${EXTRAPORT5}/g" \
-e "s/${atsign}EXTRAPORT6${atsign}/${EXTRAPORT6}/g" \
-e "s/${atsign}EXTRAPORT7${atsign}/${EXTRAPORT7}/g" \
-e "s/${atsign}EXTRAPORT8${atsign}/${EXTRAPORT8}/g" \
-e "s/${atsign}CONTROLPORT${atsign}/${CONTROLPORT}/g" \
-e "s/${atsign}DEFAULT_ALGORITHM${atsign}/${DEFAULT_ALGORITHM}/g" \
-e "s/${atsign}DEFAULT_ALGORITHM_NUMBER${atsign}/${DEFAULT_ALGORITHM_NUMBER}/g" \
-e "s/${atsign}DEFAULT_BITS${atsign}/${DEFAULT_BITS}/g" \
-e "s/${atsign}ALTERNATIVE_ALGORITHM${atsign}/${ALTERNATIVE_ALGORITHM}/g" \
-e "s/${atsign}ALTERNATIVE_ALGORITHM_NUMBER${atsign}/${ALTERNATIVE_ALGORITHM_NUMBER}/g" \
-e "s/${atsign}ALTERNATIVE_BITS${atsign}/${ALTERNATIVE_BITS}/g" \
$1 > $2
}
# The rest is shared between Windows and Unices
. $TOP/bin/tests/system/conf.sh.common