nixos-test-driver: include a timeout for the recv call, do not assume sh == bash

This commit is contained in:
r-vdp 2023-04-26 00:44:23 +02:00
parent 113045a443
commit 4147b878bc
No known key found for this signature in database
2 changed files with 31 additions and 7 deletions

View file

@ -36,8 +36,16 @@ in
while ! exec 2> /dev/${qemu-common.qemuSerialDevice}; do sleep 0.1; done
echo "connecting to host..." >&2
stty -F /dev/hvc0 raw -echo # prevent nl -> cr/nl conversion
echo
PS1= exec /bin/sh
# The following line is essential since it signals to
# the test driver that the shell is ready.
# See: the connect method in the Machine class.
echo "Spawning backdoor root shell..."
# Passing the terminal device makes bash run non-interactively.
# Otherwise we get errors on the terminal because bash tries to
# setup things like job control.
# Note: calling bash explicitely here instead of sh makes sure that
# we can also run non-NixOS guests during tests.
PS1= exec /usr/bin/env bash --norc /dev/hvc0
'';
serviceConfig.KillSignal = "SIGHUP";
};