2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-09-01 23:25:38 +00:00

[master] Stabilize logfileconfig system test

4818.	[test]		The logfileconfig system test could intermittently
			report false negatives on some platforms. [RT #46615]
This commit is contained in:
Michał Kępień
2017-11-16 08:06:57 +01:00
parent bcce55197a
commit 7a0188774f
3 changed files with 76 additions and 58 deletions

View File

@@ -1,3 +1,6 @@
4818. [test] The logfileconfig system test could intermittently
report false negatives on some platforms. [RT #46615]
4817. [cleanup] Use DNS_NAME_INITABSOLUTE and DNS_NAME_INITNONABSOLUTE. 4817. [cleanup] Use DNS_NAME_INITABSOLUTE and DNS_NAME_INITNONABSOLUTE.
[RT #45433] [RT #45433]

View File

@@ -26,6 +26,8 @@
int scmp_syscalls[] = { int scmp_syscalls[] = {
SCMP_SYS(access), SCMP_SYS(access),
SCMP_SYS(open), SCMP_SYS(open),
SCMP_SYS(openat),
SCMP_SYS(lseek),
SCMP_SYS(clock_gettime), SCMP_SYS(clock_gettime),
SCMP_SYS(time), SCMP_SYS(time),
SCMP_SYS(read), SCMP_SYS(read),
@@ -54,6 +56,7 @@ int scmp_syscalls[] = {
#ifdef HAVE_GETRANDOM #ifdef HAVE_GETRANDOM
SCMP_SYS(getrandom), SCMP_SYS(getrandom),
#endif #endif
SCMP_SYS(rename),
SCMP_SYS(unlink), SCMP_SYS(unlink),
SCMP_SYS(socket), SCMP_SYS(socket),
SCMP_SYS(sendto), SCMP_SYS(sendto),
@@ -72,7 +75,6 @@ int scmp_syscalls[] = {
SCMP_SYS(getsockopt), SCMP_SYS(getsockopt),
SCMP_SYS(getsockname), SCMP_SYS(getsockname),
SCMP_SYS(lstat), SCMP_SYS(lstat),
SCMP_SYS(lseek),
SCMP_SYS(getgid), SCMP_SYS(getgid),
SCMP_SYS(getegid), SCMP_SYS(getegid),
SCMP_SYS(getuid), SCMP_SYS(getuid),
@@ -83,9 +85,7 @@ int scmp_syscalls[] = {
SCMP_SYS(setuid), SCMP_SYS(setuid),
SCMP_SYS(prctl), SCMP_SYS(prctl),
SCMP_SYS(epoll_wait), SCMP_SYS(epoll_wait),
SCMP_SYS(openat),
SCMP_SYS(getdents), SCMP_SYS(getdents),
SCMP_SYS(rename),
SCMP_SYS(utimes), SCMP_SYS(utimes),
SCMP_SYS(dup), SCMP_SYS(dup),
#endif #endif
@@ -93,6 +93,8 @@ int scmp_syscalls[] = {
const char *scmp_syscall_names[] = { const char *scmp_syscall_names[] = {
"access", "access",
"open", "open",
"openat",
"lseek",
"clock_gettime", "clock_gettime",
"time", "time",
"read", "read",
@@ -121,6 +123,7 @@ const char *scmp_syscall_names[] = {
#ifdef HAVE_GETRANDOM #ifdef HAVE_GETRANDOM
"getrandom", "getrandom",
#endif #endif
"rename",
"unlink", "unlink",
"socket", "socket",
"sendto", "sendto",
@@ -139,7 +142,6 @@ const char *scmp_syscall_names[] = {
"getsockopt", "getsockopt",
"getsockname", "getsockname",
"lstat", "lstat",
"lseek",
"getgid", "getgid",
"getegid", "getegid",
"getuid", "getuid",
@@ -150,9 +152,7 @@ const char *scmp_syscall_names[] = {
"setuid", "setuid",
"prctl", "prctl",
"epoll_wait", "epoll_wait",
"openat",
"getdents", "getdents",
"rename",
"utimes", "utimes",
"dup", "dup",
#endif #endif

View File

@@ -35,6 +35,19 @@ PIDFILE="${THISDIR}/${CONFDIR}/named.pid"
myRNDC="$RNDC -c ${THISDIR}/${CONFDIR}/rndc.conf" myRNDC="$RNDC -c ${THISDIR}/${CONFDIR}/rndc.conf"
myNAMED="$NAMED -c ${THISDIR}/${CONFDIR}/named.conf -m record,size,mctx -T clienttest -T nosyslog -d 99 -X named.lock -U 4" myNAMED="$NAMED -c ${THISDIR}/${CONFDIR}/named.conf -m record,size,mctx -T clienttest -T nosyslog -d 99 -X named.lock -U 4"
# Test given condition. If true, test again after a second. Used for testing
# filesystem-dependent conditions in order to prevent false negatives caused by
# directory contents not being synchronized immediately after rename() returns.
test_with_retry() {
if test "$@"; then
sleep 1
if test "$@"; then
return 0
fi
fi
return 1
}
waitforpidfile() { waitforpidfile() {
for _w in 1 2 3 4 5 6 7 8 9 10 for _w in 1 2 3 4 5 6 7 8 9 10
do do
@@ -48,9 +61,10 @@ n=0
cd $CONFDIR cd $CONFDIR
n=`expr $n + 1` echo "I:testing log file validity (named -g + only plain files allowed)"
echo "I:testing log file validity (named -g + only plain files allowed) ($n)"
n=`expr $n + 1`
echo "I: testing plain file (named -g) ($n)"
# First run with a known good config. # First run with a known good config.
echo > $PLAINFILE echo > $PLAINFILE
cp $PLAINCONF named.conf cp $PLAINCONF named.conf
@@ -58,9 +72,9 @@ $myRNDC reconfig > rndc.out.test$n 2>&1
grep "reloading configuration failed" named.run > /dev/null 2>&1 grep "reloading configuration failed" named.run > /dev/null 2>&1
if [ $? -ne 0 ] if [ $? -ne 0 ]
then then
echo "I: testing plain file succeeded" echo "I: testing plain file succeeded"
else else
echo "I: testing plain file failed (unexpected)" echo "I: testing plain file failed (unexpected)"
echo "I:exit status: 1" echo "I:exit status: 1"
exit 1 exit 1
fi fi
@@ -79,14 +93,14 @@ then
grep "checking logging configuration failed: invalid file" named.run > /dev/null 2>&1 grep "checking logging configuration failed: invalid file" named.run > /dev/null 2>&1
if [ $? -ne 0 ] if [ $? -ne 0 ]
then then
echo "I: testing directory as file succeeded (UNEXPECTED)" echo "I: testing directory as file succeeded (UNEXPECTED)"
echo "I:exit status: 1" echo "I:exit status: 1"
exit 1 exit 1
else else
echo "I: testing directory as log file failed (expected)" echo "I: testing directory as log file failed (expected)"
fi fi
else else
echo "I: skipping directory test (unable to create directory)" echo "I: skipping directory test (unable to create directory)"
fi fi
# Now try pipe file, expect failure # Now try pipe file, expect failure
@@ -103,14 +117,14 @@ then
grep "checking logging configuration failed: invalid file" named.run > /dev/null 2>&1 grep "checking logging configuration failed: invalid file" named.run > /dev/null 2>&1
if [ $? -ne 0 ] if [ $? -ne 0 ]
then then
echo "I: testing pipe file as log file succeeded (UNEXPECTED)" echo "I: testing pipe file as log file succeeded (UNEXPECTED)"
echo "I:exit status: 1" echo "I:exit status: 1"
exit 1 exit 1
else else
echo "I: testing pipe file as log file failed (expected)" echo "I: testing pipe file as log file failed (expected)"
fi fi
else else
echo "I: skipping pipe test (unable to create pipe)" echo "I: skipping pipe test (unable to create pipe)"
fi fi
# Now try symlink file to plain file, expect success # Now try symlink file to plain file, expect success
@@ -129,14 +143,14 @@ then
grep "reloading configuration failed" named.run > /dev/null 2>&1 grep "reloading configuration failed" named.run > /dev/null 2>&1
if [ $? -ne 0 ] if [ $? -ne 0 ]
then then
echo "I: testing symlink to plain file succeeded" echo "I: testing symlink to plain file succeeded"
else else
echo "I: testing symlink to plain file failed (unexpected)" echo "I: testing symlink to plain file failed (unexpected)"
echo "I:exit status: 1" echo "I:exit status: 1"
exit 1 exit 1
fi fi
else else
echo "I: skipping symlink test (unable to create symlink)" echo "I: skipping symlink test (unable to create symlink)"
fi fi
# Stop the server and run through a series of tests with various config # Stop the server and run through a series of tests with various config
# files while controlling the stop/start of the server. # files while controlling the stop/start of the server.
@@ -155,9 +169,10 @@ fi
status=0 status=0
n=`expr $n + 1` echo "I:testing log file validity (only plain files allowed)"
echo "I:testing log file validity (only plain files allowed) ($n)"
n=`expr $n + 1`
echo "I: testing plain file (named -g) ($n)"
# First run with a known good config. # First run with a known good config.
echo > $PLAINFILE echo > $PLAINFILE
cp $PLAINCONF named.conf cp $PLAINCONF named.conf
@@ -165,9 +180,9 @@ $myRNDC reconfig > rndc.out.test$n 2>&1
grep "reloading configuration failed" named.run > /dev/null 2>&1 grep "reloading configuration failed" named.run > /dev/null 2>&1
if [ $? -ne 0 ] if [ $? -ne 0 ]
then then
echo "I: testing plain file succeeded" echo "I: testing plain file succeeded"
else else
echo "I: testing plain file failed (unexpected)" echo "I: testing plain file failed (unexpected)"
echo "I:exit status: 1" echo "I:exit status: 1"
exit 1 exit 1
fi fi
@@ -186,14 +201,14 @@ then
grep "configuring logging: invalid file" named.run > /dev/null 2>&1 grep "configuring logging: invalid file" named.run > /dev/null 2>&1
if [ $? -ne 0 ] if [ $? -ne 0 ]
then then
echo "I: testing directory as file succeeded (UNEXPECTED)" echo "I: testing directory as file succeeded (UNEXPECTED)"
echo "I:exit status: 1" echo "I:exit status: 1"
exit 1 exit 1
else else
echo "I: testing directory as log file failed (expected)" echo "I: testing directory as log file failed (expected)"
fi fi
else else
echo "I: skipping directory test (unable to create directory)" echo "I: skipping directory test (unable to create directory)"
fi fi
# Now try pipe file, expect failure # Now try pipe file, expect failure
@@ -210,14 +225,14 @@ then
grep "configuring logging: invalid file" named.run > /dev/null 2>&1 grep "configuring logging: invalid file" named.run > /dev/null 2>&1
if [ $? -ne 0 ] if [ $? -ne 0 ]
then then
echo "I: testing pipe file as log file succeeded (UNEXPECTED)" echo "I: testing pipe file as log file succeeded (UNEXPECTED)"
echo "I:exit status: 1" echo "I:exit status: 1"
exit 1 exit 1
else else
echo "I: testing pipe file as log file failed (expected)" echo "I: testing pipe file as log file failed (expected)"
fi fi
else else
echo "I: skipping pipe test (unable to create pipe)" echo "I: skipping pipe test (unable to create pipe)"
fi fi
# Now try symlink file to plain file, expect success # Now try symlink file to plain file, expect success
@@ -237,18 +252,18 @@ then
grep "reloading configuration failed" named.run > /dev/null 2>&1 grep "reloading configuration failed" named.run > /dev/null 2>&1
if [ $? -ne 0 ] if [ $? -ne 0 ]
then then
echo "I: testing symlink to plain file succeeded" echo "I: testing symlink to plain file succeeded"
else else
echo "I: testing symlink to plain file failed (unexpected)" echo "I: testing symlink to plain file failed (unexpected)"
echo "I:exit status: 1" echo "I:exit status: 1"
exit 1 exit 1
fi fi
else else
echo "I: skipping symlink test (unable to create symlink)" echo "I: skipping symlink test (unable to create symlink)"
fi fi
n=`expr $n + 1` n=`expr $n + 1`
echo "I: testing default logfile using named -L file ($n)" echo "I:testing default logfile using named -L file ($n)"
# Now stop the server again and test the -L option # Now stop the server again and test the -L option
rm -f $DLFILE rm -f $DLFILE
$PERL ../../stop.pl .. ns1 $PERL ../../stop.pl .. ns1
@@ -256,7 +271,7 @@ if ! test -f $PIDFILE; then
cp $PLAINCONF named.conf cp $PLAINCONF named.conf
$myNAMED -L $DLFILE > /dev/null 2>&1 $myNAMED -L $DLFILE > /dev/null 2>&1
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo "I:failed to start $myNAMED" echo "I: failed to start $myNAMED"
echo "I:exit status: $status" echo "I:exit status: $status"
exit $status exit $status
fi fi
@@ -272,7 +287,7 @@ if ! test -f $PIDFILE; then
exit 1 exit 1
fi fi
else else
echo "I:failed to cleanly stop $myNAMED" echo "I: failed to cleanly stop $myNAMED"
echo "I:exit status: 1" echo "I:exit status: 1"
exit 1 exit 1
fi fi
@@ -284,9 +299,9 @@ echo "I: testing iso8601 timestamp ($n)"
cp $ISOCONF named.conf cp $ISOCONF named.conf
$myRNDC reconfig > rndc.out.test$n 2>&1 $myRNDC reconfig > rndc.out.test$n 2>&1
if grep '^....-..-..T..:..:..\.... ' $ISOFILE > /dev/null; then if grep '^....-..-..T..:..:..\.... ' $ISOFILE > /dev/null; then
echo "I: testing iso8601 timestamp succeeded" echo "I: testing iso8601 timestamp succeeded"
else else
echo "I: testing iso8601 timestamp failed" echo "I: testing iso8601 timestamp failed"
status=`expr $status + 1` status=`expr $status + 1`
fi fi
@@ -295,14 +310,14 @@ echo "I: testing iso8601-utc timestamp ($n)"
cp $ISOCONFUTC named.conf cp $ISOCONFUTC named.conf
$myRNDC reconfig > rndc.out.test$n 2>&1 $myRNDC reconfig > rndc.out.test$n 2>&1
if grep '^....-..-..T..:..:..\....Z' $ISOUTCFILE > /dev/null; then if grep '^....-..-..T..:..:..\....Z' $ISOUTCFILE > /dev/null; then
echo "I: testing iso8601-utc timestamp succeeded" echo "I: testing iso8601-utc timestamp succeeded"
else else
echo "I: testing iso8601-utc timestamp failed" echo "I: testing iso8601-utc timestamp failed"
status=`expr $status + 1` status=`expr $status + 1`
fi fi
n=`expr $n + 1` n=`expr $n + 1`
echo "I: testing explict versions ($n)" echo "I: testing explicit versions ($n)"
cp $VERSCONF named.conf cp $VERSCONF named.conf
# a seconds since epoch version number # a seconds since epoch version number
touch $VERSFILE.1480039317 touch $VERSFILE.1480039317
@@ -313,27 +328,27 @@ t2=`$PERL -e 'print time()."\n";'`
t=`expr ${t2:-0} - ${t1:-0}` t=`expr ${t2:-0} - ${t1:-0}`
if test ${t:-1000} -gt 5 if test ${t:-1000} -gt 5
then then
echo "I: testing explict versions failed cleanup of old entries took too long ($t secs)" echo "I: testing explicit versions failed: cleanup of old entries took too long ($t secs)"
status=`expr $status + 1` status=`expr $status + 1`
fi fi
if ! grep "status: NOERROR" dig.out.test$n > /dev/null if ! grep "status: NOERROR" dig.out.test$n > /dev/null
then then
echo "I: testing explict versions failed DiG lookup failed" echo "I: testing explicit versions failed: DiG lookup failed"
status=`expr $status + 1` status=`expr $status + 1`
fi fi
if test -f $VERSFILE.1480039317 if test_with_retry -f $VERSFILE.1480039317
then then
echo "I: testing explict versions failed $VERSFILE.1480039317 not removed" echo "I: testing explicit versions failed: $VERSFILE.1480039317 not removed"
status=`expr $status + 1` status=`expr $status + 1`
fi fi
if test -f $VERSFILE.5 if test_with_retry -f $VERSFILE.5
then then
echo "I: testing explict versions failed $VERSFILE.5 exists" echo "I: testing explicit versions failed: $VERSFILE.5 exists"
status=`expr $status + 1` status=`expr $status + 1`
fi fi
if test ! -f $VERSFILE.4 if test_with_retry ! -f $VERSFILE.4
then then
echo "I: testing explict versions failed $VERSFILE.4 does not exist" echo "I: testing explicit versions failed: $VERSFILE.4 does not exist"
status=`expr $status + 1` status=`expr $status + 1`
fi fi
@@ -349,17 +364,17 @@ t2=`$PERL -e 'print time()."\n";'`
t=`expr ${t2:-0} - ${t1:-0}` t=`expr ${t2:-0} - ${t1:-0}`
if test ${t:-1000} -gt 5 if test ${t:-1000} -gt 5
then then
echo "I: testing timestamped versions failed cleanup of old entries took too long ($t secs)" echo "I: testing timestamped versions failed: cleanup of old entries took too long ($t secs)"
status=`expr $status + 1` status=`expr $status + 1`
fi fi
if ! grep "status: NOERROR" dig.out.test$n > /dev/null if ! grep "status: NOERROR" dig.out.test$n > /dev/null
then then
echo "I: testing timestamped versions failed DiG lookup failed" echo "I: testing timestamped versions failed: DiG lookup failed"
status=`expr $status + 1` status=`expr $status + 1`
fi fi
if test -f $TSFILE.1480039317 if test_with_retry -f $TSFILE.1480039317
then then
echo "I: testing timestamped versions failed $TSFILE.1480039317 not removed" echo "I: testing timestamped versions failed: $TSFILE.1480039317 not removed"
status=`expr $status + 1` status=`expr $status + 1`
fi fi
@@ -375,22 +390,22 @@ t2=`$PERL -e 'print time()."\n";'`
t=`expr ${t2:-0} - ${t1:-0}` t=`expr ${t2:-0} - ${t1:-0}`
if test ${t:-1000} -gt 5 if test ${t:-1000} -gt 5
then then
echo "I: testing unlimited versions failed took too long ($t secs)" echo "I: testing unlimited versions failed: took too long ($t secs)"
status=`expr $status + 1` status=`expr $status + 1`
fi fi
if ! grep "status: NOERROR" dig.out.test$n > /dev/null if ! grep "status: NOERROR" dig.out.test$n > /dev/null
then then
echo "I: testing unlimited versions failed DiG lookup failed" echo "I: testing unlimited versions failed: DiG lookup failed"
status=`expr $status + 1` status=`expr $status + 1`
fi fi
if test ! -f $UNLIMITEDFILE.1480039317 if test_with_retry ! -f $UNLIMITEDFILE.1480039317
then then
echo "I: testing unlimited versions failed $UNLIMITEDFILE.1480039317 removed" echo "I: testing unlimited versions failed: $UNLIMITEDFILE.1480039317 removed"
status=`expr $status + 1` status=`expr $status + 1`
fi fi
if test ! -f $UNLIMITEDFILE.4 if test_with_retry ! -f $UNLIMITEDFILE.4
then then
echo "I: testing unlimited versions failed $UNLIMITEDFILE.4 does not" echo "I: testing unlimited versions failed: $UNLIMITEDFILE.4 does not exist"
status=`expr $status + 1` status=`expr $status + 1`
fi fi