Skip to content

Commit 3e1db68

Browse files
committed
rtapi_app no autostart: Fix raster/test the proper way part 2
1 parent 9fab450 commit 3e1db68

1 file changed

Lines changed: 11 additions & 3 deletions

File tree

tests/raster/test

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,15 @@ def main():
197197
#use interactive mode to be have the hal running
198198
#while needed and exit with writing "exit" at the end
199199
halrun = subprocess.Popen(["halrun", "-Is", "raster.hal"], stdin=subprocess.PIPE)
200-
time.sleep(0.5) #Needs a short delay until halrun is up and running
200+
#Test the last connection added in raster.hal
201+
#to determine if hal is up and running
202+
deadline = time.time() + 5
203+
while time.time() < deadline:
204+
if hal.pin_has_writer("test.fraction"):
205+
break
206+
time.sleep(0.01)
207+
else:
208+
raise RuntimeError("raster.hal did not come up within 5s")
201209

202210
testInvalidOffset(prog, pin)
203211
testInvalidBPP(prog, pin)
@@ -255,8 +263,8 @@ def main():
255263
prog.exit()
256264
try:
257265
try:
258-
halrun.communicate(input=b"exit", timeout=15)
259-
except TimeoutExpired:
266+
halrun.communicate(input=b"exit\n", timeout=5)
267+
except subprocess.TimeoutExpired:
260268
halrun.kill()
261269
halrun.communicate()
262270
exit_status = halrun.returncode

0 commit comments

Comments
 (0)