Skip to content

Commit a0690c3

Browse files
jnsnowphilmd
authored andcommitted
tests/acceptance: wait() instead of shutdown() where appropriate
When issuing 'reboot' to a VM with the no-reboot option, that VM will exit. When then issuing a shutdown command, the cleanup may race. Add calls to vm.wait() which will gracefully mark the VM as having exited. Subsequent vm.shutdown() calls in generic tearDown code will not race when called after completion of the call. Signed-off-by: John Snow <[email protected]> Reviewed-by: Philippe Mathieu-Daudé <[email protected]> Reviewed-by: Cleber Rosa <[email protected]> Tested-by: Cleber Rosa <[email protected]> Message-Id: <[email protected]> Signed-off-by: Philippe Mathieu-Daudé <[email protected]>
1 parent 8952805 commit a0690c3

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

tests/acceptance/boot_linux_console.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,8 @@ def test_mips_malta_cpio(self):
191191
'Debian')
192192
exec_command_and_wait_for_pattern(self, 'reboot',
193193
'reboot: Restarting system')
194+
# Wait for VM to shut down gracefully
195+
self.vm.wait()
194196

195197
@skipUnless(os.getenv('AVOCADO_ALLOW_UNTRUSTED_CODE'), 'untrusted code')
196198
def test_mips64el_malta_5KEc_cpio(self):
@@ -231,6 +233,8 @@ def test_mips64el_malta_5KEc_cpio(self):
231233
'3.19.3.mtoman.20150408')
232234
exec_command_and_wait_for_pattern(self, 'reboot',
233235
'reboot: Restarting system')
236+
# Wait for VM to shut down gracefully
237+
self.vm.wait()
234238

235239
def do_test_mips_malta32el_nanomips(self, kernel_url, kernel_hash):
236240
kernel_path_xz = self.fetch_asset(kernel_url, asset_hash=kernel_hash)
@@ -506,6 +510,7 @@ def test_arm_cubieboard_initrd(self):
506510
'system-control@1c00000')
507511
exec_command_and_wait_for_pattern(self, 'reboot',
508512
'reboot: Restarting system')
513+
# NB: Do not issue vm.wait() here, cubieboard's reboot does not exit!
509514

510515
def test_arm_cubieboard_sata(self):
511516
"""
@@ -550,6 +555,7 @@ def test_arm_cubieboard_sata(self):
550555
'sda')
551556
exec_command_and_wait_for_pattern(self, 'reboot',
552557
'reboot: Restarting system')
558+
# NB: Do not issue vm.wait() here, cubieboard's reboot does not exit!
553559

554560
def test_arm_orangepi(self):
555561
"""
@@ -615,6 +621,8 @@ def test_arm_orangepi_initrd(self):
615621
'system-control@1c00000')
616622
exec_command_and_wait_for_pattern(self, 'reboot',
617623
'reboot: Restarting system')
624+
# Wait for VM to shut down gracefully
625+
self.vm.wait()
618626

619627
def test_arm_orangepi_sd(self):
620628
"""
@@ -662,6 +670,8 @@ def test_arm_orangepi_sd(self):
662670
'3 packets transmitted, 3 packets received, 0% packet loss')
663671
exec_command_and_wait_for_pattern(self, 'reboot',
664672
'reboot: Restarting system')
673+
# Wait for VM to shut down gracefully
674+
self.vm.wait()
665675

666676
@skipUnless(os.getenv('AVOCADO_ALLOW_LARGE_STORAGE'), 'storage limited')
667677
@skipUnless(P7ZIP_AVAILABLE, '7z not installed')

tests/acceptance/linux_ssh_mips_malta.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,8 @@ def check_mips_malta(self, uname_m, endianess):
212212

213213
self.run_common_commands(wordsize)
214214
self.shutdown_via_ssh()
215+
# Wait for VM to shut down gracefully
216+
self.vm.wait()
215217

216218
def test_mips_malta32eb_kernel3_2_0(self):
217219
"""

0 commit comments

Comments
 (0)