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

3 4
mode=$1
testcase=$2
5 6
tasks=$3
services=$4
7

8 9 10
sdklua_interop=`dirname "$(readlink -f "$0")"`

busconsole="env LUA_PATH=${OPENBUS_SDKLUA_TEST}/?.lua;${sdklua_interop}/lua/?.lua ${OPENBUS_SDKLUA_HOME}/bin/busconsole"
11

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

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

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

33 34
for task in $tasks; do
	echo -n "Executing task '$task' of test '$testcase' ... "
35
	$busconsole $task.lua $testcase
36 37 38
	echo "OK"
done

39
cd ../../test
40
echo -n "Test protocol with server of test '$testcase' ... "
41
$busconsole openbus/test/Protocol.lua
42 43
echo "OK"
cd ../interop