ia64/xen-unstable

view tools/xenstore/testsuite/test.sh @ 5991:a2f9f958fb14

Fix up non-valgrind case to send stderr to file like valgrind case does.
(Having trouble with signal delivery and valgrind, causing spurious test
timeouts)
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 Aug 02 17:59:59 2005 +0000 (2005-08-02)
parents 2333f6616d18
children d4fd332df775 04dfb5158f3a f294acb25858
line source
1 #! /bin/sh
3 set -e
4 set -m
6 run_test()
7 {
8 rm -rf $XENSTORED_ROOTDIR
9 mkdir $XENSTORED_ROOTDIR
10 # Weird failures with this.
11 if type valgrind >/dev/null 2>&1; then
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 &
13 while [ ! -s /tmp/pid ]; do sleep 0; done
14 PID=`cat /tmp/pid`
15 rm /tmp/pid
16 else
17 ./xenstored_test --output-pid --trace-file=testsuite/tmp/trace --no-fork > /tmp/pid 2> testsuite/tmp/xenstored_errors &
18 while [ ! -s /tmp/pid ]; do sleep 0; done
19 PID=`cat /tmp/pid`
20 rm /tmp/pid
21 fi
22 if sh -e $2 $1; then
23 if [ -s testsuite/tmp/vgout ]; then
24 kill $PID
25 echo VALGRIND errors:
26 cat testsuite/tmp/vgout
27 return 1
28 fi
29 echo shutdown | ./xs_test
30 return 0
31 else
32 # In case daemon is wedged.
33 kill $PID
34 sleep 1
35 return 1
36 fi
37 }
39 MATCH=${1:-"*"}
40 for f in testsuite/[0-9]*.sh; do
41 case `basename $f` in $MATCH) RUN=1;; esac
42 [ -n "$RUN" ] || continue
43 if run_test $f; then
44 echo Test $f passed...
45 else
46 echo Test $f failed, running verbosely...
47 run_test $f -x || true
48 # That will have filled the screen, repeat message.
49 echo Test $f failed
50 exit 1
51 fi
52 done