From: Diego Fronza Date: Fri, 31 Jan 2020 19:52:43 +0000 (-0300) Subject: Added system test X-Git-Tag: v9.17.1~105^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a3453c257b884f56ce32acc9a1290449d18399af;p=thirdparty%2Fbind9.git Added system test Added a system test which ensures that named-checkzone works when taking input data from stdin. --- diff --git a/bin/tests/system/checkzone/clean.sh b/bin/tests/system/checkzone/clean.sh index 95d3caaaae6..8b50fdba5c3 100644 --- a/bin/tests/system/checkzone/clean.sh +++ b/bin/tests/system/checkzone/clean.sh @@ -9,3 +9,4 @@ rm -f test.* good1.db.map good1.db.raw named-compilezone rm -f ns*/named.lock +rm -f zones/zone1_*.txt diff --git a/bin/tests/system/checkzone/tests.sh b/bin/tests/system/checkzone/tests.sh index 022c3111cda..0ba9d5dc467 100644 --- a/bin/tests/system/checkzone/tests.sh +++ b/bin/tests/system/checkzone/tests.sh @@ -182,5 +182,27 @@ n=`expr $n + 1` if [ $ret != 0 ]; then echo_i "failed"; fi status=`expr $status + $ret` +n=`expr $n + 1` +echo_i "checking that named-compilezone works when reading input from stdin ($n)" +ret=0 +# Step 1: take raw input from stdin and convert it to text/relative format. +# Last argument "-" is optional, but it says more explicitly that we're reading from stdin. +cat zones/zone1.db | ./named-compilezone -f text -F text -s relative \ + -o zones/zone1_stdin.txt zone1.com - > /dev/null || ret=1 +status=`expr $status + $ret` + +ret=0 +# Step 2: take raw input from file and convert it to text format. +./named-compilezone -f text -F text -s relative -o zones/zone1_file.txt \ + zone1.com zones/zone1.db > /dev/null || ret=1 +status=`expr $status + $ret` + +ret=0 +# Step 3: Ensure that output conversion from stdin is the same as the output conversion from a file. +$DIFF zones/zone1_file.txt zones/zone1_stdin.txt >/dev/null 2>&1 || ret=1 +status=`expr $status + $ret` + +if [ $ret != 0 ]; then echo_i "failed"; fi + echo_i "exit status: $status" [ $status -eq 0 ] || exit 1 diff --git a/bin/tests/system/checkzone/zones/zone1.db b/bin/tests/system/checkzone/zones/zone1.db new file mode 100644 index 00000000000..df9a018b360 --- /dev/null +++ b/bin/tests/system/checkzone/zones/zone1.db @@ -0,0 +1,10 @@ +zone1.com. 86400 IN SOA dns1.zone1.com. hostmaster.zone1.com. 2001062501 21600 3600 604800 86400 +zone1.com. 86400 IN NS dns1.zone1.com. +zone1.com. 86400 IN NS dns2.zone1.com. +zone1.com. 86400 IN A 10.53.0.1 +zone1.com. 86400 IN MX 10 mail1.zone1.com. +zone1.com. 86400 IN MX 20 mail2.zone1.com. +dns1.zone1.com. 86400 IN A 10.53.0.1 +dns2.zone1.com. 86400 IN A 10.53.0.2 +mail1.zone1.com. 86400 IN A 10.53.0.1 +mail2.zone1.com. 86400 IN A 10.53.0.2