[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [RFC PATCH v2 2/3] acceptance tests: Add EDK2 OVMF boot and
From: |
Philippe Mathieu-Daudé |
Subject: |
[Qemu-devel] [RFC PATCH v2 2/3] acceptance tests: Add EDK2 OVMF boot and debug console checking test |
Date: |
Wed, 3 Oct 2018 20:30:35 +0200 |
This test boots OVMF and check the debug console (I/O port on the ISA bus)
report enough information on the initialized devices.
$ avocado --show=app,debugcon run tests/acceptance/boot_firmware.py
(1/1) tests/acceptance/boot_firmware.py:BootFirmware.test_ovmf_pc:
debugcon: SecCoreStartupWithStack(0xFFFCC000, 0x820000)
debugcon: SEC: Normal boot
...
debugcon: [Bds]Booting EFI Internal Shell
PASS (5.27 s)
JOB TIME : 5.60 s
Signed-off-by: Philippe Mathieu-Daudé <address@hidden>
---
tests/acceptance/boot_firmware.py | 49 +++++++++++++++++++++++++++++++
1 file changed, 49 insertions(+)
diff --git a/tests/acceptance/boot_firmware.py
b/tests/acceptance/boot_firmware.py
index 669e4849f6..2053b1a4b6 100644
--- a/tests/acceptance/boot_firmware.py
+++ b/tests/acceptance/boot_firmware.py
@@ -72,3 +72,52 @@ class BootFirmware(Test):
debugcon_logger.debug(line.strip())
for exp in expected:
self.assertIn(exp + '\n', content)
+
+ def test_ovmf_pc(self):
+ """
+ Boots OVMF on the default PC machine, checks the debug console
+
+ :avocado: tags=arch:x86_64
+ :avocado: tags=maxtime:10s
+ """
+ debugcon_path = os.path.join(self.workdir, 'debugconsole.log')
+ serial_logger = logging.getLogger('serial')
+ debugcon_logger = logging.getLogger('debugcon')
+
+ self.vm.set_machine('pc')
+ self.vm.set_console()
+ self.vm.add_args('-nographic',
+ '-net', 'none',
+ '-global', 'isa-debugcon.iobase=0x402',
+ '-debugcon', 'file:%s' % debugcon_path,
+ '--bios', '/usr/share/OVMF/OVMF_CODE.fd')
+ self.vm.launch()
+ console = self.vm.console_socket.makefile()
+
+ # serial console checks
+ if not wait_for(read_console_for_string, timeout=10, step=0,
+ args=(console, 'EDK II', serial_logger)):
+ self.fail("OVMF failed to boot")
+
+ # debug console checks
+ expected = [
+ 'SEC: Normal boot',
+ 'S3 support was detected on QEMU',
+ 'Platform PEI Firmware Volume Initialization',
+ 'DXE IPL Entry',
+ 'Installing FVB for EMU Variable support',
+ 'SmbiosCreateTable: Initialize 32-bit entry point structure',
+ 'PlatformBootManagerBeforeConsole',
+ 'OnRootBridgesConnected: root bridges have been connected, '
+ 'installing ACPI tables',
+ 'Found LPC Bridge device',
+ 'PlatformBootManagerAfterConsole',
+ 'EfiBootManagerConnectAll',
+ '[Bds]Booting EFI Internal Shell',
+ ]
+ with open(debugcon_path) as debugcon:
+ content = debugcon.readlines()
+ for line in content: # TODO use FDDrainer
+ debugcon_logger.debug(line.strip())
+ for exp in expected:
+ self.assertIn(exp + '\r\n', content)
--
2.17.1