From dce3e10ff0fa87d475c9b367685da23721a14042 Mon Sep 17 00:00:00 2001 From: Greg Carl Date: Fri, 3 Nov 2023 11:45:18 -0400 Subject: [PATCH] tests: make g0 test more robust by waiting for linuxcnc to come up This should fix the failing test, as discovered here: https://github.com/LinuxCNC/linuxcnc/issues/2700#issuecomment-1791969301 --- tests/motion/g0/test.sh | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/tests/motion/g0/test.sh b/tests/motion/g0/test.sh index 0a7f9c2630b..b54482c459d 100755 --- a/tests/motion/g0/test.sh +++ b/tests/motion/g0/test.sh @@ -23,6 +23,21 @@ wait_for_pin() { linuxcnc motion-test.ini & linuxcncpid=$! +# let linuxcnc come up +TOGO=80 +while [ $TOGO -gt 0 ]; do + echo trying to connect to linuxcncrsh TOGO=$TOGO + if nc -z localhost 5007; then + break + fi + sleep 0.25 + TOGO=$(($TOGO - 1)) +done +if [ $TOGO -eq 0 ]; then + echo connection to linuxcncrsh timed out + exit 1 +fi + wait_for_pin motion.in-position TRUE echo starting to capture data