ia64/xen-unstable

annotate tools/xenstore/testsuite/test.sh @ 6039:9faafa21bf98

xenstored has had a testsuite for some time. This splits the test
targets into "make -s check" (the GNU standard) which is designed to run
in several seconds or less, with only "<dirname>:" and a seried of "."
for output, and "make fullcheck" which is more verbose and complete, and
runs in minutes.

I plan to submit a patch to plumb these tests in at the top level soon,
with the idea of having a "make -s check" which you can reasonable run
every checkin (time make check << time make), and a "make fullcheck"
which you can run after significant changes.

This patch speeds up testing by making tests one single "xs_test"
script, enhancing xs_test with a simple "expect" command. It also only
runs the "high value" tests under "make check", and leaves the rest for
"make fullcheck".

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
author kaf24@firebug.cl.cam.ac.uk
date Fri Aug 05 09:04:01 2005 +0000 (2005-08-05)
parents f294acb25858
children c51562192ef6 e3d811cca4e1 1ae656509f02 23979fb12c49 84ee014ebd41 99914b54f7bf 81576d3d1ca8 3a8f27c6d56c cc5f88b719d0
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
kaf24@6039 10 if [ $VALGRIND -eq 1 ]; then
cl349@5872 11 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 12 while [ ! -s /tmp/pid ]; do sleep 0; done
cl349@5357 13 PID=`cat /tmp/pid`
cl349@5357 14 rm /tmp/pid
cl349@5357 15 else
kaf24@6039 16 # We don't get error messages from this, though.
kaf24@6039 17 PID=`./xenstored_test --output-pid --trace-file=testsuite/tmp/trace`
cl349@5357 18 fi
kaf24@6039 19 if ./xs_test $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
kaf24@6039 36 if [ x$1 = x--fast ]; then
kaf24@6039 37 VALGRIND=0
kaf24@6039 38 SLOWTESTS=""
kaf24@6039 39 shift
kaf24@6039 40 else
kaf24@6039 41 if type valgrind >/dev/null 2>&1; then
kaf24@6039 42 VALGRIND=1
kaf24@6039 43 else
kaf24@6039 44 echo "WARNING: valgrind not available" >&2
kaf24@6039 45 VALGRIND=0
kaf24@6039 46 fi
kaf24@6039 47 SLOWTESTS=testsuite/[0-9]*.slowtest
kaf24@6039 48 fi
kaf24@6039 49
cl349@5874 50 MATCH=${1:-"*"}
kaf24@6039 51 for f in testsuite/[0-9]*.test $SLOWTESTS; do
cl349@5874 52 case `basename $f` in $MATCH) RUN=1;; esac
cl349@5874 53 [ -n "$RUN" ] || continue
kaf24@6039 54
kaf24@6039 55 if run_test $f > /dev/null; then
kaf24@6039 56 echo -n .
cl349@5357 57 else
cl349@5357 58 echo Test $f failed, running verbosely...
cl349@5872 59 run_test $f -x || true
cl349@5872 60 # That will have filled the screen, repeat message.
cl349@5872 61 echo Test $f failed
cl349@5357 62 exit 1
cl349@5357 63 fi
cl349@5357 64 done