autotest: remove unnecessary busy loop from example runner

It never exited early in the normal case and just burned 100% CPU. It
will be slightly slower in an error case if there is an unexpected early
exit but that is probably worth the simplification.
This commit is contained in:
Thomas Watson
2026-03-30 16:56:30 +11:00
committed by Peter Barker
parent cec0df68ce
commit 6e816400f3
+5 -8
View File
@@ -36,20 +36,17 @@ def run_example(name, filepath, valgrind=False, gdb=False):
]:
expect_exit = True
tstart = time.time()
while True:
if time.time() - tstart > timeout:
break
if not expect_exit:
retcode = bob.poll()
if retcode is not None:
raise ValueError("Process exited before I could kill it (%s)" % str(retcode))
time.sleep(timeout)
if expect_exit:
retcode = bob.wait()
if retcode is None:
raise ValueError("Expected example to exit, it did not")
else:
retcode = bob.poll()
if retcode is not None:
raise ValueError("Process exited before I could kill it (%s)" % str(retcode))
bob.send_signal(signal.SIGTERM)
time.sleep(1)
retcode = bob.poll()