From patchwork Sat Jan 10 20:28:57 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1471 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=1768077077; bh=27HNyYizZAqjLl/TBsbJV1I8DVSWQ+pQ4q3fDmtBghg=; 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=mPLtLKCivsmcYzwgLQLQLiXOKLFuk0AuW2WC2++7cC5scVD2WrfHLBu4TgUSSYDar wGjfY39psugYCNwqmjqHjCUFxagb0KCn93iWfEx0+e+tMS/RZ4DFlBSFz4T7UjUIja tBCODhhoMON9+pGPcV7WyZwqYmA87raM6qBSfFPJpCbHwhKNry+kc5BTsJAL4CUJxx lQlgdoVHngp9aLC4hjDyiDwu8BJdqKJFnDSDeL2Ow1S8oatwwn52kuEFCyAneJ1OGz XQLSEXLEU4NFd2krdT8jRm4KC28nDBP1USAx7VMJGVs5M98Wkh6zFTpytRbaQWKF7A T3SDbraySIuzw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 32421692A6 for ; Sat, 10 Jan 2026 13:31:17 -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 H0f9CCjh_JnC for ; Sat, 10 Jan 2026 13:31:17 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768077077; bh=27HNyYizZAqjLl/TBsbJV1I8DVSWQ+pQ4q3fDmtBghg=; 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=mPLtLKCivsmcYzwgLQLQLiXOKLFuk0AuW2WC2++7cC5scVD2WrfHLBu4TgUSSYDar wGjfY39psugYCNwqmjqHjCUFxagb0KCn93iWfEx0+e+tMS/RZ4DFlBSFz4T7UjUIja tBCODhhoMON9+pGPcV7WyZwqYmA87raM6qBSfFPJpCbHwhKNry+kc5BTsJAL4CUJxx lQlgdoVHngp9aLC4hjDyiDwu8BJdqKJFnDSDeL2Ow1S8oatwwn52kuEFCyAneJ1OGz XQLSEXLEU4NFd2krdT8jRm4KC28nDBP1USAx7VMJGVs5M98Wkh6zFTpytRbaQWKF7A T3SDbraySIuzw== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 197536927E for ; Sat, 10 Jan 2026 13:31:17 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768077074; bh=DB0ygrfzPGw08JRC03uA+Vpf0YX3z+WBW02066cZlZA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kUCL4f85ACe7nvC56SgCxd0OKrxqFAig7GABwsOTFky06/M4NTwuqEizxXpbolw71 CRzA43s7Db3IehOzCXbHzObBhtzZ7DpyrIjN2/fLhM5HcRhoiuCHn0+80V1v4u3h/x uncTcqmnoQHuxURy+hOAgE3kDQ998G/SRj/yScEjaq1Jos38v2d3Qmb1YzKloCjO8V DPSMuw0TtzE44cOBDFmpq10Gjgr0Yx5TYj7V8sQupn2wjwTT3KSbnPXdkBDod0WT3Y TXrjMO9jR0YzUoevYY6JI+lsaonGifectJC6qZxNd7YrwXBdyELAy1Swcrqu2/G+6k oRYF/LZaAxVpQ== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 85E8A69184; Sat, 10 Jan 2026 13:31:14 -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 j_of-skEqM-d; Sat, 10 Jan 2026 13:31:14 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768077070; bh=AmeKnvWmeQkndUVU2sDnm1jTqq1fjOdlY6S3khXziWU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kJAevCSr+GEmGmIJCJWfZRawW3vNeqm+ZhS2vjoq90KQGk+0DgPZ6xv8gCl2cT4dd yeXdp16C/8uBhLAXEKRfZjvwl7WN0AJTkGj8g+wb93aalPqKL+dJkZ11Kdhg8yblQW G19d6xK/FuepKvzkEBw/GfIR4hL3hBMM+NhHjZ/uoIClctFcW2BMxIGH6BCD2K35nF zwlcrjc+xf1RymRWBkINVH4JUPyMGILi2g4/nevY1axqfDSKIYdruRV3TbYkptEoJr h9tfjUvjhs/wmNs+9TaWlukQSdKZEnxCY+GtgOPW8OzmKjtvp1H+NBNK1K/KFAl0iK dq7rCpijChusA== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 2653369186; Sat, 10 Jan 2026 13:31:10 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Sat, 10 Jan 2026 13:28:57 -0700 Message-ID: <20260110202906.187370-26-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260110202906.187370-1-sjg@u-boot.org> References: <20260110202906.187370-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: 2BBZ327P4AOQBCF5UAXPPJJ3Q67VJKX6 X-Message-ID-Hash: 2BBZ327P4AOQBCF5UAXPPJJ3Q67VJKX6 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: Heinrich Schuchardt , Simon Glass , "Claude Opus 4 . 5" X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 25/26] test: pxe: Add memory-leak check to files-API test 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 a check for memory leaks in the callback-free files API test. This ensures that pxe_cleanup() properly frees all allocated memory. Co-developed-by: Claude Opus 4.5 Signed-off-by: Simon Glass --- test/boot/pxe.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/test/boot/pxe.c b/test/boot/pxe.c index 80779b86aad..f4a124eafda 100644 --- a/test/boot/pxe.c +++ b/test/boot/pxe.c @@ -12,6 +12,7 @@ * */ +#include #include #include #include @@ -1358,6 +1359,7 @@ static int pxe_test_files_api_norun(struct unit_test_state *uts) struct pxe_file *filep; ulong addr = PXE_LOAD_ADDR; ulong file_addr; + ulong start_mem; ulong size; char *buf; uint i; @@ -1368,6 +1370,9 @@ static int pxe_test_files_api_norun(struct unit_test_state *uts) /* Bind the filesystem image */ ut_assertok(run_commandf("host bind 0 %s", fs_image)); + blkcache_free(); + start_mem = ut_check_delta(0); + /* Load the config file first */ ut_assertok(load_file(cfg_path, addr, &size)); @@ -1479,8 +1484,10 @@ static int pxe_test_files_api_norun(struct unit_test_state *uts) ut_asserteq_mem("ramdisk", buf, 7); unmap_sysmem(buf); - /* Clean up */ + /* Clean up and check for memory leaks */ pxe_cleanup(ctx); + blkcache_free(); + ut_assertok(ut_check_delta(start_mem)); return 0; }