runtest.sh 916 Bytes
Newer Older
1 2
#!/bin/bash

3 4 5
mode=$1
testcase=$2
services="server"
6

7
busconsole="env LUA_PATH=${OPENBUS_SDKLUA_TEST}/?.lua ${OPENBUS_SDKLUA_HOME}/bin/busconsole"
8

9 10 11 12
if [[ "$mode" == "DEBUG" ]]; then
	busconsole="$busconsole -d"
elif [[ "$mode" != "RELEASE" ]]; then
	echo "Usage: $0 <RELEASE|DEBUG> <args>"
13 14 15 16 17 18 19
	exit 1
fi

if [[ ${#@} > 2 ]]; then
	services="${@:3:${#@}}"
fi

20 21 22 23 24
# let all previous offers to expire
leasetime=`$busconsole -l openbus.test.configs -e 'print(leasetime)'`
sleep $leasetime
sleep $leasetime

25
cd $testcase
26 27
pid=
for service in $services; do
28
	echo "Starting service '$service' of test '$testcase'"
29
	$busconsole $service.lua $testcase &
30
	pid="$pid $!"
31
	trap "kill $pid > /dev/null 2>&1" 0
32 33
done

34
echo -n "Executing test '$testcase' ... "
35
$busconsole client.lua $testcase
36
echo "OK"
37
cd ../../test
38
echo -n "Test protocol with server of test '$testcase' ... "
39
$busconsole openbus/test/Protocol.lua
40 41
echo "OK"
cd ../interop