diff --git a/scripts/get-put.test b/scripts/get-put.test index 10a30561..1c29fc79 100755 --- a/scripts/get-put.test +++ b/scripts/get-put.test @@ -45,12 +45,14 @@ READY_COUNTER=0 wait_for_server() { - while [ ! -s "$READY_FILE" ] && [ "$READY_COUNTER" -lt 20 ]; do + while [ ! -s "$READY_FILE" ] && [ "$READY_COUNTER" -lt 100 ]; do sleep 0.1 READY_COUNTER=$((READY_COUNTER+ 1)) done - if test -e "$READY_FILE" + # -s, not -e: the echoserver creates the file empty and writes the + # port afterward, so -e can catch it mid-write and yield no port + if [ -s "$READY_FILE" ] then # get created port 0 ephemeral port PORT=$(cat "$READY_FILE") diff --git a/scripts/scp.test b/scripts/scp.test index 20f9737e..b13751e3 100755 --- a/scripts/scp.test +++ b/scripts/scp.test @@ -25,13 +25,15 @@ fi create_port() { # each server gets its own wait budget, the count must not carry over counter=0 - while [ ! -s "$ready_file" ] && [ "$counter" -lt 20 ]; do + while [ ! -s "$ready_file" ] && [ "$counter" -lt 100 ]; do echo -e "waiting for ready file..." sleep 0.1 counter=$((counter+ 1)) done - if test -e $ready_file; then + # -s, not -e: the echoserver creates the file empty and writes the + # port afterward, so -e can catch it mid-write and yield no port + if [ -s "$ready_file" ]; then echo -e "found ready file, starting client..." # get created port 0 ephemeral port diff --git a/scripts/sftp.test b/scripts/sftp.test index 3d5304cf..ac1a0000 100755 --- a/scripts/sftp.test +++ b/scripts/sftp.test @@ -35,7 +35,7 @@ create_port() { # counted per server start, so a slow first start cannot eat the wait # the later ones need counter=0 - while [ ! -s "$ready_file" ] && [ "$counter" -lt 20 ]; do + while [ ! -s "$ready_file" ] && [ "$counter" -lt 100 ]; do echo "waiting for ready file..." sleep 0.1 counter=$((counter+ 1))