Modify test suite to include also variants

Run system tests for each variants.
This commit is contained in:
Petr Menšík 2019-08-27 21:27:47 +02:00
parent 5aee3f1742
commit 0983c90fb0

View File

@ -32,6 +32,40 @@
PACKAGE="bind"
#
# Runs test suite and checks known errors
# Prepared to be repeated with another variants
run_testsuite()
{
local RESULT_TEXT="$TMPDIR/test${NAMED_VARIANT}.txt"
local FOUNDERROR=`mktemp found-XXXXXXXX.err`
local KNOWNERROR
if [ -f "$ORIG/knownerror${NAMED_VARIANT}.$TAG" ]; then
KNOWNERROR=`readlink -f $ORIG/knownerror.$TAG`
elif [ -f "$ORIG/knownerror${NAMED_VARIANT}" ]; then
KNOWNERROR=`readlink -f $ORIG/knownerror`
fi
# Sometime it can fail. Report just failures that are not known
rlRun "make test -j${CORES:-1} &> $RESULT_TEXT" 0-255 "Perform the test."
rlRun "grep -C 10 FAIL $RESULT_TEXT" 0-255 "Quickly show the test error (if any)."
rlRun "$FILTER $RESULT_TEXT" 0 "Showing unsuccessful tests"
rlRun "$FILTER -s $RESULT_TEXT > $FOUNDERROR" 0
rlRun "ls $KNOWNERROR $FOUNDERROR $RESULT_TEXT" 0 'check if there is needed files'
rlLog "`cat $FOUNDERROR`"
rlAssertLesserOrEqual "Checking number of found errors is in limits" "$(grep '^FAIL' $FOUNDERROR | wc -l)" "$(wc -l <$KNOWNERROR)"
cat $FOUNDERROR | while read STATUS TEST ; do
if [ "$STATUS" = FAIL ]; then
rlRun "grep '$TEST' $KNOWNERROR" 0 "Check $TEST failure is expected"
else
rlLog "$STATUS $TEST"
fi
done
}
rlJournalStart
rlPhaseStartSetup
# package assertions
@ -41,9 +75,9 @@ rlJournalStart
#pwd
ORIG=`pwd`
FOUNDERROR=`mktemp`
SETUP_SOFTHSM=`readlink -f setup-named-softhsm.sh`
FILTER=`readlink -f bind-systest-filter.sh`
CORES=`grep 'processor\s*:' /proc/cpuinfo | wc -l`
TAG=generic
if [ -f /etc/os-release ]; then
@ -51,12 +85,6 @@ rlJournalStart
TAG=`(source /etc/os-release && echo ${PLATFORM_ID#platform:})`
fi
if [ -f "knownerror.$TAG" ]; then
KNOWNERROR=`readlink -f knownerror.$TAG`
elif [ -f "knownerror" ]; then
KNOWNERROR=`readlink -f knownerror`
fi
#tempdir
rlRun "TMPDIR=\`mktemp -d\`" 0 "Creating tmp directory"
rlRun "pushd $TMPDIR"
@ -113,34 +141,29 @@ rlJournalStart
export LC_ALL=en_US.UTF-8
rlRun "pushd $BUILD"
rlRun "make test &> $TMPDIR/test.txt" 0-255 "Perform the test."
rlRun "popd"
rlRun "grep -C 10 FAIL $TMPDIR/test.txt" 0-255 "Quickly show the test error (if any)."
rlLog "Running normal variant"
export NAMED_VARIANT= DNSSEC_VARIANT=
run_testsuite
rlLog "Running pkcs11 variant"
export NAMED_VARIANT=-pkcs11 DNSSEC_VARIANT=-pkcs11
run_testsuite
rlLog "Running sdb variant"
export NAMED_VARIANT=-sdb DNSSEC_VARIANT=
run_testsuite
rlRun "popd"
rlRun "./bin/tests/system/ifconfig.sh down" 0 "Remove fake network interfaces."
#list of failures:
rlRun "$FILTER $TMPDIR/test.txt" 0 "Showing unsuccessful tests"
rlRun "$FILTER -s $TMPDIR/test.txt > $FOUNDERROR" 0
rlRun "ls $KNOWNERROR $FOUNDERROR $TMPDIR/test.txt" 0 'check if there is needed files'
rlLog "`cat $FOUNDERROR`"
rlAssertLesserOrEqual "Checking number of found errors is in limits" "$(grep '^FAIL' $FOUNDERROR | wc -l)" "$(wc -l <$KNOWNERROR)"
cat $FOUNDERROR | while read STATUS TEST ; do
if [ "$STATUS" = FAIL ]; then
rlRun "grep '$TEST' $KNOWNERROR" 0 "Check $TEST failure is expected"
else
rlLog "$STATUS $TEST"
fi
done
rlPhaseEnd
rlPhaseStartCleanup
rlBundleLogs "TEST_LOGS" "$TMPDIR/install.txt" "$TMPDIR/builddeps.txt" "$TMPDIR/build.txt" "$TMPDIR/test.txt"
rlBundleLogs "BUILD_LOGS" "$TMPDIR/install.txt" "$TMPDIR/builddeps.txt" "$TMPDIR/build.txt"
rlBundleLogs "TEST_LOGS" "$TMPDIR"/test*.txt
rlRun "popd"
rlRun "rm -r $TMPDIR" 0 "Removing tmp directory"
rlRun "rm -rf $FOUNDERROR"
rlPhaseEnd
rlJournalEnd