[PATCH] D144024: Fix test hang if curl is not installed

Pavel Kosov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 14 09:24:15 PST 2023


kpdev42 created this revision.
kpdev42 added reviewers: thopre, cmatthews, tnfchris.
kpdev42 added a project: LLVM.
Herald added a project: All.
kpdev42 requested review of this revision.

Indicate environment misconfiguration explicitly: error out if 'curl' is
not found instead of silently hanging in an infinite loop.


Repository:
  rLNT LNT

https://reviews.llvm.org/D144024

Files:
  tests/SharedInputs/server_wrapper.sh


Index: tests/SharedInputs/server_wrapper.sh
===================================================================
--- tests/SharedInputs/server_wrapper.sh
+++ tests/SharedInputs/server_wrapper.sh
@@ -39,6 +39,13 @@
     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.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D144024.497358.patch
Type: text/x-patch
Size: 838 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230214/23b04cfc/attachment.bin>


More information about the llvm-commits mailing list