| Message ID | 20260416023021.626949-16-sjg@u-boot.org |
|---|---|
| State | New |
| Headers |
Return-Path: <concept-bounces+u-boot-concept=u-boot.org@u-boot.org> 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=1776306672; bh=ImDYS9k9ERD35H3LjMtIzVvFCqWWbX62Qn1YVxEOHtQ=; 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=QwLsZgSLc2Hx5d1qQyzoK5yDhgZFNKCTiTwrYOaRx0N2TKlcZkeaQgJIJS2NAhaaR TA1RqKGy2zqYH169GarYyke8rkT80LN1Ut8kHnuh03K5yG0nDWKMSv87u09P6d2vTG q/B4yQe3XtD7XPnirFwGvLDnhBeJab6xoCEklEkA= Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 4D1AD6A4B7 for <u-boot-concept@u-boot.org>; Wed, 15 Apr 2026 20:31:12 -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 UKfXybmoAwXC for <u-boot-concept@u-boot.org>; Wed, 15 Apr 2026 20:31:12 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1776306668; bh=ImDYS9k9ERD35H3LjMtIzVvFCqWWbX62Qn1YVxEOHtQ=; 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=CBe2LZr3UM1KBqAu9kBaorcXZq9WoEgIWxZH/6z3PQXu5/jKknNvNU3unFLEw7tHR pk9XAkCREf6pxAAUIyHBqg+whHWTWSKhs5A7Bh4PCwICcwVHqclK0adga56FNFhjrF Fov7qcF3Bg0Jv/C7sZLUx8/6oPh2uiCnlaCwu88k= Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 845276A4B8 for <u-boot-concept@u-boot.org>; Wed, 15 Apr 2026 20:31:08 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1776306667; bh=UhyiJZjHmr+rRcZJ3NwwrU8V2MpbvBh0c14WUfUpLsw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=c1FYYqN73/46NAt7Wb8SuvfA9KYx7CqhzQ1fwgqgn1Pfs8hFp32ikQlvo1zbfnxvN jE/ZzDuGkUqLDnCZxqjvlYbd9tllggTxXlEGiDk7G97g6xd2GpKZMdyRt7GUCX6Zb9 lT3r9CWWHLZDANLVhF1fO+ZltJ5yHX+/kGf7gEhU= Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 13EFB6A4B7; Wed, 15 Apr 2026 20:31:07 -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 LsPe-sE8Ys3L; Wed, 15 Apr 2026 20:31:06 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1776306663; bh=tsyRtX+KhKQACE7/7gicSXAgG9A5ImxDqfoJUCIz3SY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oD3e5DAlOu9bIEKAF9fDlDYe9Iyr7H0+TJqpjdxXIvsbrwDVaD+7qtzpRT59jgQer Ofi50+9Af4QMXDsXqZKS5qabkYnWw2pC6hOQMXTqibGIYpP/zSSKQBXYaoMVkRpN1X TJhcdRE0M8CqxLGcvgGt/HAZ4DQoiza9HWq6wM/w= Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 1E21A6A4A5; Wed, 15 Apr 2026 20:31:03 -0600 (MDT) From: Simon Glass <sjg@u-boot.org> To: U-Boot Concept <concept@u-boot.org> Date: Wed, 15 Apr 2026 20:29:40 -0600 Message-ID: <20260416023021.626949-16-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260416023021.626949-1-sjg@u-boot.org> References: <20260416023021.626949-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: G3E2NMGSEXE4IRCQIGJDMGBFSMJ3L35B X-Message-ID-Hash: G3E2NMGSEXE4IRCQIGJDMGBFSMJ3L35B 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 <sjg@chromium.org> X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 15/33] test: usb: Reset usb_started at start of usb_stop test List-Id: Discussion and patches related to U-Boot Concept <concept.u-boot.org> Archived-At: <https://lists.u-boot.org/archives/list/concept@u-boot.org/message/G3E2NMGSEXE4IRCQIGJDMGBFSMJ3L35B/> List-Archive: <https://lists.u-boot.org/archives/list/concept@u-boot.org/> List-Help: <mailto:concept-request@u-boot.org?subject=help> List-Owner: <mailto:concept-owner@u-boot.org> List-Post: <mailto:concept@u-boot.org> List-Subscribe: <mailto:concept-join@u-boot.org> List-Unsubscribe: <mailto:concept-leave@u-boot.org> Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit |
| Series |
Fix memory leaks and test pollution in sandbox tests
|
|
Commit Message
Simon Glass
April 16, 2026, 2:29 a.m. UTC
From: Simon Glass <sjg@chromium.org> Running bootctl_logic_tkey before dm_test_usb_stop causes the latter to fail: uclass_get_device(UCLASS_MASS_STORAGE, 0, ...) returns -ENODEV and count_usb_devices() returns 2 instead of 7. The bootctl test scans USB during setup, which sets the global usb_started flag. When the test ends, dm_test_post_run() destroys every uclass, removing the USB devices, but usb_started stays true. The usb_stop test has UTF_SCAN_PDATA | UTF_SCAN_FDT rather than UTF_DM, so no driver-model reset happens before it runs, and its usb_init() call short-circuits on the stale flag without scanning any buses. Clear usb_started at the start of the test so usb_init() performs a real scan regardless of what state an earlier test left behind. Signed-off-by: Simon Glass <sjg@chromium.org> --- test/dm/usb.c | 8 ++++++++ 1 file changed, 8 insertions(+)
diff --git a/test/dm/usb.c b/test/dm/usb.c index 66777b5ef00..b3cf8ce8c36 100644 --- a/test/dm/usb.c +++ b/test/dm/usb.c @@ -152,6 +152,14 @@ static int dm_test_usb_stop(struct unit_test_state *uts) { struct udevice *dev; + /* + * A previous test (e.g. bootctl_logic_tkey) may have left the + * global usb_started flag set while the USB uclass was then + * destroyed by dm_test_post_run(). Reset it here so usb_init() + * actually scans the buses, rather than short-circuiting. + */ + usb_started = false; + /* Scan and check that all devices are present */ state_set_skip_delays(true); ut_assertok(usb_init());