From d8928e1b1966ce0c88e80f2b55795876a3125554 Mon Sep 17 00:00:00 2001 From: Wouter Wijngaards Date: Fri, 18 Feb 2011 16:11:21 +0000 Subject: [PATCH] common.sh to version 2. git-svn-id: file:///svn/unbound/trunk@2392 be551aaa-1e26-0410-a405-d3ace91eadb9 --- doc/Changelog | 3 +++ testdata/common.sh | 21 ++++++++++++++++++--- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/doc/Changelog b/doc/Changelog index 41bea7e56..2c29903bf 100644 --- a/doc/Changelog +++ b/doc/Changelog @@ -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 diff --git a/testdata/common.sh b/testdata/common.sh index bec2901ea..7542ef6ae 100644 --- a/testdata/common.sh +++ b/testdata/common.sh @@ -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 # $1 : logfile # $2 : success string -- 2.47.2