Tests: Fix driver race sometimes missing final log data

This commit is contained in:
Wilson Snyder 2024-09-19 22:49:40 -04:00
parent 579257bc42
commit 87eef36b1c

View File

@ -1693,7 +1693,9 @@ class VlTest:
rawbuf = bytearray(2048)
while proc.poll() is None:
while True:
finished = proc.poll()
# Need to check readinto once, even after poll "completes"
got = proc.stdout.readinto(rawbuf)
if got:
data = rawbuf[0:got]
@ -1703,6 +1705,8 @@ class VlTest:
sys.stdout.flush()
if logfh:
logfh.write(data)
if finished is not None:
break
if logfh:
logfh.close()