From patchwork Mon Feb 16 01:35:00 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1892 Return-Path: X-Original-To: u-boot-concept@u-boot.org Delivered-To: u-boot-concept@u-boot.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1771205761; bh=sRtZKE8V+23WOosVj/kbiEqLABs07xfq2zVqGHbRSSg=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=KQOJ5tymASv7bWeHc6lSxzc1MUV3Qy+ulW4FIhqXR4Ic6eauK8zCen//zoBebzNhE s0mb9L998MATW90jBfrcRoltycDII+5ih5NcTqZa6ClODjif2OyYvb+r6mUdSN+e4z vr9ktBbb4/blFCnQgkyVj0RO1EODTkm0LoSKYJ5YUsmjtpCI1Y16cgXAyBkP3IdEYo H6y+ZxEqtu8hSHqxCfuGB83sGjnS0zp95Jw+nSGaIw/GZzkdEun2khUmquqs35XBB+ QVveM0uSlQqO/sU8vZrZHcZjHb96CJ1syoxikuC0M46UEzxWJAMIDOLvbUxJQNGQUn R/rJcYv1iCsbw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id DD18469BE9 for ; Sun, 15 Feb 2026 18:36:01 -0700 (MST) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10024) with ESMTP id XFFxZnBMzuUg for ; Sun, 15 Feb 2026 18:36:01 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1771205761; bh=sRtZKE8V+23WOosVj/kbiEqLABs07xfq2zVqGHbRSSg=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=KQOJ5tymASv7bWeHc6lSxzc1MUV3Qy+ulW4FIhqXR4Ic6eauK8zCen//zoBebzNhE s0mb9L998MATW90jBfrcRoltycDII+5ih5NcTqZa6ClODjif2OyYvb+r6mUdSN+e4z vr9ktBbb4/blFCnQgkyVj0RO1EODTkm0LoSKYJ5YUsmjtpCI1Y16cgXAyBkP3IdEYo H6y+ZxEqtu8hSHqxCfuGB83sGjnS0zp95Jw+nSGaIw/GZzkdEun2khUmquqs35XBB+ QVveM0uSlQqO/sU8vZrZHcZjHb96CJ1syoxikuC0M46UEzxWJAMIDOLvbUxJQNGQUn R/rJcYv1iCsbw== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 329D469BE8 for ; Sun, 15 Feb 2026 18:36:01 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1771205758; bh=3qv5aGETdW2ZthM0J3C5qGXKnlh4BFA7sUYOcl3cHAM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZTltIx0d/x/kZ0ZTs/VAyyTT7CNZUNkQ8iNF0Yh7CAwA8fZFwRP/3zfS4J+QSlZ2L 66uhnaaNCK5KceL6XXxSsFDyVatyb22MpdrDJKwAsbuOY9bZ3DCWKtunU7Ly1HkhPP IsNyc6OdYqn3EHFYISL7jnbyCZCNGnymg7Cp8wPu5vmB3DEAXUHTN7mOMMh0tHMZRG d+hXLTVP70zyd9tD6prCzvz37RR/S3R6h0jYmVC3nXR+/qSIZeJAlHc9013VlUyGDm a+gxVyqHWe+o7NyiDQ3s7IVW7DNsukv1UGri7Qg1EGnXdJATl4KZIhz8VDX+yN6hXJ i9soD0GDUrs/A== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 3FB0969AD9; Sun, 15 Feb 2026 18:35:58 -0700 (MST) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10026) with ESMTP id cH47WENWlTEe; Sun, 15 Feb 2026 18:35:58 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1771205757; bh=kX5oUKvgmdJM0mfVYCOmZWp9z7PaAvsvmcO/XqdWSwQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AJhm4/zI2VbndiXUZcilwxfiCcmPO5XKPdaE7NAdaqjC1zujFqx7ndiKU65gi2KeA gzhfVHY0aEzVGyk/JnwUAHYKWpD4V5dBRxR/VzllHPg3XmBJ4wC2mMPIYUljlN4zS9 dKRrW4SEFVksaO3LP1euRjSJGb2/QiYy0jBk0BCcg2hoCn+6qu5oezYj6gT4USQKcE DXGrL1uHTctWVjQKXNkRYQA+xwlD+1OYQsMNSyFPlYqzFPatvRzBwQa+h95fD8L540 C+zdcdCrkaQ+88V6B3D0kA7GaIG8ZNKwfp1NKzwNjGrUQKPCf8jAh6Us9P8rPbH14N zrq3IW10NMxww== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 9648969B01; Sun, 15 Feb 2026 18:35:57 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Sun, 15 Feb 2026 18:35:00 -0700 Message-ID: <20260216013511.4079770-13-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260216013511.4079770-1-sjg@u-boot.org> References: <20260216013511.4079770-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: H7HLT5LNDB2LVG7LECV752D3KHYPEIAO X-Message-ID-Hash: H7HLT5LNDB2LVG7LECV752D3KHYPEIAO X-MailFrom: sjg@u-boot.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Simon Glass , "Claude Opus 4 . 6" X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 12/17] ulib: test: Add a pytest for efi-x86_app64 demo List-Id: Discussion and patches related to U-Boot Concept Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Simon Glass Add test_ulib_demo_efi_x86() which boots demo-app.efi under QEMU x86_64 with OVMF firmware. The test writes a startup.nsh script next to demo-app.efi in the build directory, then boots QEMU with the FAT directory and checks for the expected demo output. Also add a timeout parameter to run_qemu_demo() since OVMF boot takes longer than bare-metal demos. Co-developed-by: Claude Opus 4.6 Signed-off-by: Simon Glass --- test/py/tests/test_ulib.py | 37 +++++++++++++++++++++++++++++++++++-- 1 file changed, 35 insertions(+), 2 deletions(-) diff --git a/test/py/tests/test_ulib.py b/test/py/tests/test_ulib.py index 71fe751efc9..1c98b8b6880 100644 --- a/test/py/tests/test_ulib.py +++ b/test/py/tests/test_ulib.py @@ -234,12 +234,13 @@ def assert_demo_output(out): assert '=================================' in out assert 'Demo complete' in out -def run_qemu_demo(qemu_cmd): +def run_qemu_demo(qemu_cmd, timeout=5): """Run a ulib demo under QEMU and return output. Args: qemu_cmd (list): QEMU command and arguments (e.g. ['qemu-system-i386', '-bios', 'demo.rom', ...]) + timeout (int): Seconds to wait before killing QEMU (default 5) Returns: str: Decoded stdout from QEMU @@ -247,7 +248,7 @@ def run_qemu_demo(qemu_cmd): with subprocess.Popen(qemu_cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE) as proc: try: - stdout, _ = proc.communicate(timeout=5) + stdout, _ = proc.communicate(timeout=timeout) except subprocess.TimeoutExpired: proc.kill() stdout, _ = proc.communicate() @@ -331,3 +332,35 @@ def test_ulib_demo_arm64(ubman): def test_ulib_demo_riscv64(ubman): """Test the ulib demo binary under QEMU RISC-V 64.""" run_bios_demo(ubman, 'qemu-system-riscv64') + +@pytest.mark.localqemu +@pytest.mark.boardspec('efi-x86_app64') +@pytest.mark.buildconfigspec("examples") +def test_ulib_demo_efi_x86(ubman): + """Test the ulib demo EFI application under QEMU x86_64 with OVMF.""" + build = ubman.config.build_dir + efi_dir = os.path.join(build, 'examples', 'ulib') + demo_efi = os.path.join(efi_dir, 'demo-app.efi') + + assert os.path.exists(demo_efi), 'demo-app.efi not found in build directory' + assert shutil.which('qemu-system-x86_64'), 'qemu-system-x86_64 not found' + + ovmf_code = '/usr/share/OVMF/OVMF_CODE_4M.fd' + ovmf_vars = '/usr/share/OVMF/OVMF_VARS_4M.fd' + assert os.path.exists(ovmf_code), 'OVMF firmware not found' + + with open(os.path.join(efi_dir, 'startup.nsh'), 'w', + encoding='utf-8') as nsh: + nsh.write('fs0:demo-app.efi\n') + + # OVMF needs a writable copy of the vars file + vars_copy = os.path.join(efi_dir, 'OVMF_VARS_4M.fd') + shutil.copy(ovmf_vars, vars_copy) + + cmd = ['qemu-system-x86_64', + '-drive', f'if=pflash,format=raw,file={ovmf_code},readonly=on', + '-drive', f'if=pflash,format=raw,file={vars_copy}', + '-drive', f'file=fat:rw:{efi_dir},format=raw', + '-nographic', '-no-reboot', '-nic', 'none'] + out = run_qemu_demo(cmd, timeout=15) + assert_demo_output(out)