-case "$1" in
- --ws)
- shift
- ARGS="-q --no-ldpaths --binding=$HELLO --session-max=100 --ws-server=unix:@afw:hello --no-httpd --exec $AFB --session-max=100 --port=$PORT --no-ldpaths --roothttp=$TEST --token=$TOKEN --ws-client=unix:@afw:hello "
-# ARGS="$ARGS -vvv --tracereq=all"
- ;;
- *)
- 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=;;