source: trunk/packages/xen-3.1/xen-3.1/tools/xenstore/testsuite/test.sh @ 34

Last change on this file since 34 was 34, checked in by hartmans, 18 years ago

Add xen and xen-common

  • Property svn:executable set to *
File size: 1.3 KB
Line 
1#! /bin/sh
2
3set -e
4set -m
5
6run_test()
7{
8    rm -rf $XENSTORED_ROOTDIR
9    mkdir $XENSTORED_ROOTDIR
10    if [ $VALGRIND -eq 1 ]; then
11        valgrind --suppressions=testsuite/vg-suppressions -q ./xenstored_test --output-pid --trace-file=testsuite/tmp/trace --no-fork > /tmp/pid 2> testsuite/tmp/xenstored_errors &
12        while [ ! -s /tmp/pid ]; do sleep 0; done
13        PID=`cat /tmp/pid`
14        rm /tmp/pid
15    else
16        # We don't get error messages from this, though.
17        PID=`./xenstored_test --output-pid --trace-file=testsuite/tmp/trace`
18    fi
19    if ./xs_test $2 $1; then
20        if [ -s testsuite/tmp/xenstored_errors ]; then
21            kill $PID
22            echo Errors:
23            cat testsuite/tmp/xenstored_errors
24            return 1
25        fi
26        kill $PID
27        sleep 1
28        return 0
29    else
30        # In case daemon is wedged.
31        kill $PID
32        sleep 1
33        return 1
34    fi
35}
36
37if [ x$1 = x--fast ]; then
38    VALGRIND=0
39    SLOWTESTS=""
40    shift
41else
42    if type valgrind >/dev/null 2>&1; then
43        VALGRIND=1
44    else
45        echo "WARNING: valgrind not available" >&2
46        VALGRIND=0
47    fi
48    SLOWTESTS=testsuite/[0-9]*.slowtest
49fi
50
51MATCH=${1:-"*"}
52for f in testsuite/[0-9]*.test $SLOWTESTS; do
53    case `basename $f` in $MATCH) RUN=1;; esac
54    [ -n "$RUN" ] || continue
55
56    if run_test $f -x >/tmp/out; then
57        echo -n .
58    else
59        cat /tmp/out
60        # That will have filled the screen, repeat message.
61        echo Test $f failed
62        exit 1
63    fi
64done
Note: See TracBrowser for help on using the repository browser.