diff options
author | Pavel Kosov <kpdev42@gmail.com> | 2023-03-09 15:18:10 +0300 |
---|---|---|
committer | Pavel Kosov <kpdev42@gmail.com> | 2023-03-09 15:18:10 +0300 |
commit | d7fc7bf4d5846fa58a812e59536ed6240fc88673 (patch) | |
tree | 004adb38e3c75f0c1a8dd40f0ec56bc6271ae112 | |
parent | 2edc480b5d3d185da3bc8151caf954c94e137ace (diff) |
Fix test hang if curl is not installed
Indicate environment misconfiguration explicitly: error out if 'curl' is
not found instead of silently hanging in an infinite loop.
Reviewed By: cmatthews
Differential Revision: https://reviews.llvm.org/D144024
-rwxr-xr-x | tests/SharedInputs/server_wrapper.sh | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/tests/SharedInputs/server_wrapper.sh b/tests/SharedInputs/server_wrapper.sh index 73ad0a3..84b377b 100755 --- a/tests/SharedInputs/server_wrapper.sh +++ b/tests/SharedInputs/server_wrapper.sh @@ -39,6 +39,13 @@ main() { lnt runserver ${server_instance} --hostname localhost --port ${port_number} >& ${server_instance}/server_wrapper_runserver.log & local pid=$! + # In the polling code below, absence of 'curl' would cause an infinite loop + # instead of "command not found" error, so check for environment + # misconfiguration explicitly. + if ! curl --version > /dev/null; then + echo 1>&2 "Command 'curl' not found." + exit 1 + fi # Poll the server until it is up and running while ! curl http://localhost:${port_number}/ping -m1 -o/dev/null -s ; do # Maybe server is totally dead. |