]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Added system test
authorDiego Fronza <diego@isc.org>
Fri, 31 Jan 2020 19:52:43 +0000 (16:52 -0300)
committerDiego Fronza <diego@isc.org>
Thu, 20 Feb 2020 14:19:13 +0000 (11:19 -0300)
Added a system test which ensures that named-checkzone works when
taking input data from stdin.

bin/tests/system/checkzone/clean.sh
bin/tests/system/checkzone/tests.sh
bin/tests/system/checkzone/zones/zone1.db [new file with mode: 0644]

index 95d3caaaae61db247abea3f7e2d0de5b51b3442c..8b50fdba5c35123fc10e49d89247c5cd7faeb7fc 100644 (file)
@@ -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
index 022c3111cdabc0a7208be657d6681336424eec8d..0ba9d5dc4674722486e82e278d6ceeb03ebb70aa 100644 (file)
@@ -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 (file)
index 0000000..df9a018
--- /dev/null
@@ -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