]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
The system tests are using another IP address
authorTony Finch <fanf@isc.org>
Wed, 31 Aug 2022 20:09:06 +0000 (21:09 +0100)
committerTony Finch <fanf@isc.org>
Mon, 12 Sep 2022 11:13:04 +0000 (12:13 +0100)
Reduce the number of places that know about the number of IP addresses
required by the system tests, by changing `testsock.pl` to read the
`max` from `ifconfig.sh.in`. This should make the test runner fail
early with a clear message when the interfaces have been set up by an
obsolete script.

Add comments to cross-reference `ifconfig.sh.in`, `testsock.pl`, and
`org.isc.bind.system` to make it easier to remember what needs
updating when an IP address is added.

bin/tests/system/ifconfig.sh.in
bin/tests/system/org.isc.bind.system
bin/tests/system/testsock.pl

index 76233d6184c304faf0932dccfa38edce030cec0c..298bd3f041d3ec7b845bdc019cf1d0957d9522e9 100755 (executable)
 # We also set the MTU on the 1500 bytes to match the default MTU on physical
 # interfaces, so we can properly test the cases with packets bigger than
 # interface MTU.
+#
+# See also org.isc.bind.system (a version of this script for use on macOS)
+# and testsock.pl (which checks the interfaces are configured)
+#
 
 top_srcdir=@abs_top_srcdir@
 
@@ -237,6 +241,10 @@ sequence() (
 # 'ns' in the namserver being configured.
 # 'int' interface identifier.
 #
+# See also `org.isc.bind.system`.
+#
+# This `max` setting is grepped out for use by testsock.pl
+#
 max=11
 case $1 in
     start|up|stop|down)
index 276437ad6e75dd61e41f9b6a06af4ae25515bed2..6c5a8cd4fe02078bcdad73f76f62e7ea2b21336f 100644 (file)
 # See the COPYRIGHT file distributed with this work for additional
 # information regarding copyright ownership.
 
+# see also ifconfig.sh.in and testsock.pl
+
 ifup() {
        /sbin/ifconfig lo0 10.53.$1.$3 alias
        /sbin/ifconfig lo0 inet6 fd92:7065:b8e:${2}ff::${3} alias
 }
 
-for ns in 1 2 3 4 5 6 7 8 9 10
+for ns in 1 2 3 4 5 6 7 8 9 10 11
 do
        ifup 0 ff $ns
 done
index e9448ed380286c414d6f73e0ababc3a69d1b1f0b..5073a815fb73eb2f90d8e328e7ea1c052c74e88a 100755 (executable)
@@ -27,7 +27,15 @@ my @ids;
 if ($id != 0) {
        @ids = ($id);
 } else {
-       @ids = (1..8);
+       my $fn = "ifconfig.sh.in";
+       open FH, "< $fn" or die "open < $fn: $!\n";
+       while (<FH>) {
+               @ids = (1..$1)
+                   if /^max=(\d+)\s*$/;
+       }
+       close FH;
+       die "could not find max IP address in $fn\n"
+           unless @ids > 1;
 }
 
 foreach $id (@ids) {