runtest.sh 775 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
cd $testcase
21 22
pid=
for service in $services; do
23
	echo "Starting service '$service' of test '$testcase'"
24
	$busconsole $service.lua $testcase &
25
	pid="$pid $!"
26
	trap "kill $pid > /dev/null 2>&1" 0
27 28
done

29
echo -n "Executing test '$testcase' ... "
30
$busconsole client.lua $testcase
31
echo "OK"
32
cd ../../test
33
echo -n "Test protocol with server of test '$testcase' ... "
34
$busconsole openbus/test/Protocol.lua
35 36
echo "OK"
cd ../interop