X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?p=src%2Fapp-framework-binder.git;a=blobdiff_plain;f=stress-server.sh;h=1649e64d57f2569cb8c702917c497b5ba05fd59c;hp=35b7ac48e17249b9efab7f31e577358d91042a0d;hb=f3d1f19ae308cc0559728c0ccf6281cbce5ee37c;hpb=32518ea65c0eb94f516a929bb63387ca53d138c5 diff --git a/stress-server.sh b/stress-server.sh index 35b7ac48..1649e64d 100755 --- a/stress-server.sh +++ b/stress-server.sh @@ -1,41 +1,50 @@ #!/bin/bash ROOT=$(dirname $0) +cd ${ROOT:-.} +ROOT=$(pwd) echo ROOT=$ROOT -cd $ROOT -pwd - AFB=build/src/afb-daemon -HELLO=build/bindings/samples/helloWorld.so +HELLO=build/bindings/samples/hello3.so PORT=12345 TEST=test TOKEN=knock-knock-knock -OUT=stress-out-server +OUT=stress-out-server rm $OUT* -case "$1" in - --ws) - shift - ARGS="-q --ldpaths=/tmp --binding=$HELLO --session-max=100 --ws-server=unix:hello --no-httpd --exec $AFB --session-max=100 --port=$PORT --ldpaths=/tmp --roothttp=$TEST --token=$TOKEN --ws-client=unix:hello " -# ARGS="-vv --tracereq=all --ldpaths=/tmp --binding=$HELLO --session-max=100 --ws-server=unix:hello --no-httpd --exec $AFB --session-max=100 --port=$PORT --ldpaths=/tmp --roothttp=$TEST --token=$TOKEN --ws-client=unix:hello " - ;; - *) - ARGS="-q --session-max=100 --port=$PORT --workdir=$ROOT --roothttp=$TEST --token=$TOKEN --ldpaths=/tmp --binding=$HELLO" - ;; +tool= +ws=false +eval set -- $(getopt -o wgsv -l ws,gdb,strace,valgrind -- "$@") || exit +while true +do + case "$1" in + -w|--ws) ws=true; shift;; + -g|--gdb) tool=gdb; shift;; + -s|--strace) tool=strace; shift;; + -v|--valgrind) tool=valgrind; shift;; + --) shift; break;; + esac +done + +case $tool in + gdb) cmd="$(type -p gdb) -ex run --args";; + valgrind) cmd="$(type -p valgrind) --leak-check=full";; + strace) cmd="$(type -p strace) -tt -f -o $OUT.strace";; + *) cmd=;; esac +if $ws; then + 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 " +else + CMD="$cmd $AFB -q --session-max=100 --port=$PORT --workdir=$ROOT --roothttp=$TEST --token=$TOKEN --no-ldpaths --binding=$HELLO" +fi + -echo $AFB $ARGS $@ -echo -n launch afb... -case "$1" in - gdb) shift; gdb $AFB -ex "run $ARGS $@";; - valgrind) shift; valgrind --leak-check=full $AFB $ARGS $@ 2>&1 | tee $OUT;; - strace) shift; strace -tt -f -o $OUT.strace $AFB $ARGS $@ 2>&1 | tee $OUT;; - *) $AFB $ARGS $@ 2>&1 | tee $OUT;; +echo "launch: $CMD $@" +case $tool in + gdb) $CMD "$@";; + *) $CMD "$@" 2>&1 | tee $OUT; esac -#$AFB -q --session-max=100 --port=$PORT --workdir=$ROOT --roothttp=$TEST --token=$TOKEN --ldpaths=/tmp --binding=$HELLO > $OUT.0 2>&1 & -#afbpid=$! -#strace -tt -f -o $OUT-strace.0 -p $afbpid & wait