Skip to content
Snippets Groups Projects
Commit 6dbcbb16 authored by Peter Maydell's avatar Peter Maydell Committed by Thomas Huth
Browse files

tests/avocado: raspi2_initrd: Wait for guest shutdown message before stopping

The avocado test
 tests/avocado/boot_linux_console.py:BootLinuxConsole.test_arm_raspi2_initrd
finishes wiith

    exec_command(self, 'halt')
    # Wait for VM to shut down gracefully
    self.vm.wait()

In theory this should be fine. In practice it runs into two bugs:

 * when the test calls self.vm.wait() Avocado closes the socket
   connection to the guest serial console immediately, so the
   avocado logs don't have the last part of the guest output:
   qemu-project/qemu#1265
 * when the socket is closed, a bug in the QEMU socket chardev
   means that it loses any data that the guest UART has not
   yet consumed. This means that the guest doesn't always read
   the full 'halt' command string, so the test intermittently
   fails with a timeout:
   qemu-project/qemu#1264



Work around both of these by waiting for the guest to print the
string that means it has completed the shutdown process.  This fixes
a very long standing intermittent failure in this test.

Signed-off-by: default avatarPeter Maydell <peter.maydell@linaro.org>
Reviewed-by: default avatarPhilippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Thomas Huth's avatarThomas Huth <thuth@redhat.com>
Reviewed-by: default avatarRichard Henderson <richard.henderson@linaro.org>
Resolves: qemu-project/qemu#636


Message-Id: <20221020102012.3015662-1-peter.maydell@linaro.org>
Signed-off-by: Thomas Huth's avatarThomas Huth <thuth@redhat.com>
parent 975e88b9
No related branches found
No related tags found
No related merge requests found
......@@ -489,7 +489,7 @@ def test_arm_raspi2_initrd(self):
'BCM2835')
exec_command_and_wait_for_pattern(self, 'cat /proc/iomem',
'/soc/cprman@7e101000')
exec_command(self, 'halt')
exec_command_and_wait_for_pattern(self, 'halt', 'reboot: System halted')
# Wait for VM to shut down gracefully
self.vm.wait()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment