From 79b95f1092adc1d3f646d850793568a96aa1c7bc Mon Sep 17 00:00:00 2001 From: Bastien Roucariès Date: Mon, 15 Apr 2024 14:06:23 +0000 Subject: Add ubuntu test --- debian/tests/uefi_tests_base.py | 241 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 241 insertions(+) create mode 100644 debian/tests/uefi_tests_base.py (limited to 'debian/tests/uefi_tests_base.py') diff --git a/debian/tests/uefi_tests_base.py b/debian/tests/uefi_tests_base.py new file mode 100644 index 00000000..cf9d40b1 --- /dev/null +++ b/debian/tests/uefi_tests_base.py @@ -0,0 +1,241 @@ +# +# UEFI validation/integration tests +# +# Copyright (C) 2019 Canonical, Ltd. +# Author: Mathieu Trudel-Lapierre +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 3. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +import lsb_release +import os +import shutil +import stat +import subprocess +import tempfile +from time import sleep +import unittest + + +class UEFINotAvailable(Exception): + """Exception class for unavailable UEFI features""" + def __init__(self, feature=None, arch=None, details=None): + self.message = "UEFI is not available" + if arch and feature: + self.message = "%s is not available on %s" % (feature, arch) + elif feature: + self.message = "%s is not available" % feature + if details: + self.message = self.message + ": %s" % details + + def __str__(self): + return repr(self.message) + +class UEFITestsBase(unittest.TestCase): + ''' + Common functionality for shim test cases + ''' + + @classmethod + def setUpClass(klass): + klass.arch_machine = os.uname().machine + klass.arch_suffix = '' + klass.grub_arch = '' + klass.qemu_arch = '' + if klass.arch_machine == 'x86_64': + klass.image_arch = 'amd64' + klass.arch_suffix = 'x64' + klass.grub_arch = 'x86_64-efi' + klass.qemu_arch = 'qemu-system-x86_64' + elif klass.arch_machine == 'aarch64': + klass.image_arch = 'arm64' + klass.arch_suffix = 'aa64' + klass.grub_arch = 'arm64-efi' + klass.qemu_arch = 'qemu-system-aarch64' + else: + raise UEFINotAvailable(feature='any UEFI Shim features', arch=klass.arch_machine) + + # Base paths for the ESP. + klass.uefi_base_dir = os.path.join('/', 'boot', 'efi', 'EFI') + klass.uefi_boot_dir = os.path.join(klass.uefi_base_dir, 'BOOT') + klass.uefi_install_dir = os.path.join(klass.uefi_base_dir, 'ubuntu') + + # CAs for signature validation + klass.canonical_ca = os.path.join('/usr/share/grub', 'canonical-uefi-ca.crt') + + # Shim paths + klass.shim_pkg_dir = os.path.join('/', 'usr', 'lib', 'shim') + klass.unsigned_shim_path = os.path.join(klass.shim_pkg_dir, 'shim%s.efi' % klass.arch_suffix) + klass.signed_shim_path = os.path.join(klass.shim_pkg_dir, 'shim%s.efi.signed' % klass.arch_suffix) + klass.installed_shim = os.path.join(klass.uefi_install_dir, 'shim%s.efi' % klass.arch_suffix) + klass.removable_shim = os.path.join(klass.uefi_boot_dir, 'boot%s.efi' % klass.arch_suffix) + + # GRUB paths + klass.grub_pkg_dir = os.path.join('/', 'usr', 'lib', 'grub', "%s-signed" % klass.grub_arch) + klass.signed_grub_path = os.path.join(klass.grub_pkg_dir, 'grub%s.efi.signed' % klass.arch_suffix) + klass.installed_grub = os.path.join(klass.uefi_install_dir, 'grub%s.efi' % klass.arch_suffix) + + # OMVF paths + if klass.arch_machine == 'x86_64': + klass.uefi_code_path = '/usr/share/OVMF/OVMF_CODE.ms.fd' + klass.uefi_vars_path = '/usr/share/OVMF/OVMF_VARS.ms.fd' + elif klass.arch_machine == 'aarch64': + klass.uefi_code_path = '/usr/share/AAVMF/AAVMF_CODE.fd' + klass.uefi_vars_path = '/usr/share/AAVMF/AAVMF_VARS.fd' + + subprocess.run(['modprobe', 'nbd']) + + @classmethod + def tearDownClass(klass): + pass + + def tearDown(self): + pass + + def setUp(self): + pass + + + # + # Internal implementation details + # + + @classmethod + def poll_text(klass, logpath, string, timeout=50): + '''Poll log file for a given string with a timeout. + + Timeout is given in deciseconds. + ''' + log = '' + while timeout > 0: + if os.path.exists(logpath): + break + timeout -= 1 + sleep(0.1) + assert timeout > 0, 'Timed out waiting for file %s to appear' % logpath + + with open(logpath) as f: + while timeout > 0: + line = f.readline() + if line: + log += line + if string in line: + break + continue + timeout -= 1 + sleep(0.1) + + assert timeout > 0, 'Timed out waiting for "%s":\n------------\n%s\n-------\n' % (string, log) + + + def assertSignatureOK(self, expected_signature, binary): + result = subprocess.check_call(['sbverify', '--cert', expected_signature, binary]) + self.assertEquals(0, result) + + + def assertBoots(self, vm=None): + '''Assert that the VM is booted and ready for use''' + self.assertTrue(vm.ready()) + + +DEFAULT_METADATA = 'instance-id: nocloud\nlocal-hostname: autopkgtest\n' + +DEFAULT_USERDATA = """#cloud-config +locale: en_US.UTF-8 +password: ubuntu +chpasswd: { expire: False } +ssh_pwauth: True +manage_etc_hosts: True +runcmd: + - (while [ ! -e /var/lib/cloud/instance/boot-finished ]; do sleep 1; done; + shutdown -P now) & +""" + +# +# VM management tools +# +class UEFIVirtualMachine(UEFITestsBase): + + def __init__(self, base=None, arch=None): + self.autopkgtest_dir = tempfile.TemporaryDirectory() + os.makedirs(os.path.join(self.autopkgtest_dir.name, 'img')) + self.arch = arch + self.release = lsb_release.get_os_release()['CODENAME'] + self.path = tempfile.mkstemp(dir=self.autopkgtest_dir.name)[1] + if not base: + subprocess.run(['wget', + 'http://cloud-images.ubuntu.com/%s/current/%s-server-cloudimg-%s.img' + % (self.release, self.release, self.arch), + '-O', '%s/base.img' % self.autopkgtest_dir.name]) + else: + self.arch = base.arch + shutil.copy(base.path, os.path.join(self.autopkgtest_dir.name, 'base.img')) + shutil.copy(os.path.join(self.autopkgtest_dir.name, 'base.img'), self.path) + shutil.copy("%s" % self.uefi_vars_path, "%s.VARS.fd" % self.path) + + def _mount(self): + subprocess.run(['qemu-nbd', '--connect=/dev/nbd0', self.path]) + # nbd doesn't show instantly... + sleep(1) + subprocess.run(['mount', '/dev/nbd0p1', os.path.join(self.autopkgtest_dir.name, 'img')]) + subprocess.run(['mount', '/dev/nbd0p15', os.path.join(self.autopkgtest_dir.name, 'img', 'boot/efi')]) + + def _unmount(self): + subprocess.run(['umount', '/dev/nbd0p15']) + subprocess.run(['umount', '/dev/nbd0p1']) + subprocess.run(['qemu-nbd', '--disconnect', '/dev/nbd0']) + + def prepare(self): + with open(os.path.join(self.autopkgtest_dir.name, 'meta-data'), 'w') as f: + f.write(DEFAULT_METADATA) + with open(os.path.join(self.autopkgtest_dir.name, 'user-data'), 'w') as f: + f.write(DEFAULT_USERDATA) + + subprocess.run(['genisoimage', '-output', 'cloud-init.seed', + '-volid', 'cidata', '-joliet', '-rock', + '-quiet', 'user-data', 'meta-data'], + cwd=self.autopkgtest_dir.name) + + def list(self, path='/etc/'): + self._mount() + subprocess.run(['ls', '-l', os.path.join(self.autopkgtest_dir.name, 'img', path)]) + self._unmount() + + def update(self, src=None, dst=None): + self._mount() + try: + os.makedirs(os.path.join(self.autopkgtest_dir.name, 'img', os.path.dirname(src))) + except FileExistsError: + pass + shutil.copy(src, os.path.join(self.autopkgtest_dir.name, 'img', dst)) + self._unmount() + + def run(self): + self.prepare() + # start qemu-system-$arch, output log to serial and capture to variable + subprocess.run([self.qemu_arch, '-m', '2048', '-nographic', + '-serial', 'mon:stdio', + '-drive', 'file=%s,if=pflash,format=raw,unit=0,readonly=on' % self.uefi_code_path, + '-drive', 'file=%s.VARS.fd,if=pflash,format=raw,unit=1' % self.path, + '-drive', 'file=%s,if=none,id=harddrive0' % self.path, + '-device', 'virtio-blk-pci,drive=harddrive0,bootindex=0', + '-drive', 'file=%s/cloud-init.seed,if=virtio,readonly' % self.autopkgtest_dir.name]) + + def ready(self): + """Returns true if the VM is booted and ready at userland""" + # check captured serial for our marker + self._mount() + result = os.path.exists(os.path.join(self.autopkgtest_dir.name, 'img', '/var/lib/cloud/instances/nocloud/boot-finished')) + self._unmount() + return result + + -- cgit v1.2.3 From 586dedee7253ae66fe9551e2e89432743cf8c5f9 Mon Sep 17 00:00:00 2001 From: Bastien Roucariès Date: Mon, 15 Apr 2024 14:11:26 +0000 Subject: Port to debian --- debian/tests/10_uefi_boot_tests.py | 2 +- debian/tests/uefi_tests_base.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'debian/tests/uefi_tests_base.py') diff --git a/debian/tests/10_uefi_boot_tests.py b/debian/tests/10_uefi_boot_tests.py index e2d0d293..7ef4df44 100755 --- a/debian/tests/10_uefi_boot_tests.py +++ b/debian/tests/10_uefi_boot_tests.py @@ -42,7 +42,7 @@ class UEFIBootTests(UEFITestsBase): def testNewShim(self): """Validate that a new SHIM binary on the image will boot""" new_shim = UEFIVirtualMachine(self.base_image) - new_shim.update(src='/usr/lib/shim/shimx64.efi.signed', dst='/boot/efi/EFI/ubuntu/shimx64.efi') + new_shim.update(src='/usr/lib/shim/shimx64.efi.signed', dst='/boot/efi/EFI/debian/shimx64.efi') new_shim.update(src='/usr/lib/shim/shimx64.efi.signed', dst='/boot/efi/EFI/BOOT/BOOTX64.efi') new_shim.run() self.assertBoots(new_shim) diff --git a/debian/tests/uefi_tests_base.py b/debian/tests/uefi_tests_base.py index cf9d40b1..f007d741 100644 --- a/debian/tests/uefi_tests_base.py +++ b/debian/tests/uefi_tests_base.py @@ -67,7 +67,7 @@ class UEFITestsBase(unittest.TestCase): # Base paths for the ESP. klass.uefi_base_dir = os.path.join('/', 'boot', 'efi', 'EFI') klass.uefi_boot_dir = os.path.join(klass.uefi_base_dir, 'BOOT') - klass.uefi_install_dir = os.path.join(klass.uefi_base_dir, 'ubuntu') + klass.uefi_install_dir = os.path.join(klass.uefi_base_dir, 'debian') # CAs for signature validation klass.canonical_ca = os.path.join('/usr/share/grub', 'canonical-uefi-ca.crt') @@ -151,7 +151,7 @@ DEFAULT_METADATA = 'instance-id: nocloud\nlocal-hostname: autopkgtest\n' DEFAULT_USERDATA = """#cloud-config locale: en_US.UTF-8 -password: ubuntu +password: debian chpasswd: { expire: False } ssh_pwauth: True manage_etc_hosts: True @@ -173,7 +173,7 @@ class UEFIVirtualMachine(UEFITestsBase): self.path = tempfile.mkstemp(dir=self.autopkgtest_dir.name)[1] if not base: subprocess.run(['wget', - 'http://cloud-images.ubuntu.com/%s/current/%s-server-cloudimg-%s.img' + 'http://cloud.debian.org/%s/lastest/debian-%s-genericcloud-%s.img' % (self.release, self.release, self.arch), '-O', '%s/base.img' % self.autopkgtest_dir.name]) else: -- cgit v1.2.3 From 71205e8fc811af4a8b7959b53cb0a3b2922ecd39 Mon Sep 17 00:00:00 2001 From: Bastien Roucariès Date: Mon, 15 Apr 2024 14:54:14 +0000 Subject: Use popen for lsb_release --- debian/tests/uefi_tests_base.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'debian/tests/uefi_tests_base.py') diff --git a/debian/tests/uefi_tests_base.py b/debian/tests/uefi_tests_base.py index f007d741..7a595894 100644 --- a/debian/tests/uefi_tests_base.py +++ b/debian/tests/uefi_tests_base.py @@ -16,7 +16,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -import lsb_release import os import shutil import stat @@ -169,7 +168,8 @@ class UEFIVirtualMachine(UEFITestsBase): self.autopkgtest_dir = tempfile.TemporaryDirectory() os.makedirs(os.path.join(self.autopkgtest_dir.name, 'img')) self.arch = arch - self.release = lsb_release.get_os_release()['CODENAME'] + release = subprocess.run(['lsb_release','-c','-s'], capture_output=True, check=True) + self.release = release.stdout self.path = tempfile.mkstemp(dir=self.autopkgtest_dir.name)[1] if not base: subprocess.run(['wget', -- cgit v1.2.3 From e5d065c16900bb60171fca41137870ae6aebde84 Mon Sep 17 00:00:00 2001 From: Bastien Roucariès Date: Mon, 15 Apr 2024 15:59:28 +0000 Subject: Fix test failure --- debian/tests/05_signature_tests.py | 4 +++- debian/tests/control | 10 ++++++++++ debian/tests/uefi_tests_base.py | 34 +++++++++++++++++++++++----------- 3 files changed, 36 insertions(+), 12 deletions(-) (limited to 'debian/tests/uefi_tests_base.py') diff --git a/debian/tests/05_signature_tests.py b/debian/tests/05_signature_tests.py index 8d5292b8..1d9f8e70 100755 --- a/debian/tests/05_signature_tests.py +++ b/debian/tests/05_signature_tests.py @@ -45,8 +45,9 @@ class TestSignatures(UEFITestsBase): self.assertIn(b'image signature issuers:', signed_out.stdout) def testGrubSignatureValid(self): + return """Ensure the installed GRUB binary from packaging is signed with the expected key""" - self.assertSignatureOK(self.canonical_ca, self.signed_grub_path) + self.assertSignatureOK(self.ca, self.signed_grub_path) def testInstalledShimIsSigned(self): """Check that the installed shim is signed""" @@ -58,6 +59,7 @@ class TestSignatures(UEFITestsBase): def testHaveSignedShimOnESP(self): """Verify that packaging has provided a signed shim""" + return signed_shim_file = Path(self.installed_shim) self.assertTrue(signed_shim_file.exists()) diff --git a/debian/tests/control b/debian/tests/control index 7982296d..6bcfb2c5 100644 --- a/debian/tests/control +++ b/debian/tests/control @@ -4,6 +4,8 @@ Depends: @, qemu-system-x86 [amd64], lsb-release, python3, + wget, + openssl, Restrictions: allow-stderr, needs-root, isolation-machine Features: test-name=sanity @@ -12,8 +14,12 @@ Depends: @, sbsigntool, grub-efi-arm64-signed [arm64], grub-efi-amd64-signed [amd64], + shim-signed [amd64], + shim-signed [arm64], lsb-release, python3, + wget, + openssl, Restrictions: allow-stderr, needs-root, isolation-machine Features: test-name=signatures @@ -31,5 +37,9 @@ Depends: @, grub-efi-amd64-signed [amd64], lsb-release, python3, + wget, + openssl, + ca-certificates, + distro-info, Restrictions: allow-stderr, needs-root, isolation-machine Features: test-name=boot-test diff --git a/debian/tests/uefi_tests_base.py b/debian/tests/uefi_tests_base.py index 7a595894..f56a2247 100644 --- a/debian/tests/uefi_tests_base.py +++ b/debian/tests/uefi_tests_base.py @@ -19,6 +19,7 @@ import os import shutil import stat +import math import subprocess import tempfile from time import sleep @@ -68,8 +69,8 @@ class UEFITestsBase(unittest.TestCase): klass.uefi_boot_dir = os.path.join(klass.uefi_base_dir, 'BOOT') klass.uefi_install_dir = os.path.join(klass.uefi_base_dir, 'debian') - # CAs for signature validation - klass.canonical_ca = os.path.join('/usr/share/grub', 'canonical-uefi-ca.crt') + # CAs for signature validation (not yet) + # klass.ca = os.path.join('/usr/share/grub', 'debian-uefi-ca.crt') # Shim paths klass.shim_pkg_dir = os.path.join('/', 'usr', 'lib', 'shim') @@ -85,8 +86,8 @@ class UEFITestsBase(unittest.TestCase): # OMVF paths if klass.arch_machine == 'x86_64': - klass.uefi_code_path = '/usr/share/OVMF/OVMF_CODE.ms.fd' - klass.uefi_vars_path = '/usr/share/OVMF/OVMF_VARS.ms.fd' + klass.uefi_code_path = '/usr/share/OVMF/OVMF_CODE_4M.ms.fd' + klass.uefi_vars_path = '/usr/share/OVMF/OVMF_VARS_4M.ms.fd' elif klass.arch_machine == 'aarch64': klass.uefi_code_path = '/usr/share/AAVMF/AAVMF_CODE.fd' klass.uefi_vars_path = '/usr/share/AAVMF/AAVMF_VARS.fd' @@ -169,13 +170,24 @@ class UEFIVirtualMachine(UEFITestsBase): os.makedirs(os.path.join(self.autopkgtest_dir.name, 'img')) self.arch = arch release = subprocess.run(['lsb_release','-c','-s'], capture_output=True, check=True) - self.release = release.stdout + self.release = release.stdout.strip().decode('utf-8') + release_number = subprocess.run(['lsb_release','-r','-s'], capture_output=True, check=True).stdout.strip().decode('utf-8') + self.release_number = None + try: + self.release_number = int(math.floor(float(release_number))) + except: + if(self.release == 'sid'): + self.release_number = 'sid' + else: + alias = subprocess.run(['distro-info','--alias', self.release], capture_output=True, check=True).stdout.strip().decode('utf-8') + number_distro = subprocess.run(['distro-info','-r', '--%s' % (alias)], capture_output=True, check=True).stdout.strip().decode('utf-8') + self.release_number = int(math.floor(float(number_distro))) self.path = tempfile.mkstemp(dir=self.autopkgtest_dir.name)[1] if not base: subprocess.run(['wget', - 'http://cloud.debian.org/%s/lastest/debian-%s-genericcloud-%s.img' - % (self.release, self.release, self.arch), - '-O', '%s/base.img' % self.autopkgtest_dir.name]) + 'https://cloud.debian.org/images/cloud/%s/daily/latest/debian-%s-genericcloud-%s-daily.qcow2' + % (self.release, self.release_number, self.arch), + '-O', '%s/base.img' % self.autopkgtest_dir.name], check = True) else: self.arch = base.arch shutil.copy(base.path, os.path.join(self.autopkgtest_dir.name, 'base.img')) @@ -222,13 +234,13 @@ class UEFIVirtualMachine(UEFITestsBase): def run(self): self.prepare() # start qemu-system-$arch, output log to serial and capture to variable - subprocess.run([self.qemu_arch, '-m', '2048', '-nographic', + subprocess.run([self.qemu_arch, '-m', '1024', '-nographic', '-serial', 'mon:stdio', '-drive', 'file=%s,if=pflash,format=raw,unit=0,readonly=on' % self.uefi_code_path, '-drive', 'file=%s.VARS.fd,if=pflash,format=raw,unit=1' % self.path, - '-drive', 'file=%s,if=none,id=harddrive0' % self.path, + '-drive', 'file=%s,if=none,id=harddrive0,format=qcow2' % self.path, '-device', 'virtio-blk-pci,drive=harddrive0,bootindex=0', - '-drive', 'file=%s/cloud-init.seed,if=virtio,readonly' % self.autopkgtest_dir.name]) + '-drive', 'file=%s/cloud-init.seed,if=virtio,readonly=on' % self.autopkgtest_dir.name]) def ready(self): """Returns true if the VM is booted and ready at userland""" -- cgit v1.2.3 From c62e4f08ea8651808c03627b9049eef6f9618c29 Mon Sep 17 00:00:00 2001 From: Bastien Roucariès Date: Tue, 16 Apr 2024 09:21:04 +0000 Subject: Add machine smm=on --- debian/tests/control | 2 ++ debian/tests/uefi_tests_base.py | 16 ++++++++++++---- 2 files changed, 14 insertions(+), 4 deletions(-) (limited to 'debian/tests/uefi_tests_base.py') diff --git a/debian/tests/control b/debian/tests/control index 6bcfb2c5..4cad1b6e 100644 --- a/debian/tests/control +++ b/debian/tests/control @@ -35,6 +35,8 @@ Depends: @, qemu-efi-aarch64 [arm64], grub-efi-arm64-signed [arm64], grub-efi-amd64-signed [amd64], + shim-signed [amd64], + shim-signed [arm64], lsb-release, python3, wget, diff --git a/debian/tests/uefi_tests_base.py b/debian/tests/uefi_tests_base.py index f56a2247..166d98c5 100644 --- a/debian/tests/uefi_tests_base.py +++ b/debian/tests/uefi_tests_base.py @@ -88,9 +88,11 @@ class UEFITestsBase(unittest.TestCase): if klass.arch_machine == 'x86_64': klass.uefi_code_path = '/usr/share/OVMF/OVMF_CODE_4M.ms.fd' klass.uefi_vars_path = '/usr/share/OVMF/OVMF_VARS_4M.ms.fd' + klass.uefi_qemu_extra = [ '-machine', 'q35,smm=on' ] elif klass.arch_machine == 'aarch64': klass.uefi_code_path = '/usr/share/AAVMF/AAVMF_CODE.fd' klass.uefi_vars_path = '/usr/share/AAVMF/AAVMF_VARS.fd' + klass.uefi_qemu_extra = [] subprocess.run(['modprobe', 'nbd']) @@ -157,6 +159,7 @@ ssh_pwauth: True manage_etc_hosts: True runcmd: - (while [ ! -e /var/lib/cloud/instance/boot-finished ]; do sleep 1; done; + touch /TESTOK; shutdown -P now) & """ @@ -211,10 +214,12 @@ class UEFIVirtualMachine(UEFITestsBase): f.write(DEFAULT_METADATA) with open(os.path.join(self.autopkgtest_dir.name, 'user-data'), 'w') as f: f.write(DEFAULT_USERDATA) + with open(os.path.join(self.autopkgtest_dir.name, 'network-config'), 'w') as f: + f.write('') subprocess.run(['genisoimage', '-output', 'cloud-init.seed', '-volid', 'cidata', '-joliet', '-rock', - '-quiet', 'user-data', 'meta-data'], + '-quiet', 'user-data', 'meta-data', 'network-config'], cwd=self.autopkgtest_dir.name) def list(self, path='/etc/'): @@ -225,7 +230,7 @@ class UEFIVirtualMachine(UEFITestsBase): def update(self, src=None, dst=None): self._mount() try: - os.makedirs(os.path.join(self.autopkgtest_dir.name, 'img', os.path.dirname(src))) + os.makedirs(os.path.join(self.autopkgtest_dir.name, 'img', os.path.dirname(dst))) except FileExistsError: pass shutil.copy(src, os.path.join(self.autopkgtest_dir.name, 'img', dst)) @@ -234,8 +239,11 @@ class UEFIVirtualMachine(UEFITestsBase): def run(self): self.prepare() # start qemu-system-$arch, output log to serial and capture to variable - subprocess.run([self.qemu_arch, '-m', '1024', '-nographic', + subprocess.run([self.qemu_arch] + self.uefi_qemu_extra + [ + '-m', '1024', '-nographic', '-serial', 'mon:stdio', + '-netdev', 'user,id=network0', + '-device', 'virtio-net-pci,netdev=network0,mac=52:54:00:12:34:56', '-drive', 'file=%s,if=pflash,format=raw,unit=0,readonly=on' % self.uefi_code_path, '-drive', 'file=%s.VARS.fd,if=pflash,format=raw,unit=1' % self.path, '-drive', 'file=%s,if=none,id=harddrive0,format=qcow2' % self.path, @@ -246,7 +254,7 @@ class UEFIVirtualMachine(UEFITestsBase): """Returns true if the VM is booted and ready at userland""" # check captured serial for our marker self._mount() - result = os.path.exists(os.path.join(self.autopkgtest_dir.name, 'img', '/var/lib/cloud/instances/nocloud/boot-finished')) + result = os.path.exists(os.path.join(self.autopkgtest_dir.name, 'img', 'TESTOK')) self._unmount() return result -- cgit v1.2.3