From: Wouter Wijngaards Date: Thu, 4 Jan 2007 11:03:29 +0000 (+0000) Subject: testbed scripts. X-Git-Tag: release-0.0~113 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e498742aea91051680ec6b871a6ce43b11f64a43;p=thirdparty%2Funbound.git testbed scripts. git-svn-id: file:///svn/unbound/trunk@12 be551aaa-1e26-0410-a405-d3ace91eadb9 --- diff --git a/doc/Changelog b/doc/Changelog index 0e1c12118..e2d506897 100644 --- a/doc/Changelog +++ b/doc/Changelog @@ -1,3 +1,6 @@ +4 January 2007: Wouter + - Testbed script (run on multiple platforms the test set). + 3 January 2007: Wouter - committed first set of files into subversion repository. svn co svn+ssh://unbound.net/svn/unbound diff --git a/testcode/do-tests.sh b/testcode/do-tests.sh new file mode 100755 index 000000000..c85ba5366 --- /dev/null +++ b/testcode/do-tests.sh @@ -0,0 +1,7 @@ +#!/usr/bin/env bash + +cd testdata; +for test in `ls *.tpkg`; do + echo $test + tpkg -a ../.. exe $test +done diff --git a/testcode/testbed.sh b/testcode/testbed.sh new file mode 100755 index 000000000..f1cf76183 --- /dev/null +++ b/testcode/testbed.sh @@ -0,0 +1,117 @@ +#!/usr/bin/env bash +# Testbed for NSD. +# By Wouter Wijngaards, NLnet Labs, 2006. +# BSD License. + +# this version prefers gmake if available. +# adds variable LDNS for the LDNS path to use. + +# global settings +CONFIGURE_FLAGS="" +REPORT_FILE=testdata/testbed.report +LOG_FILE=testdata/testbed.log +HOST_FILE=testdata/host_file.$USER + +function echossh() # like ssh but echos. +{ + echo "> ssh $*" + ssh $* +} + +# Compile and run NSD on platforms +function dotest() +# parameters: +# host is name of ssh host +# dir is directory of nsd trunk on host +{ + echo "$1 begin on "`date` | tee -a $REPORT_FILE + + if test $SVN = yes; then + echossh $1 "cd $2; svn up" + echossh $1 "cd $2; if test ! -f configure -o configure.ac -nt configure; then $AC_CMD; fi" + else + # svn and autoconf locally + echo "fake svn via svnexport, tar, autoconf, bison, flex." + svn export svn+ssh://open.nlnetlabs.nl/svn/nsd/trunk unbound_ttt + (cd unbound_ttt; $AC_CMD; rm -r autom4te* .c-mode-rc.el .cvsignore) + if test "need_fixup_flexbison" = "yes"; then + (cd unbound_ttt; \ + echo "#include " > zlexer.c ; \ + flex -i -t zlexer.lex >> zlexer.c ; \ + bison -y -d -o zparser.c zparser.y ; \ + echo "#include \"configyyrename.h\"" > configlexer.c ; \ + flex -i -t configlexer.lex >> configlexer.c ; \ + bison -y -d -o configparser.c configparser.y ) + fi + if test $FIXCONFIGURE = yes; then + echo fixing up configure length test. + (cd unbound_ttt; mv configure oldconf; sed -e 's?while (test "X"?lt_cv_sys_max_cmd_len=65500; echo skip || while (test "X"?' configure; chmod +x ./configure) + fi + du unbound_ttt + rsync -vrcpz --rsync-path=/home/wouter/bin/rsync unbound_ttt $1:unbound_ttt + # tar czf unbound_ttt.tgz unbound_ttt + rm -rf unbound_ttt + # ls -al unbound_ttt.tgz + # scp unbound_ttt.tgz $1:unbound_ttt.tar.gz + # rm unbound_ttt.tgz + # echossh $1 "gtar xzf unbound_ttt.tar.gz && rm unbound_ttt.tar.gz" + fi + DISABLE="" + if test $IP6 = no; then + DISABLE="--disable-ipv6" + fi + if test x$LDNS != x; then + DISABLE="--with-ldns=$LDNS $DISABLE" + fi + echossh $1 "cd $2; if test ! -f config.h -o configure -nt config.h; then ./configure $CONFIGURE_FLAGS $DISABLE; fi" + echossh $1 "cd $2; if which gmake; then gmake; else $MAKE_CMD; fi" + if test $RUN_TEST = yes; then + echossh $1 "cd $2/testdata; tpkg clean" + echossh $1 "cd $2; bash testcode/do-tests.sh" + echossh $1 "cd $2/testdata; tpkg -q report" | tee -a $REPORT_FILE + fi + echo "$1 end on "`date` | tee -a $REPORT_FILE +} + +echo "on "`date`" by $USER." > $REPORT_FILE +echo "on "`date`" by $USER." > $LOG_FILE + +# read host names +declare -a hostname desc dir vars +IFS=' ' +i=0 +while read a b c d; do + if echo $a | grep "^#" >/dev/null; then + continue # skip it + fi + # append after arrays + hostname[$i]=$a + desc[$i]=$b + dir[$i]=$c + vars[$i]=$d + i=$(($i+1)) +done <$HOST_FILE +echo "testing on $i hosts" + +# do the test +for((i=0; i<${#hostname[*]}; i=$i+1)); do + if echo ${hostname[$i]} | grep "^#" >/dev/null; then + continue # skip it + fi + # echo "hostname=[${hostname[$i]}]" + # echo "desc=[${desc[$i]}]" + # echo "dir=[${dir[$i]}]" + # echo "vars=[${vars[$i]}]" + AC_CMD="libtoolize -c; autoconf && autoheader" + MAKE_CMD="make" + SVN=yes + IP6=yes + FIXCONFIGURE=no + RUN_TEST=yes + LDNS= + eval ${vars[$i]} + echo "*** ${hostname[$i]} ${desc[$i]} ***" | tee -a $LOG_FILE | tee -a $REPORT_FILE + dotest ${hostname[$i]} ${dir[$i]} | tee -a $LOG_FILE +done + +echo "done" diff --git a/testdata/host_file.template b/testdata/host_file.template new file mode 100644 index 000000000..77b674c6e --- /dev/null +++ b/testdata/host_file.template @@ -0,0 +1,5 @@ +# list of hosts and options for each. You need keyed ssh access to each. +# It must be one tab delimited only. Very strict syntax. +# hostname description directory variables +linux.example.com Linux Fedora Core i386 src/unbound/trunk +solaris.example.com Solaris 10 sparc64 nsd_trunk LDNS=/var/local/ldns