summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Rühsen <tim.ruehsen@gmx.de>2019-05-10 13:31:23 +0200
committerTim Rühsen <tim.ruehsen@gmx.de>2019-05-10 13:31:23 +0200
commita2261899c69cde406731cf661431ced0a42bb302 (patch)
treeb9daafaf0136a2c7e5cfd1d43a7091482aefcbd3
parent9509af0e791b74538de8ffa8dd0d47c05cb08eed (diff)
downloadgnutls-tmp-fix-GETPORT.tar.gz
Fix endless looping GETPORT in tests/scripts/common.shtmp-fix-GETPORT
Signed-off-by: Tim Rühsen <tim.ruehsen@gmx.de>
-rw-r--r--tests/scripts/common.sh17
1 files changed, 10 insertions, 7 deletions
diff --git a/tests/scripts/common.sh b/tests/scripts/common.sh
index d34915e1d7..f99ce69d2e 100644
--- a/tests/scripts/common.sh
+++ b/tests/scripts/common.sh
@@ -59,13 +59,16 @@ check_if_port_listening() {
}
# Find a port number not currently in use.
-GETPORT='rc=0; unset myrandom
- if test -n "$RANDOM"; then myrandom=$(($RANDOM + $RANDOM)); fi
- if test -z "$myrandom"; then myrandom=$(date +%N | sed s/^0*//); fi
- if test -z "$myrandom"; then myrandom=0; fi
- while test $rc = 0;do
- PORT="$(((($$<<15)|$myrandom) % 63001 + 2000))"
- check_if_port_in_use $PORT;rc=$?
+GETPORT='
+ rc=0
+ unset myrandom
+ while test $rc = 0; do
+ if test -n "$RANDOM"; then myrandom=$(($RANDOM + $RANDOM)); fi
+ if test -z "$myrandom"; then myrandom=$(date +%N | sed s/^0*//); fi
+ if test -z "$myrandom"; then myrandom=0; fi
+ PORT="$(((($$<<15)|$myrandom) % 63001 + 2000))"
+ check_if_port_in_use $PORT;rc=$?
+ echo "PORT=$PORT rc=$rc myrandom=$myrandom"
done
'