Skip to content

Commit 3aff2ee

Browse files
committed
tests/bios: Use recreate_serial_console in BIOS boot tests
Refactor BIOS boot order tests to use the recreate_serial_console parameter instead of manually calling cleanup_serial_console() and create_serial_console() before wait_for_serial_login(). This simplifies console management after VM boot operations, ensuring proper console state for various boot scenarios including OVMF and SeaBIOS. Modified test files: - bios/boot_order_ovmf.py: Console after VM start for OVMF boot testing - bios/boot_order_seabios.py: Console after VM start for SeaBIOS boot testing Both tests handle console recreation after VM start operations where the console needs to be reset to properly capture boot messages and login prompts. Total: 2 files modified with 9 fewer lines of console management code. Depends on: avocado-framework/avocado-vt#4248 Depends on: #6596 Signed-off-by: hholoubk <hholoubk@redhat.com>
1 parent c96ab65 commit 3aff2ee

2 files changed

Lines changed: 4 additions & 12 deletions

File tree

libvirt/tests/src/bios/boot_order_ovmf.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,18 +23,14 @@ def check_boot(vm, test, params):
2323
time.sleep(3)
2424
if not status_error:
2525
try:
26-
vm.cleanup_serial_console()
27-
vm.create_serial_console()
28-
vm.wait_for_serial_login()
26+
vm.wait_for_serial_login(recreate_serial_console=True)
2927
except Exception as error:
3028
test.fail(f"Test fail: {error}")
3129
else:
3230
test.log.debug("Succeed to boot %s", vm.name)
3331
else:
3432
try:
35-
vm.cleanup_serial_console()
36-
vm.create_serial_console()
37-
vm.wait_for_serial_login()
33+
vm.wait_for_serial_login(recreate_serial_console=True)
3834
except LoginTimeoutError as expected_e:
3935
test.log.debug(f"Got expected error message: {expected_e}")
4036
except Exception as e:

libvirt/tests/src/bios/boot_order_seabios.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -270,18 +270,14 @@ def run(test, params, env):
270270
internal_timeout=0.5)
271271
else:
272272
time.sleep(3)
273-
vm.cleanup_serial_console()
274-
vm.create_serial_console()
275-
vm.wait_for_serial_login(timeout=15)
273+
vm.wait_for_serial_login(timeout=15, recreate_serial_console=True)
276274
except Exception as e:
277275
test.fail(f"Test fail: {str(e)}")
278276
else:
279277
test.log.debug("Succeed to boot %s", vm_name)
280278
else:
281279
try:
282-
vm.cleanup_serial_console()
283-
vm.create_serial_console()
284-
vm.wait_for_serial_login(timeout=15)
280+
vm.wait_for_serial_login(timeout=15, recreate_serial_console=True)
285281
except LoginTimeoutError as expected_e:
286282
test.log.debug("Got expected error message: %s", str(expected_e))
287283
except Exception as exc:

0 commit comments

Comments
 (0)