common.sh to version 2.

git-svn-id: file:///svn/unbound/trunk@2392 be551aaa-1e26-0410-a405-d3ace91eadb9
This commit is contained in:
Wouter Wijngaards 2011-02-18 16:11:21 +00:00
parent 01dd4a3568
commit d8928e1b19
2 changed files with 21 additions and 3 deletions

View 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

21
testdata/common.sh vendored
View 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