2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-09-03 08:05:21 +00:00

[rt46602] Rename "test" variable to "systest"

... to avoid confusion between the variable and the command of the
same name.
This commit is contained in:
Stephen Morris
2017-12-20 19:08:57 +00:00
parent 00bc29640b
commit c12e06755f
2 changed files with 55 additions and 44 deletions

View File

@@ -27,15 +27,21 @@ while getopts "r" flag; do
done done
shift `expr $OPTIND - 1` shift `expr $OPTIND - 1`
test $# -gt 0 || { echo "usage: $0 [-r] test-directory" >&2; exit 1; } if [ $# -eq 0 ]; then
echo "usage: $0 [-r] test-directory" >&2
exit 1
fi
test=$1 systest=$1
shift shift
if [ "$runall" = "" ]; then if [ "$runall" = "" ]; then
rm -f $test/test.output rm -f $systest/test.output
fi fi
if test -f $test/clean.sh; then if [ -f $systest/clean.sh ]; then
( cd $test && $SHELL clean.sh "$@" ) ( cd $systest && $SHELL clean.sh "$@" )
else
echo "Test directory $systest does not exist" >&2
exit 1
fi fi

View File

@@ -35,11 +35,11 @@ if [ $# -eq 0 ]; then
exit 1 exit 1
fi fi
test=$1 systest=$1
shift shift
if [ ! -d test ]; then if [ ! -d $systest ]; then
echofail "$0: $test: no such test" >&2 echofail "$0: $systest: no such test" >&2
exit 1 exit 1
fi fi
@@ -58,10 +58,10 @@ maxvalid=`expr 65535 - $numport + 1`
test "$baseport" -eq "$baseport" > /dev/null 2>&1 test "$baseport" -eq "$baseport" > /dev/null 2>&1
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echofail "$0: $test: must specify a numeric value for the port" >&2 echofail "$0: $systest: must specify a numeric value for the port" >&2
exit 1 exit 1
elif [ $baseport -lt $minvalid -o $baseport -gt $maxvalid ]; then elif [ $baseport -lt $minvalid -o $baseport -gt $maxvalid ]; then
echofail "$0: $test: the specified port must be in the range $minvalid to $maxvalid" >&2 echofail "$0: $systest: the specified port must be in the range $minvalid to $maxvalid" >&2
exit 1 exit 1
fi fi
@@ -85,62 +85,67 @@ export LOWPORT=$baseport
export HIGHPORT=`expr $baseport + $numport - 1` export HIGHPORT=`expr $baseport + $numport - 1`
echostart "S:$test:`date $dateargs`" echostart "S:$systest:`date $dateargs`"
echoinfo "T:$test:1:A" echoinfo "T:$systest:1:A"
echoinfo "A:$test:System test $test" echoinfo "A:$systest:System test $systest"
echoinfo "I:$test:PORTRANGE:${LOWPORT} - ${HIGHPORT}" echoinfo "I:$systest:PORTRANGE:${LOWPORT} - ${HIGHPORT}"
if [ x${PERL:+set} = x ] if [ x${PERL:+set} = x ]
then then
echowarn "I:$test:Perl not available. Skipping test." echowarn "I:$systest:Perl not available. Skipping test."
echowarn "R:$test:UNTESTED" echowarn "R:$systest:UNTESTED"
echoend "E:$test:`date $dateargs`" echoend "E:$systest:`date $dateargs`"
exit 0; exit 0;
fi fi
$PERL testsock.pl -p $PORT || { $PERL testsock.pl -p $PORT || {
echowarn "I:$test:Network interface aliases not set up. Skipping test." echowarn "I:$systest:Network interface aliases not set up. Skipping test."
echowarn "R:$test:UNTESTED" echowarn "R:$systest:UNTESTED"
echoend "E:$test:`date $dateargs`" echoend "E:$systest:`date $dateargs`"
exit 0; exit 0;
} }
# Check for test-specific prerequisites. # Check for test-specific prerequisites.
test ! -f $test/prereq.sh || ( cd $test && $SHELL prereq.sh "$@" ) test ! -f $systest/prereq.sh || ( cd $systest && $SHELL prereq.sh "$@" )
result=$? result=$?
if [ $result -eq 0 ]; then if [ $result -eq 0 ]; then
: prereqs ok : prereqs ok
else else
echowarn "I:$test:Prerequisites missing, skipping test." echowarn "I:$systest:Prerequisites missing, skipping test."
[ $result -eq 255 ] && echowarn "R:$test:SKIPPED" || echowarn "R:$test:UNTESTED" [ $result -eq 255 ] && echowarn "R:$systest:SKIPPED" || echowarn "R:$systest:UNTESTED"
echoend "E:$test:`date $dateargs`" echoend "E:$systest:`date $dateargs`"
exit 0 exit 0
fi fi
# Check for PKCS#11 support # Check for PKCS#11 support
if if
test ! -f $test/usepkcs11 || $SHELL cleanpkcs11.sh test ! -f $systest/usepkcs11 || $SHELL cleanpkcs11.sh
then then
: pkcs11 ok : pkcs11 ok
else else
echowarn "I:$test:Need PKCS#11, skipping test." echowarn "I:$systest:Need PKCS#11, skipping test."
echowarn "R:$test:PKCS11ONLY" echowarn "R:$systest:PKCS11ONLY"
echoend "E:$test:`date $dateargs`" echoend "E:$systest:`date $dateargs`"
exit 0 exit 0
fi fi
# Set up any dynamically generated test data # Set up any dynamically generated test data
if test -f $test/setup.sh if test -f $systest/setup.sh
then then
( cd $test && $SHELL setup.sh "$@" ) ( cd $systest && $SHELL setup.sh "$@" )
fi fi
# Start name servers running # Start name servers running
$PERL start.pl --port $PORT $test || { echofail "R:$test:FAIL"; echoend "E:$test:`date $dateargs`"; exit 1; } $PERL start.pl --port $PORT $systest
if [ $? -ne 0 ]; then
echofail "R:$systest:FAIL"
echoend "E:$systest:`date $dateargs`"
exit 1
fi
# Run the tests # Run the tests
( cd $test ; $SHELL tests.sh "$@" ) ( cd $systest ; $SHELL tests.sh "$@" )
status=$? status=$?
if $stopservers if $stopservers
@@ -151,30 +156,30 @@ else
fi fi
# Shutdown # Shutdown
$PERL stop.pl $test $PERL stop.pl $systest
status=`expr $status + $?` status=`expr $status + $?`
if [ $status != 0 ]; then if [ $status != 0 ]; then
echofail "R:$test:FAIL" echofail "R:$systest:FAIL"
# Do not clean up - we need the evidence. # Do not clean up - we need the evidence.
find . -name core -exec chmod 0644 '{}' \; find . -name core -exec chmod 0644 '{}' \;
else else
echopass "R:$test:PASS" echopass "R:$systest:PASS"
if $clean if $clean
then then
rm -f $SYSTEMTESTTOP/random.data rm -f $SYSTEMTESTTOP/random.data
$SHELL clean.sh $runall $test "$@" $SHELL clean.sh $runall $systest "$@"
if test -d ../../../.git if test -d ../../../.git
then then
git status -su --ignored $test | \ git status -su --ignored $systest | \
sed -n -e 's|^?? \(.*\)|I:file \1 not removed|p' \ sed -n -e 's|^?? \(.*\)|I:file \1 not removed|p' \
-e 's|^!! \(.*/named.run\)$|I:file \1 not removed|p' \ -e 's|^!! \(.*/named.run\)$|I:file \1 not removed|p' \
-e 's|^!! \(.*/named.memstats\)$|I:file \1 not removed|p' -e 's|^!! \(.*/named.memstats\)$|I:file \1 not removed|p'
fi fi
fi fi
fi fi
echoend "E:$test:`date $dateargs`" echoend "E:$systest:`date $dateargs`"
exit $status exit $status