From 84d6484c5a8c3820002c841a8ea8bbb9c463ea1b Mon Sep 17 00:00:00 2001 From: Tom Krizek Date: Fri, 14 Oct 2022 16:59:50 +0200 Subject: [PATCH] Revive the stress system test Ensure the port numbers are dynamically filled in with copy_setports. Clarify test fail condition. Make the stress test part of the default test suite since it doesn't seem to run too long or interfere with other tests any more (the original note claiming so is more than 20 years old). Related !6883 (cherry picked from commit 7495deea3e80fe20dd32dabf1d174d1458ce2b47) --- bin/tests/system/conf.sh.common | 2 -- bin/tests/system/stress/clean.sh | 3 +++ bin/tests/system/stress/ns1/{named.conf => named.conf.in} | 2 +- bin/tests/system/stress/ns2/{named.conf => named.conf.in} | 2 +- bin/tests/system/stress/ns3/{named.conf => named.conf.in} | 4 ++-- bin/tests/system/stress/ns4/{named.conf => named.conf.in} | 2 +- bin/tests/system/stress/setup.sh | 5 +++++ bin/tests/system/stress/tests.sh | 8 ++++++-- 8 files changed, 19 insertions(+), 9 deletions(-) rename bin/tests/system/stress/ns1/{named.conf => named.conf.in} (98%) rename bin/tests/system/stress/ns2/{named.conf => named.conf.in} (98%) rename bin/tests/system/stress/ns3/{named.conf => named.conf.in} (91%) rename bin/tests/system/stress/ns4/{named.conf => named.conf.in} (98%) diff --git a/bin/tests/system/conf.sh.common b/bin/tests/system/conf.sh.common index bbd91953fa..89d4895b97 100644 --- a/bin/tests/system/conf.sh.common +++ b/bin/tests/system/conf.sh.common @@ -27,8 +27,6 @@ export LANG=C # # Common lists of system tests to run. # -# The "stress" test is not run by default since it creates enough -# load on the machine to make it unusable to other users. # The "dupsigs" test is not run by default because it takes # a very long time to complete. # diff --git a/bin/tests/system/stress/clean.sh b/bin/tests/system/stress/clean.sh index 0f8403c83a..b365d7cc77 100644 --- a/bin/tests/system/stress/clean.sh +++ b/bin/tests/system/stress/clean.sh @@ -17,9 +17,12 @@ rm -f ns?/zones.conf rm -f ns?/zone*.bk rm -f ns1/delegations.db +rm -f ns1/root.db rm -f ns2/zone0*.db rm -f ns2/zone0*.jnl rm -f */named.memstats rm -f ns*/named.lock rm -f ns*/managed-keys.bind* +rm -f ns*/named.run +rm -f ns*/named.conf diff --git a/bin/tests/system/stress/ns1/named.conf b/bin/tests/system/stress/ns1/named.conf.in similarity index 98% rename from bin/tests/system/stress/ns1/named.conf rename to bin/tests/system/stress/ns1/named.conf.in index 7dff8e156d..2b54a36eb9 100644 --- a/bin/tests/system/stress/ns1/named.conf +++ b/bin/tests/system/stress/ns1/named.conf.in @@ -17,7 +17,7 @@ options { query-source address 10.53.0.1; notify-source 10.53.0.1; transfer-source 10.53.0.1; - port 5300; + port @PORT@; pid-file "named.pid"; listen-on { 10.53.0.1; }; listen-on-v6 { none; }; diff --git a/bin/tests/system/stress/ns2/named.conf b/bin/tests/system/stress/ns2/named.conf.in similarity index 98% rename from bin/tests/system/stress/ns2/named.conf rename to bin/tests/system/stress/ns2/named.conf.in index f8317823b1..5bbea78aca 100644 --- a/bin/tests/system/stress/ns2/named.conf +++ b/bin/tests/system/stress/ns2/named.conf.in @@ -17,7 +17,7 @@ options { query-source address 10.53.0.2; notify-source 10.53.0.2; transfer-source 10.53.0.2; - port 5300; + port @PORT@; pid-file "named.pid"; listen-on { 10.53.0.2; }; listen-on-v6 { none; }; diff --git a/bin/tests/system/stress/ns3/named.conf b/bin/tests/system/stress/ns3/named.conf.in similarity index 91% rename from bin/tests/system/stress/ns3/named.conf rename to bin/tests/system/stress/ns3/named.conf.in index 8894493ba6..b504abba0b 100644 --- a/bin/tests/system/stress/ns3/named.conf +++ b/bin/tests/system/stress/ns3/named.conf.in @@ -17,7 +17,7 @@ options { query-source address 10.53.0.3; notify-source 10.53.0.3; transfer-source 10.53.0.3; - port 5300; + port @PORT@; pid-file "named.pid"; listen-on { 10.53.0.3; }; listen-on-v6 { none; }; @@ -32,7 +32,7 @@ key rndc_key { }; controls { - inet 10.53.0.3 port 9953 allow { any; } keys { rndc_key; }; + inet 10.53.0.3 port @CONTROLPORT@ allow { any; } keys { rndc_key; }; }; zone "." { diff --git a/bin/tests/system/stress/ns4/named.conf b/bin/tests/system/stress/ns4/named.conf.in similarity index 98% rename from bin/tests/system/stress/ns4/named.conf rename to bin/tests/system/stress/ns4/named.conf.in index e41d194705..57f7e40fdd 100644 --- a/bin/tests/system/stress/ns4/named.conf +++ b/bin/tests/system/stress/ns4/named.conf.in @@ -17,7 +17,7 @@ options { query-source address 10.53.0.4; notify-source 10.53.0.4; transfer-source 10.53.0.4; - port 5300; + port @PORT@; pid-file "named.pid"; listen-on { 10.53.0.4; }; listen-on-v6 { none; }; diff --git a/bin/tests/system/stress/setup.sh b/bin/tests/system/stress/setup.sh index d166e8e2c3..ebf3a8e7f9 100644 --- a/bin/tests/system/stress/setup.sh +++ b/bin/tests/system/stress/setup.sh @@ -19,3 +19,8 @@ # $PERL setup.pl + +copy_setports ns1/named.conf.in ns1/named.conf +copy_setports ns2/named.conf.in ns2/named.conf +copy_setports ns3/named.conf.in ns3/named.conf +copy_setports ns4/named.conf.in ns4/named.conf diff --git a/bin/tests/system/stress/tests.sh b/bin/tests/system/stress/tests.sh index ad7a5e8edc..9d36c6c5f5 100644 --- a/bin/tests/system/stress/tests.sh +++ b/bin/tests/system/stress/tests.sh @@ -18,7 +18,7 @@ status=0 ( $SHELL -c "while true - do $RNDC -c ../common/rndc.conf -s 10.53.0.3 -p 9953 reload 2>&1 | + do $RNDC -c ../common/rndc.conf -s 10.53.0.3 -p $CONTROLPORT reload 2>&1 | sed 's/^/I:ns3 /'; sleep 1 done" & echo $! >reload.pid @@ -26,7 +26,7 @@ $SHELL -c "while true for i in 0 1 2 3 4 do - $PERL update.pl -s 10.53.0.2 -p 5300 zone00000$i.example. & + $PERL update.pl -s 10.53.0.2 -p $PORT zone00000$i.example. & done echo_i "waiting for background processes to finish" @@ -35,5 +35,9 @@ wait echo_i "killing reload loop" kill `cat reload.pid` +# If the test has run to completion without named crashing, it has succeeded. +# Otherwise, the crash will be detected by the test framework and the test will +# fail. + echo_i "exit status: $status" [ $status -eq 0 ] || exit 1