From 85f64caf87b195c0cd92d23f30df69cf689a603e Mon Sep 17 00:00:00 2001 From: craff Date: Sat, 11 Dec 2021 23:27:35 -1000 Subject: [PATCH] kill %1 in test is not robust enough --- examples/run_test.sh | 4 +++- tests/download_chunked.sh | 3 ++- tests/echo1.sh | 3 ++- tests/sse_count.sh | 3 ++- tests/upload_chunked.sh | 3 ++- 5 files changed, 11 insertions(+), 5 deletions(-) diff --git a/examples/run_test.sh b/examples/run_test.sh index e522747d..97d920b6 100755 --- a/examples/run_test.sh +++ b/examples/run_test.sh @@ -3,8 +3,10 @@ PORT=8082 ./sse_server.exe -p $PORT & +PID=$! + sleep 0.1 ./sse_client.exe -p $PORT --alarm=1 /count | tr -d '\r' || true -kill %1 +kill $PID echo "success" diff --git a/tests/download_chunked.sh b/tests/download_chunked.sh index 6d8cbde6..2fc4e3c5 100755 --- a/tests/download_chunked.sh +++ b/tests/download_chunked.sh @@ -3,11 +3,12 @@ SERVER=$1 PORT=8084 "$SERVER" . -p $PORT & +PID=$! sleep 0.1 curl -N "http://localhost:${PORT}/foo_50" -o data2 \ -H 'Tranfer-encoding: chunked' -kill %1 +kill $PID wc data2 diff --git a/tests/echo1.sh b/tests/echo1.sh index 5cad7b60..22398c94 100755 --- a/tests/echo1.sh +++ b/tests/echo1.sh @@ -4,6 +4,7 @@ ECHO=$1 PORT=8085 "$ECHO" -p $PORT & +PID=$! sleep 0.1 curl -N "http://localhost:${PORT}/echo/?a=b&c=d" -H user-agent:test -kill %1 +kill $PID diff --git a/tests/sse_count.sh b/tests/sse_count.sh index 6010ed37..dcd0c352 100755 --- a/tests/sse_count.sh +++ b/tests/sse_count.sh @@ -4,7 +4,8 @@ SSE_SERVER=$1 PORT=8086 "$SSE_SERVER" -p $PORT & +PID=$! sleep 0.1 curl -N "http://localhost:${PORT}/count/10" -H user-agent:test -kill %1 +kill $PID diff --git a/tests/upload_chunked.sh b/tests/upload_chunked.sh index ca64ac8a..9cbd2d7d 100755 --- a/tests/upload_chunked.sh +++ b/tests/upload_chunked.sh @@ -6,10 +6,11 @@ SERVER=$1 PORT=8087 "$SERVER" . -p $PORT --upload --max-upload 100000000000 & +PID=$! sleep 0.1 cat foo_50 | curl -N -X PUT http://localhost:$PORT/data --data-binary @- -H 'Transfer-Encoding: chunked' -kill %1 +kill $PID wc data