Skip to contentSkip to conversation

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

PATCH In review Peter Maydell 6 participants 6 messages Oct 20, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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:
https://gitlab.com/qemu-project/qemu/-/issues/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:
https://gitlab.com/qemu-project/qemu/-/issues/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.

Resolves: https://gitlab.com/qemu-project/qemu/-/issues/636

---
 tests/avocado/boot_linux_console.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tests/avocado/boot_linux_console.py +1 -1
index ca9d09b0d7c..eed4b49e6e4 100644
@@ -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()
 
Signature · 1 line
2.25.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 36 lines · Peter Maydell

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:
https://gitlab.com/qemu-project/qemu/-/issues/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:
https://gitlab.com/qemu-project/qemu/-/issues/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.

Resolves: https://gitlab.com/qemu-project/qemu/-/issues/636

---
  tests/avocado/boot_linux_console.py | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
tests/avocado/boot_linux_console.py +0 -0
index ca9d09b0d7c..eed4b49e6e4 100644

tests/avocado/boot_linux_console.py def test_arm_raspi2_initrd(self): · line 495

Quoted 8 lines
tests/avocado/boot_linux_console.py +1 -1
@@ -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()
 
#2 lore raw
In reply to Peter Maydell
Quoted 21 lines · Peter Maydell

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:

   https://gitlab.com/qemu-project/qemu/-/issues/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:
   https://gitlab.com/qemu-project/qemu/-/issues/1264
Quoted 6 lines

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.

Resolves: https://gitlab.com/qemu-project/qemu/-/issues/636

Queued to testing/next, thanks.

Signature · 1 line
Alex Bennée
Reviewed-by on v1 1/1
#3 lore raw
In reply to Peter Maydell
Quoted 3 lines · Peter Maydell

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

Typo "with"

Quoted 33 lines

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:
https://gitlab.com/qemu-project/qemu/-/issues/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:
https://gitlab.com/qemu-project/qemu/-/issues/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.

Resolves: https://gitlab.com/qemu-project/qemu/-/issues/636

---
  tests/avocado/boot_linux_console.py | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
tests/avocado/boot_linux_console.py +0 -0
index ca9d09b0d7c..eed4b49e6e4 100644

tests/avocado/boot_linux_console.py def test_arm_raspi2_initrd(self): · line 492

Quoted 5 lines
tests/avocado/boot_linux_console.py +1 -1
@@ -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')

Yeah :(

Reviewed-by on v1 1/1
#4 lore raw
In reply to Peter Maydell
Quoted 21 lines · Peter Maydell

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:
https://gitlab.com/qemu-project/qemu/-/issues/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:
https://gitlab.com/qemu-project/qemu/-/issues/1264

Quoted 6 lines

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.

Resolves: https://gitlab.com/qemu-project/qemu/-/issues/636

r~

Reviewed-by on v1 1/1
#5 lore raw
In reply to Peter Maydell
Quoted 37 lines · Peter Maydell

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:

   https://gitlab.com/qemu-project/qemu/-/issues/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:
   https://gitlab.com/qemu-project/qemu/-/issues/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.

Resolves: https://gitlab.com/qemu-project/qemu/-/issues/636

---
 tests/avocado/boot_linux_console.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tests/avocado/boot_linux_console.py +0 -0
index ca9d09b0d7c..eed4b49e6e4 100644

tests/avocado/boot_linux_console.py def test_arm_raspi2_initrd(self): · line 494

Quoted 7 lines
tests/avocado/boot_linux_console.py +1 -1
@@ -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()

LGTM!

Already staged, but just for formality's sake: