afb-apiset: Fix start of apis
[src/app-framework-binder.git] / stress-server.sh
1 #!/bin/bash
2
3 ROOT=$(dirname $0)
4 cd ${ROOT:-.}
5 ROOT=$(pwd)
6 echo ROOT=$ROOT
7
8 AFB=build/src/afb-daemon
9 HELLO=build/bindings/samples/hello3.so
10 PORT=12345
11 TEST=test
12 TOKEN=knock-knock-knock
13
14 OUT=stress-out-server
15 rm $OUT*
16
17 tool=
18 ws=false
19 eval set -- $(getopt -o wgsv -l ws,gdb,strace,valgrind -- "$@") || exit
20 while true
21 do
22         case "$1" in
23         -w|--ws) ws=true; shift;;
24         -g|--gdb) tool=gdb; shift;;
25         -s|--strace) tool=strace; shift;;
26         -v|--valgrind) tool=valgrind; shift;;
27         --) shift; break;;
28         esac
29 done
30
31 case $tool in
32  gdb) cmd="$(type -p gdb) -ex run --args";;
33  valgrind) cmd="$(type -p valgrind) --leak-check=full";;
34  strace) cmd="$(type -p strace) -tt -f -o $OUT.strace";;
35  *) cmd=;;
36 esac
37
38 if $ws; then
39   CMD="$AFB -q --no-ldpaths --binding=$HELLO --session-max=100 --ws-server=unix:@afw/hello --no-httpd --exec $cmd $AFB --session-max=100 --port=$PORT --no-ldpaths --roothttp=$TEST --token=$TOKEN --ws-client=unix:@afw/hello "
40 else
41   CMD="$cmd $AFB -q --session-max=100 --port=$PORT --workdir=$ROOT --roothttp=$TEST --token=$TOKEN --no-ldpaths --binding=$HELLO"
42 fi
43
44
45 echo "launch: $CMD $@"
46 case $tool in
47  gdb) $CMD "$@";;
48  *) $CMD "$@" 2>&1 | tee $OUT;
49 esac
50 wait