Visitar URL original
tests: test_serial_io: Start large TX before snapshot · firecracker-microvm/firecracker@9082575 · GitHub
Skip to content

Commit 9082575

Browse files
committed
tests: test_serial_io: Start large TX before snapshot
Commit 6c70c6d ("devices: serial: Save/restore UART state to/from snapshots") fixed a bug where the guest driver would hang after a snapshot restore because Firecracker didn't properly restore the state of the UART device. Amend the test_serial_after_snapshot() case to test this. Start a large transmission before taking the snapshot. This will saturate the TX buffer of the emulated UART and will make the guest driver enable TX interrupts. Without the fix, the test case fails because the driver is stuck waiting for a TX interrupt that will never be delivered. Note that the serial.tx("") that sends a newline to flush the buffer needs to be removed now since a new line is sent as part of the command that starts the large transmission before the snapshot is taken. Signed-off-by: Ilias Stamatis <ilstam@amazon.com>
1 parent 6c70c6d commit 9082575

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

‎tests/integration_tests/functional/test_serial_io.py‎

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,13 @@ def test_serial_after_snapshot(uvm_plain, microvm_factory):
3333
# looking for the # prompt at the end
3434
serial.rx("ubuntu-fc-uvm:~#")
3535

36+
# Start a large transmission before we take the snapshot. This will
37+
# saturate the TX buffer of the UART and it might make the guest driver
38+
# enable TX interrupts.
39+
serial.tx("cat /dev/zero | head -c 100000")
40+
# Give the guest time to start the transmission
41+
time.sleep(1)
42+
3643
# Create snapshot.
3744
snapshot = microvm.snapshot_full()
3845
# Kill base microVM.
@@ -45,9 +52,7 @@ def test_serial_after_snapshot(uvm_plain, microvm_factory):
4552
vm.restore_from_snapshot(snapshot, resume=True)
4653
serial = Serial(vm)
4754
serial.open()
48-
# We need to send a newline to signal the serial to flush
49-
# the login content.
50-
serial.tx("")
55+
5156
# looking for the # prompt at the end
5257
serial.rx("ubuntu-fc-uvm:~#")
5358
serial.tx("pwd")

0 commit comments

Comments
 (0)