nixos/lib/test-driver: reduce spam at boot hangs

Since 008f9f0cd4
 ("nixos/test-driver: actually use the backdoor message to wait for backdoor"),

when boot is still computering, we can get a tons of empty strings in response to the shell.

This is not really useful to print and waste the disk space for any CI system that logs them.

We stop logging chunks whenever they are empty.
This commit is contained in:
Raito Bezarius 2023-09-29 03:44:10 +02:00
parent 248a83fffc
commit 81becd3c44

View file

@ -843,6 +843,9 @@ class Machine:
while True: while True:
chunk = self.shell.recv(1024) chunk = self.shell.recv(1024)
# No need to print empty strings, it means we are waiting.
if len(chunk) == 0:
continue
self.log(f"Guest shell says: {chunk!r}") self.log(f"Guest shell says: {chunk!r}")
# NOTE: for this to work, nothing must be printed after this line! # NOTE: for this to work, nothing must be printed after this line!
if b"Spawning backdoor root shell..." in chunk: if b"Spawning backdoor root shell..." in chunk: