From patchwork Sat Mar 14 23:16: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: 1989 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=1773530273; bh=PoEwhhC58P3l+FBg08CLrEl07T/tsg5YYgPbJPa4EfQ=; 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=egAREJMXmsLAekPmlTU5qXQRzr9O/Ju1/ivsHngU5QOM8ocsL3zUWkzAG7libnbin JWEwwJOTAbq0N0TNgC+lew/1CgX4ePZEM+z1+uBXuPpCGQ5vj/pqgoekPPzmFsducc YDvFgamujBDJxi/BeTPdf/v3ORW1z09VLhVhPNu7rze2qhiLS9V/SgY2Xv4Natl2IF ViCSO+FDZ7ZkPxUycufIkqsBrTqFYS7AX3bM8PWqxVE+F44VhRPbL/UK9ntcD1EtoK I1HXhT6GbQU3SIhPh9yDN3G8bOLxHtQ/iyFtUebnOol9Wb4xVObSSnBf/O/GuGNAOK onxTTBKlaVJjg== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 34D996A03F for ; Sat, 14 Mar 2026 17:17:53 -0600 (MDT) 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 vVLorRF6_lZu for ; Sat, 14 Mar 2026 17:17:53 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1773530272; bh=PoEwhhC58P3l+FBg08CLrEl07T/tsg5YYgPbJPa4EfQ=; 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=bcSG4vMRulZTNwWamQzlGW2iCNmWDmZ7biD0FK0x21UmX3463cHpWPWMcHlj/3Slu 6apcSEnnC0YU6f5PepeGyr6gD48AhsINiLf4+gXQe3E4gmDzAXdmk+LmYx7TTFpAR8 0cwUJsMlzEcNK1jU6uC0wxVkCLbYnM7S8OWRCj466rZT4jCa/jDbY781uoTrTqJ7mP 2sTqSPnXz4tPAj5YLlYB2m62Cpt385AyTJzZTwdeAGxGT2CAf0fldivjCHccr1QtVD vyEy3kV7rfYhYhNeDWvIdp9/er3yroz0RErZ3a7E8yN6xXeGJUbtWRBbsMQegT767D CXkFGEOLEUOMA== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 19FB56A04B for ; Sat, 14 Mar 2026 17:17:52 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1773530269; bh=xz7xrlttIYUIIq1SL2w/tkvGI/HUlLVKpftHpYvmTqU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QkNd63R5Nww38Gh/hs0hbVWbhHMGnLle8UDqRtmq4JUjI6GxMxjM3vbDacT7XaNEY xdmXwX7X8w7K5/GuYETRQNsbdTdWW1N+KkvzRKIajEuJ4ydX1jh7btZPjCOxmI3Z7Q mG5VTm/YdL1QEkp4Z5n7uIyFP48DjbXF5evPBm78gGuqbnlQ2IZ3KNykX5BkXPjrXJ IFS8j+9wKJDui8R8hOgAjHkYrqdWx4UmrPfMJhrZHr38do4OHZlnAnykMgbWJEiFWy dipGJjNaenY8JDHo+vJM6hJTOXIwMJ2cPg8KsvFeK6JKw/g0L+Fz77zaw9oUK/rnjL x6Ec3N52PoQ9w== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id B9F206A056; Sat, 14 Mar 2026 17:17:49 -0600 (MDT) 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 eExYjXSmjF23; Sat, 14 Mar 2026 17:17:49 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1773530264; bh=WqV9CcqV8l++WVPD03T5n/3KzulQDIRGmb0NtTPgA/Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bqQ3mPjuywIwcZIsVAK/BptHGJ+lA5m5+F2mqEXLYNJiUE2dmhtNUdR4ELmfAZZC+ 11TCgbRK3WFJc8G1VcSTJGj4axs1EOKsXLS215jt5BX1G1pGO77M+HTuGd9wdt0lmF LslKMElPbhKFmepvGPioP/29OsIHsRz8CiqOIE6EnL8ItT1S3sfDQ855O5WPan02Wo 4zg9N/y+Cp8KiziB/B8jPZElgKSuMfHH5JdnKXoPZJLhTv6CLpweaZ98M1lsEN1t2y s8PdawQDhHj6vmS315ABsdC7xWYf/wWrpYh/TU/5K2wVSp/LXx+8TYum0FskKuD9bc 5/eIn+9i7TRaA== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 911746A03C; Sat, 14 Mar 2026 17:17:44 -0600 (MDT) From: Simon Glass To: U-Boot Concept Date: Sat, 14 Mar 2026 17:16:07 -0600 Message-ID: <20260314231618.338113-17-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260314231618.338113-1-sjg@u-boot.org> References: <20260314231618.338113-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: LREUB4M4HV6FNVEV72ZXF6M2KMY34P6B X-Message-ID-Hash: LREUB4M4HV6FNVEV72ZXF6M2KMY34P6B 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 X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 16/19] test: py: Send poweroff on every sandbox shutdown 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 When --malloc-dump is active, only the final close() sends poweroff to trigger state_uninit(). Intermediate shutdowns from cleanup_spawn() (used by restart_uboot and failure cleanup) just close the PTY, so those sessions never write a dump file. Send poweroff before every shutdown path so each sandbox session produces a dump. This makes the dump sequence numbers sequential. Signed-off-by: Simon Glass --- test/py/console_sandbox.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/test/py/console_sandbox.py b/test/py/console_sandbox.py index 424e3ad2dd7..21625140dbb 100644 --- a/test/py/console_sandbox.py +++ b/test/py/console_sandbox.py @@ -93,8 +93,8 @@ class ConsoleSandbox(ConsoleBase): self.sandbox_flags = [] self.use_dtb = True - def close(self): - """Terminate the sandbox, using poweroff for a clean shutdown. + def _poweroff_if_needed(self): + """Send poweroff for a clean shutdown if malloc-dump is active. When --malloc-dump is active we need state_uninit() to run, so send 'poweroff' instead of just closing the PTY. @@ -108,6 +108,15 @@ class ConsoleSandbox(ConsoleBase): time.sleep(0.1) except: pass + + def cleanup_spawn(self): + """Shut down sandbox, using poweroff for a clean shutdown.""" + self._poweroff_if_needed() + super().cleanup_spawn() + + def close(self): + """Terminate sandbox, using poweroff for a clean shutdown.""" + self._poweroff_if_needed() super().close() def kill(self, sig):