]> git.ipfire.org Git - thirdparty/unbound.git/commitdiff
common.sh to version 2.
authorWouter Wijngaards <wouter@nlnetlabs.nl>
Fri, 18 Feb 2011 16:11:21 +0000 (16:11 +0000)
committerWouter Wijngaards <wouter@nlnetlabs.nl>
Fri, 18 Feb 2011 16:11:21 +0000 (16:11 +0000)
git-svn-id: file:///svn/unbound/trunk@2392 be551aaa-1e26-0410-a405-d3ace91eadb9

doc/Changelog
testdata/common.sh

index 41bea7e5693a1aa8420e7a1869516373a509b737..2c29903bfa3293b34c22f6277b8eef6a736cf976 100644 (file)
@@ -1,3 +1,6 @@
+18 February 2011: Wouter
+       - common.sh in testdata updated to version 2.
+
 15 February 2011: Wouter
        - Added explicit note on unbound-anchor usage:
          Please note usage of unbound-anchor root anchor is at your own risk
index bec2901ea75748ac4ee1d7a8d61c49d81b495129..7542ef6aed25df33a3fcfbd9fbb3040aa49fa125 100644 (file)
@@ -1,7 +1,8 @@
 # common.sh - an include file for commonly used functions for test code.
 # BSD licensed (see LICENSE file).
 #
-# Version 1
+# Version 2
+# 2011-02-18: ports check on BSD,Solaris. wait_nsd_up.
 # 2011-02-11: first version.
 #
 # include this file from a tpkg script with
@@ -21,6 +22,7 @@
 # wait_ldns_testns_up   : wait for ldns-testns to come up.
 # wait_unbound_up      : wait for unbound to come up.
 # wait_petal_up                : wait for petal to come up.
+# wait_nsd_up          : wait for nsd to come up.
 # wait_server_up_or_fail: wait for server to come up or print a failure string
 # kill_pid             : kill a server, make sure and wait for it to go down.
 
@@ -37,7 +39,7 @@ error () {
 # $0: name of program
 # $1: to printout.
 info () {
-           echo "$0: info: $1"
+       echo "$0: info: $1"
 }
 
 # test if 'tool' is available in path and complain otherwise.
@@ -105,7 +107,13 @@ get_random_port () {
                # depending on uname try to check for collisions in port numbers
                case "`uname`" in
                linux|Linux)
-                       plist=`netstat -n -A ip -A ip6 -a | sed -e "s/^.*:\([0-9]*\) .*$/\1/"`
+                       plist=`netstat -n -A ip -A ip6 -a | sed -e 's/^.*:\([0-9]*\) .*$/\1/'`
+               ;;
+               FreeBSD|freebsd|NetBSD|netbsd|OpenBSD|openbsd)
+                       plist=`netstat -n -a | grep "^[ut][dc]p[46] " | sed -e 's/^.*\.\([0-9]*\) .*$/\1/'`
+               ;;
+               Solaris|SunOS)
+                       plist=`netstat -n -a | sed -e 's/^.*\.\([0-9]*\) .*$/\1/' | grep '^[0-9]*$'`
                ;;
                *)
                        plist=""
@@ -168,6 +176,13 @@ wait_petal_up () {
        wait_server_up "$1" "petal start"
 }
 
+# wait for nsd to come up
+# string nsd start in log.
+# $1 : logfilename that is watched.
+wait_nsd_up () {
+       wait_server_up "$1" " started (NSD "
+}
+
 # wait for server to go up, pass <logfilename> <string to watch> <badstr>
 # $1 : logfile
 # $2 : success string