From patchwork Mon Feb 27 19:53:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Vasut X-Patchwork-Id: 1749114 X-Patchwork-Delegate: sjg@chromium.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=mailbox.org header.i=@mailbox.org header.a=rsa-sha256 header.s=mail20150812 header.b=LNYkL8De; dkim=pass (2048-bit key) header.d=mailbox.org header.i=@mailbox.org header.a=rsa-sha256 header.s=mail20150812 header.b=qupBvmqf; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4PQWYD3wS6z1yWy for ; Tue, 28 Feb 2023 06:59:28 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 6EFC185BC0; Mon, 27 Feb 2023 20:56:44 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=reject dis=none) header.from=mailbox.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; secure) header.d=mailbox.org header.i=@mailbox.org header.b="LNYkL8De"; dkim=pass (2048-bit key) header.d=mailbox.org header.i=@mailbox.org header.b="qupBvmqf"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 5839585A35; Mon, 27 Feb 2023 20:55:21 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mout-p-102.mailbox.org (mout-p-102.mailbox.org [80.241.56.152]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 49B76855BA for ; Mon, 27 Feb 2023 20:55:18 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=reject dis=none) header.from=mailbox.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=marek.vasut+renesas@mailbox.org Received: from smtp102.mailbox.org (smtp102.mailbox.org [IPv6:2001:67c:2050:b231:465::102]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-102.mailbox.org (Postfix) with ESMTPS id 4PQWSN0Gp4z9scb; Mon, 27 Feb 2023 20:55:16 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mailbox.org; s=mail20150812; t=1677527716; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=kYGr1wOXcD3FzBG8IQ3KicLmP5Lx1JwjtlqIYlFYnec=; b=LNYkL8Dech3c4OvNEarQpJVmUOlUZKzM1aVP429UtxZG88nWLq1LkCFFwlRoIIDrFkJYqt mGwIlN3Y4d9LofNI7UntxDuu76E1EXGLk2w2f9/UTXd6CFtTfD8pUMALIqTZ3goZAeQ3U+ MVCEpezXCWopkpwN/OUjCUbnFbx++qu00auQWdeGK3LjqD4Wdmaw4KTQeEPLOGBXPuDdqA uw04xVlOp2Kfug5aph6aRkCD4uWrlw8jr3TDPUU5B6e9opm8Y9RfIua7Rf8GhiG95KZrvu 81qSgRSX5qbdL+J+myFnqjCBy3dt9DiEbRoap6f23yKiVeQScHdwYNYSOBEzqg== From: Marek Vasut DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mailbox.org; s=mail20150812; t=1677527713; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=kYGr1wOXcD3FzBG8IQ3KicLmP5Lx1JwjtlqIYlFYnec=; b=qupBvmqfsMwpFN/cjFUVEZHVWm4L3Um5igpKloQ/ScWNFSH8DTXddjsMxdBfpl7WCFe3df TKeeXZGOM6c+A0Bx4+liBEqhSIUgy2gu7++DVd4stkVSftDO8hBp5pEs598xD27eqE08wp FyxWzaERl+eKB2slQSuRBbbkPxMqPJG3UfOApj8IkiDltSA0a8IJks8w6oinCBRhAr5OxX AXulxmsHmu2u3QRHYzFFIbttm2Hi/uaU1fIqQxhcGwyWYZEtKZPqFWmMf7gJFprfAOMYbw YK1adKKqvkBOuknlIeaHfvCrZ5hGi0nKG0xyZEIXYIWJNVr3/DN+Mgu/Zmwffw== To: u-boot@lists.denx.de Cc: Marek Vasut , Heinrich Schuchardt , Simon Glass , Tom Rini Subject: [PATCH 18/32] test: cmd: fdt: Test fdt resize Date: Mon, 27 Feb 2023 20:53:43 +0100 Message-Id: <20230227195357.98723-18-marek.vasut+renesas@mailbox.org> In-Reply-To: <20230227195357.98723-1-marek.vasut+renesas@mailbox.org> References: <20230227195357.98723-1-marek.vasut+renesas@mailbox.org> MIME-Version: 1.0 X-MBO-RS-META: t3ia7tiouktztw7qcxcxuew55163a6j9 X-MBO-RS-ID: baf131ff0eb94467ad8 X-Rspamd-Queue-Id: 4PQWSN0Gp4z9scb X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.6 at phobos.denx.de X-Virus-Status: Clean Add 'fdt resize' test which works as follows: - Create simple FDT with extra size 0, map it to sysmem - 'resize' the FDT by 0x2000 bytes - Verify the new space has been added to the FDT The test case can be triggered using: " ./u-boot -Dc 'ut fdt' " To dump the full output from commands used during test, add '-v' flag. Signed-off-by: Marek Vasut Reviewed-by: Simon Glass --- Cc: Heinrich Schuchardt Cc: Simon Glass Cc: Tom Rini --- test/cmd/fdt.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/test/cmd/fdt.c b/test/cmd/fdt.c index 023b83eb019..266fb6e3ed0 100644 --- a/test/cmd/fdt.c +++ b/test/cmd/fdt.c @@ -272,6 +272,30 @@ static int fdt_test_move(struct unit_test_state *uts) } FDT_TEST(fdt_test_move, UT_TESTF_CONSOLE_REC); +static int fdt_test_resize(struct unit_test_state *uts) +{ + char fdt[256]; + const unsigned int newsize = 0x2000; + uint32_t ts; + ulong addr; + + /* Original source DT */ + ut_assertok(make_test_fdt(uts, fdt, sizeof(fdt))); + fdt_shrink_to_minimum(fdt, 0); /* Resize with 0 extra bytes */ + ts = fdt_totalsize(fdt); + addr = map_to_sysmem(fdt); + set_working_fdt_addr(addr); + + /* Test resizing the working FDT and verify the new space was added */ + ut_assertok(console_record_reset_enable()); + ut_assertok(run_commandf("fdt resize %x", newsize)); + ut_asserteq(ts + newsize, fdt_totalsize(fdt)); + ut_assertok(ut_check_console_end(uts)); + + return 0; +} +FDT_TEST(fdt_test_resize, UT_TESTF_CONSOLE_REC); + /* Test 'fdt get value' reading an fdt */ static int fdt_test_get_value_string(struct unit_test_state *uts, const char *node, const char *prop,