ia64/xen-unstable

annotate tools/xenstore/testsuite/test.sh @ 5874:2ae19537f615

Allow test.sh to take arg: name of test to start with
Signed-off-by: Rusty Russel <rusty@rustcorp.com.au>
Signed-off-by: Christian Limpach <Christian.Limpach@cl.cam.ac.uk>
author cl349@firebug.cl.cam.ac.uk
date Tue Jul 26 15:21:32 2005 +0000 (2005-07-26)
parents 4e833037159d
children 2333f6616d18
rev   line source
cl349@5357 1 #! /bin/sh
cl349@5357 2
cl349@5357 3 set -e
cl349@5357 4 set -m
cl349@5357 5
cl349@5357 6 run_test()
cl349@5357 7 {
cl349@5357 8 rm -rf $XENSTORED_ROOTDIR
cl349@5357 9 mkdir $XENSTORED_ROOTDIR
cl349@5357 10 # Weird failures with this.
cl349@5357 11 if type valgrind >/dev/null 2>&1; then
cl349@5872 12 valgrind -q --logfile-fd=3 ./xenstored_test --output-pid --trace-file=testsuite/tmp/trace --no-fork 3>testsuite/tmp/vgout > /tmp/pid 2> testsuite/tmp/xenstored_errors &
cl349@5357 13 while [ ! -s /tmp/pid ]; do sleep 0; done
cl349@5357 14 PID=`cat /tmp/pid`
cl349@5357 15 rm /tmp/pid
cl349@5357 16 else
cl349@5357 17 PID=`./xenstored_test --output-pid`
cl349@5357 18 fi
cl349@5357 19 if sh -e $2 $1; then
cl349@5357 20 if [ -s testsuite/tmp/vgout ]; then
cl349@5357 21 kill $PID
cl349@5357 22 echo VALGRIND errors:
cl349@5357 23 cat testsuite/tmp/vgout
cl349@5357 24 return 1
cl349@5357 25 fi
cl349@5357 26 echo shutdown | ./xs_test
cl349@5357 27 return 0
cl349@5357 28 else
cl349@5357 29 # In case daemon is wedged.
cl349@5357 30 kill $PID
cl349@5357 31 sleep 1
cl349@5357 32 return 1
cl349@5357 33 fi
cl349@5357 34 }
cl349@5357 35
cl349@5874 36 MATCH=${1:-"*"}
cl349@5357 37 for f in testsuite/[0-9]*.sh; do
cl349@5874 38 case `basename $f` in $MATCH) RUN=1;; esac
cl349@5874 39 [ -n "$RUN" ] || continue
cl349@5357 40 if run_test $f; then
cl349@5357 41 echo Test $f passed...
cl349@5357 42 else
cl349@5357 43 echo Test $f failed, running verbosely...
cl349@5872 44 run_test $f -x || true
cl349@5872 45 # That will have filled the screen, repeat message.
cl349@5872 46 echo Test $f failed
cl349@5357 47 exit 1
cl349@5357 48 fi
cl349@5357 49 done