qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [RFC PATCH 3/3] acceptance tests: Add EDK2 AAVMF boot and c


From: Philippe Mathieu-Daudé
Subject: [Qemu-devel] [RFC PATCH 3/3] acceptance tests: Add EDK2 AAVMF boot and console checking test
Date: Fri, 28 Sep 2018 01:30:58 +0100

This test boots EDK2 AAVMF and check the debug console (PL011) reports enough
information on the initialized devices.

Example:

    $ avocado --show=console run tests/acceptance/boot_firmware.py 
--cit-parameter-file aarch64.cit

having aarch64.cit:

[parameters]
qemu_bin: aarch64-softmmu/qemu-system-aarch64

Signed-off-by: Philippe Mathieu-Daudé <address@hidden>
---
- requires (even for single parameter):
  $ pip install avocado-framework-plugin-varianter-cit

- use gzip kludge (avocado only support tarballs)

- can not set $arch param since pick_default_qemu_bin() forces to host 
os.uname()[4]
---
 tests/acceptance/boot_firmware.py | 43 +++++++++++++++++++++++++++++++
 1 file changed, 43 insertions(+)

diff --git a/tests/acceptance/boot_firmware.py 
b/tests/acceptance/boot_firmware.py
index 05f6728212..4f5554c0ad 100644
--- a/tests/acceptance/boot_firmware.py
+++ b/tests/acceptance/boot_firmware.py
@@ -10,6 +10,7 @@
 # SPDX-License-Identifier: GPL-2.0-or-later
 
 import os
+import gzip
 import time
 import shutil
 import logging
@@ -122,3 +123,45 @@ class BootFirmwareX86(Test):
             if line + '\r\n' not in lines:
                 self.fail('missing: %s' % line)
         shutil.rmtree(tmpdirname, ignore_errors=True)
+
+
+class BootFirmwareAarch64(Test):
+    """
+    Boots the EDK2 firmware on a default virt machine and checks the console is
+    operational
+
+    :avocado: enable
+    :avocado: tags=arch:aarch64
+    :avocado: tags=aarch64,quick
+    """
+
+    timeout = 15
+
+    def test_aavmf(self):
+        tmpdirname = tempfile.mkdtemp()
+        image_url = ('http://snapshots.linaro.org/components/kernel/'
+                    'leg-virt-tianocore-edk2-upstream/latest/'
+                    'QEMU-AARCH64/DEBUG_GCC5/QEMU_EFI.img.gz')
+        image_path_gz = self.fetch_asset(image_url)
+        image_path = os.path.join(tmpdirname, 'flash.img')
+        with gzip.open(image_path_gz) as gz, open(image_path, 'wb') as img:
+            shutil.copyfileobj(gz, img)
+
+        self.vm.set_machine('virt')
+        self.vm.set_console()
+        self.vm.add_args('-nographic',
+                         '-cpu', 'cortex-a57',
+                         '-m', '1G',
+                         '-pflash', image_path)
+        self.vm.launch()
+        console = self.vm.console_socket.makefile()
+        serial_logger = logging.getLogger('serial')
+
+        # serial console checks
+        while True:
+            msg = console.readline()
+            if not '\x1b' in msg: # ignore ANSI sequences
+                serial_logger.debug(msg.strip())
+            if 'Start PXE over IPv4InstallProtocolInterface:' in msg:
+                break
+        shutil.rmtree(tmpdirname, ignore_errors=True)
-- 
2.17.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]