From patchwork Sat Feb 14 02:13:07 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1873 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=1771035266; bh=OudJiVrQE1YphAGGRpRRS5Qy2/LUGfvfhSuH2kDZtoU=; 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=M6wKu3OyU0CkVWOBivBMtpxlolLoDk6pRzZr1+XHwFiT07NMZaqTkRh/cOClouFfL 4oO6UgZgBlbEVhTgABBxRwDzz9ugspoCuw4Cl4tBpMWxpudGlSieiU557gamiUyl9f O7vSzod5pFsptO+TR66X2ALSUdZOH4wszjcNS1OojdWwkt70V6u8TY1cJ8wDVVcxy+ tKai4Gcd5S75JQkNwBRdRUUmgorvanViUs6JyBB+6YA8k6ifU2QtAgBo0b57nSrDkc HxNDPpvXMUi98q9Bl80JVRC4tNe9W43dLLNFpEpv9Aj90txgyeO7FBskUO1v1QSG52 nFpfTxUZN+vrQ== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 2E74669B5A for ; Fri, 13 Feb 2026 19:14:26 -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 tRLCVqEUsjAH for ; Fri, 13 Feb 2026 19:14:26 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1771035266; bh=OudJiVrQE1YphAGGRpRRS5Qy2/LUGfvfhSuH2kDZtoU=; 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=M6wKu3OyU0CkVWOBivBMtpxlolLoDk6pRzZr1+XHwFiT07NMZaqTkRh/cOClouFfL 4oO6UgZgBlbEVhTgABBxRwDzz9ugspoCuw4Cl4tBpMWxpudGlSieiU557gamiUyl9f O7vSzod5pFsptO+TR66X2ALSUdZOH4wszjcNS1OojdWwkt70V6u8TY1cJ8wDVVcxy+ tKai4Gcd5S75JQkNwBRdRUUmgorvanViUs6JyBB+6YA8k6ifU2QtAgBo0b57nSrDkc HxNDPpvXMUi98q9Bl80JVRC4tNe9W43dLLNFpEpv9Aj90txgyeO7FBskUO1v1QSG52 nFpfTxUZN+vrQ== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 18FCA69B56 for ; Fri, 13 Feb 2026 19:14:26 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1771035264; bh=M/zTsI2pFzTMuggLq848vftST5I3e1wxd0NM3VKuBrY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gtyngzyr3lY5fbhaXjYNk3fhrAOet7+4WgLNzBtWiFytOFvlT07Zs1fjGEkF+d/rn lRjyacrk/wCkKVK85jhWhK2Ga/Dlt7OJuUnh0gkLB7NICnmlmFLFaTrn4JmkDJPVna wz51nNLj8FOO6b/0FdVBHLh6+96k7VvxiKcPbntBwWPWSpS3ry24KNK0AtAaY8Gs+c QPIB70srwLt2YOFh0/ZtXOZC0qaH2DXErQIpW9zHMfZYHzpzPSBTY/1ZhRLhwvZnEX +6dE1ctX9h2CSGbjoFwrW09zCqeRgpJp0SEfIkYfBDOtBPzAwDspZJ48VJ6ZZqmOYS qcfyvC+JiIHog== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id A142569B58; Fri, 13 Feb 2026 19:14:24 -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 MgRe1GxDXsAm; Fri, 13 Feb 2026 19:14:24 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1771035264; bh=x7jAJ3cuMH3mCuAkZRFjMGgqHuh6+c5l8ewW8/d7XBc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hYwnjHNhlXf3nbTkKieUOoFnZ6SPZ1f/jTWxzS2Pdafy1yzzhQO7qKAWPX4u/Culg c0I7rakAEiffZd57DuOiktVSfGrc93eQJ/nbK/0X4MhCyiAaoRDLKYqrmnro7Z6nof 755B0m5iDeRYzEgH4snHaExqPVyurbqB8H6t38SSGHCeqVuq6yuTXeSUZqdNfTSuqx XpF82Ht7mOqzRBvYYMSXHDDh8aNo/Eho8oQ5rhSlRU/6OUDjbumu7P2R8SASTdnoem s/NiaANcRodkR5VgGEKoKiFHBOJEHCQZMKF+GKms8G18c7f7yaZuD12lSxOPfiP2Gn 7Vnna+jMEhrTg== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 08D0C69B56; Fri, 13 Feb 2026 19:14:23 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Fri, 13 Feb 2026 19:13:07 -0700 Message-ID: <20260214021317.816170-14-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260214021317.816170-1-sjg@u-boot.org> References: <20260214021317.816170-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: BKVKHCYFZGHUV3TRSWTVOPLRN4HG3Y4L X-Message-ID-Hash: BKVKHCYFZGHUV3TRSWTVOPLRN4HG3Y4L 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 13/13] x86: ulib: Add pytest for demo.rom under QEMU 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 There is no test coverage for the demo.rom x86 image that packages the ulib example program. Add test_ulib_demo_rom() which boots demo.rom under qemu-system-i386 and verifies the expected demo output strings appear on the serial console. The test skips gracefully if demo.rom or QEMU is not available. Co-developed-by: Claude Opus 4.6 Signed-off-by: Simon Glass --- test/py/tests/test_ulib.py | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/test/py/tests/test_ulib.py b/test/py/tests/test_ulib.py index 9e46d529c87..aff586c4d79 100644 --- a/test/py/tests/test_ulib.py +++ b/test/py/tests/test_ulib.py @@ -4,6 +4,7 @@ """Test U-Boot library functionality""" import os +import shutil import subprocess import pytest import utils @@ -208,3 +209,32 @@ def test_ulib_api_header(ubman): assert 'ub_printf(const char *fmt, ...)' in out assert 'ub_snprintf(char *buf, size_t size, const char *fmt, ...)' in out assert 'ub_vprintf(const char *fmt, va_list args)' in out + +@pytest.mark.boardspec('qemu-x86') +@pytest.mark.buildconfigspec("examples") +def test_ulib_demo_rom(ubman): + """Test the ulib demo ROM image under QEMU x86.""" + build = ubman.config.build_dir + demo_rom = os.path.join(build, 'demo.rom') + + assert os.path.exists(demo_rom), 'demo.rom not found in build directory' + assert shutil.which('qemu-system-i386'), 'qemu-system-i386 not found' + + cmd = ['qemu-system-i386', '-bios', demo_rom, '-nographic', + '-no-reboot'] + with subprocess.Popen(cmd, stdout=subprocess.PIPE, + stderr=subprocess.PIPE) as proc: + try: + stdout, _ = proc.communicate(timeout=5) + except subprocess.TimeoutExpired: + proc.kill() + stdout, _ = proc.communicate() + + out = stdout.decode('utf-8', errors='replace') + + assert 'U-Boot Library Demo Helper' in out + assert '==========================' in out + assert 'U-Boot version:' in out + assert 'helper: Adding 42 + 13 = 55' in out + assert '=================================' in out + assert 'Demo complete' in out