On 19/10/2022 22.38, John Snow wrote:
On Tue, Oct 18, 2022 at 6:23 AM Peter Maydell <peter.mayd...@linaro.org> wrote:
If you run this single avocado test:
while ./build/x86/tests/venv/bin/avocado run
build/x86/tests/avocado/boot_linux_console.py:BootLinuxConsole.test_arm_raspi2_initrd
; do true; done
then on my machine it will fail within 4 or 5 iterations. Has anybody
looked into this? Looking at a log from a failed test
https://people.linaro.org/~peter.maydell/raspi-avocado-fail.log
what seems to happen is that the test sends the "halt" command to
the guest. The DEBUG log reports a transition from RUNNING to
DISCONNECTING and the QMP connection disconnects, so presumably
the guest really did exit -- or is that something the test framework
is doing from its end?
[...]
"Thanks for the analysis, but, like, what are you going to do to fix
any of this?"
Long term, an asyncio version of machine.py will help alleviate these
kinds of race conditions when dealing with multiple sockets from
Python as our testing requirements become more complex.
Short term, I'm not sure...
As a short term fix, what about simply changing the test
like this:
diff a/tests/avocado/boot_linux_console.py b/tests/avocado/boot_linux_console.py
--- a/tests/avocado/boot_linux_console.py
+++ b/tests/avocado/boot_linux_console.py
@@ -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', 'System halted')
# Wait for VM to shut down gracefully
self.vm.wait()
By waiting for another console pattern that the guest sends
out after "halt", you can make sure that the connection is
not closed too early.
Thomas