runTest.sh 1.04 KB
Newer Older
1 2 3 4 5 6 7 8 9 10
# /bin/sh

EXPECTED_ARGS=1

if [ $# -lt $EXPECTED_ARGS ]
then
    echo "Usage: `basename $0` test-case"
    exit
fi

11
SERVER_FILE=.server.pid
12 13
export SERVER_FILE

14 15 16
RE_SERVER_FILE=re_server.pid
export RE_SERVER_FILE

17 18 19 20
# kill running server
if [ -e ${SERVER_FILE} ]
then
    kill -KILL `cat ${SERVER_FILE}`
Lukáš Marek's avatar
Lukáš Marek committed
21
    rm ${SERVER_FILE}
22 23
fi

24 25 26 27 28 29 30 31
# kill running server
if [ -e ${RE_SERVER_FILE} ]
then
    kill -KILL `cat ${RE_SERVER_FILE}`
    rm ${RE_SERVER_FILE}
fi


32
# represents the observed program
33 34
TARGET_CLASS="ch.usi.dag.disl.test.$1.TargetClass"

35
# compile the test package - suppress output
36
ant package-test -Dtest.name=$1 > /dev/null
37 38 39 40 41 42 43 44

INSTR_LIB=build/disl-instr.jar

# start server and take pid
./runServer.sh ${INSTR_LIB}

# start reserver and take pid
./runREServer.sh ${INSTR_LIB}
45 46 47 48 49

# wait for server startup
sleep 3

# run client
50
./runClient.sh ${INSTR_LIB} -cp bin/ ${TARGET_CLASS}
51 52 53 54

# wait for server shutdown
sleep 1

55
# kill server
56
kill -KILL `cat ${SERVER_FILE}` 2> /dev/null
Lukáš Marek's avatar
Lukáš Marek committed
57
rm ${SERVER_FILE}
58 59
kill -KILL `cat ${RE_SERVER_FILE}` 2> /dev/null
rm ${RE_SERVER_FILE}