From: Fred Morcos Date: Thu, 7 Mar 2024 13:39:01 +0000 (+0100) Subject: Cleanup remotebackend testrunner script X-Git-Tag: rec-5.1.0-alpha1~118^2~1 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=6b536e09b591585c49e86767e17810684f4e4926;p=thirdparty%2Fpdns.git Cleanup remotebackend testrunner script --- diff --git a/modules/remotebackend/testrunner.sh b/modules/remotebackend/testrunner.sh index a33fc470cc..947b71a8e1 100755 --- a/modules/remotebackend/testrunner.sh +++ b/modules/remotebackend/testrunner.sh @@ -24,19 +24,20 @@ socat=$(which socat) function start_web() { local service_logfile="${mode%\.test}_server.log" - ./unittest_${1}.rb >> ${service_logfile} 2>&1 & + ./unittest_"${1}".rb >> "${service_logfile}" 2>&1 & webrick_pid=$! local timeout=0 while [ ${timeout} -lt 20 ]; do - local res=$(curl http://localhost:62434/ping 2>/dev/null) - if [ "x$res" == "xpong" ]; then + local res + res=$(curl http://localhost:62434/ping 2>/dev/null) + if [ "$res" == "pong" ]; then # server is up and running return 0 fi sleep 1 - let timeout=timeout+1 + (( timeout=timeout+1 )) done if kill -0 ${webrick_pid} 2>/dev/null; then @@ -73,7 +74,7 @@ function stop_web() { fi sleep 1 - let timeout=timeout+1 + (( timeout=timeout+1 )) done if kill -0 ${webrick_pid} 2>/dev/null; then @@ -91,7 +92,7 @@ function start_zeromq() { local service_logfile="${mode%\.test}_server.log" - ./unittest_zeromq.rb >> ${service_logfile} 2>&1 & + ./unittest_zeromq.rb >> "${service_logfile}" 2>&1 & zeromq_pid=$! local timeout=0 @@ -102,7 +103,7 @@ function start_zeromq() { fi sleep 1 - let timeout=timeout+1 + (( timeout=timeout+1 )) done if kill -0 ${zeromq_pid} 2>/dev/null; then @@ -138,7 +139,7 @@ function stop_zeromq() { fi sleep 1 - let timeout=timeout+1 + (( timeout=timeout+1 )) done if kill -0 ${zeromq_pid} 2>/dev/null; then @@ -149,7 +150,7 @@ function stop_zeromq() { } function start_unix() { - if [ -z "$socat" -o ! -x "$socat" ]; then + if [ -z "$socat" ] || [ ! -x "$socat" ]; then echo "INFO: Skipping \"UNIX socket\" test because \"socat\" executable wasn't found!" exit 77 fi @@ -165,7 +166,7 @@ function start_unix() { fi sleep 1 - let timeout=timeout+1 + (( timeout=timeout+1 )) done if kill -0 ${socat_pid} 2>/dev/null; then @@ -199,7 +200,7 @@ function stop_unix() { fi sleep 1 - let timeout=timeout+1 + (( timeout=timeout+1 )) done if kill -0 ${socat_pid} 2>/dev/null; then @@ -211,13 +212,13 @@ function stop_unix() { function run_test() { if [ $new_api -eq 0 ]; then - ./$mode + ./"$mode" else $orig fi } -mode=`basename "$mode"` +mode=$(basename "$mode") case "$mode" in remotebackend_pipe.test)