timeout.sh 897 Bytes
Newer Older
1 2 3 4 5 6
#!/bin/bash -x

if [ -z $srcdir ]; then
    echo srcdir variable not set.
    exit 1
fi
7 8 9 10 11 12

if [ -z "$MKTEMP" ] ; then
    echo expected MKTEMP variable defined to its respective command
    exit 1
fi

Philip Carns's avatar
Philip Carns committed
13
source $srcdir/tests/test-util.sh
14

15
TMPOUT=$($MKTEMP --tmpdir test-XXXXXX)
16 17 18 19 20 21 22 23 24

# start 1 server with 2 second wait, 8s timeout
test_start_servers 1 2 8

sleep 1

#####################

# run client test
25
run_to 10 tests/margo-test-client-timeout $svr1 &> $TMPOUT 
26 27
if [ $? -ne 0 ]; then
    wait
28
    rm -rf $TMPOUT
29 30 31
    exit 1
fi

32
# check output; look for four "returned 2" to indicate HG_TIMEOUT in the four
33
# concurrent RPCs
34 35 36
LINECOUNT=$(grep "returned 2" $TMPOUT | wc -l) 
if [ $LINECOUNT -ne 4 ]; then
    rm -rf $TMPOUT
37 38 39 40 41 42 43 44 45 46
    exit 1
fi

#####################

# note that this test leaves the server running; it will be killed after the
# 8s timeout from test_start_servers

wait

47
rm -rf $TMPOUT
48
exit 0