From patchwork Mon Dec 12 19:12:08 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 1715127 X-Patchwork-Delegate: trini@ti.com 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; unprotected) header.d=seco.com header.i=@seco.com header.a=rsa-sha256 header.s=selector1 header.b=geLb0zT5; 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 4NWBBH6yV2z23np for ; Tue, 13 Dec 2022 06:13:59 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id DE5B08545D; Mon, 12 Dec 2022 20:13:30 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=reject dis=none) header.from=seco.com 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; unprotected) header.d=seco.com header.i=@seco.com header.b="geLb0zT5"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 351F285449; Mon, 12 Dec 2022 20:13:23 +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,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS, SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2060.outbound.protection.outlook.com [40.107.20.60]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 8ACF684387 for ; Mon, 12 Dec 2022 20:13:20 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=reject dis=none) header.from=seco.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sean.anderson@seco.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cgGWZURTLWLKoC0NcxAbfjTkqv8U67E7s9P3dzxEnO4mn70ygYHutyW6NRoopsSNx6nZ7gj912zgIJ27EpGgx/knV7Uuc+0Bn0c59ecJow2aQ2Kh7wSlAWioseKf+4jvCIfKDzGBQZEM48YHDWSEx7OfzWgqIL91ANyx/vOT6XeXkbPpkyYVunPCiJJYiTQpcS5a99MuEwfSQG4WQ3adiR/K9eCq+7S/gb8lk6AUcEY1IE2PupmnENE8CgcpOCv1rvRxlQfq2zEAXfMrRh8sbAFdM8thcAl6x5L4GxZyle5Hiq+pYgMvJIzdVIBuXV/55hcfKuI9reDEI/nVFgdeYg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=gyQi72Pt5XQ0VLA8tYA8enNgVy8XpZdUfoBzBMrOIgA=; b=gFyrrckqWxFc3LoxkEInbG2v2GvR78EPCWS88b3jO2Pu1FHLy1mm7gC/p9b7tMr0vasZ6bS0UePdzcqRbtmIKHtPalUbqsJJ5IihuA4eomQ2/42OuHJVmkb83p8JdqfYvLFfwidcU5wfrqViYgyT6HgX5Ue4UJVcFKiPBT7Ku24otqC6Sp8JFpwk+pm9enMbKYT05AhPSGjjE13TxDqwGL0bVhcvy3B+VB6iaKJey17vtBvuhkOb9mTylsVifY1YZ71JR5UCz8JNke16hQFaxLeFFHFVRXbIfv51n+JK23+UjvtcV8cPJEuhsw/Qc8pBqMNBr/NCYLowV12M42wg5Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=seco.com; dmarc=pass action=none header.from=seco.com; dkim=pass header.d=seco.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=seco.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=gyQi72Pt5XQ0VLA8tYA8enNgVy8XpZdUfoBzBMrOIgA=; b=geLb0zT5AU1V3h4FTnek6/dgbL12pKwvcGE8BN/w64QTvW2i1gGYJGGbVTRtRXKypOi5f90CkZoCyUgwYeJEQmgWdshknl/KS6qnc4A/0cl3+qcD+ZVZCsE3T/HNHwQCjI1qdMQJju2Jf4u3hcoDmB2HCXhyb01Cucu9MkrB9MEz83CXMsV6+WJbuUGfSWBEq/jL9gSqx7PC/s9Ofi02n7X6dopTIOzS4mgskhW9/AYf37I01cQwn1mUZOlb4m43CZu3222Czgz21SbBNvlUDiQMnMsSmyhnDx5ppFnjcYQewFupDTU5/aODUaMbdeML5eIlcnhJ1PP4oJKxiyfb1w== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=seco.com; Received: from DB9PR03MB8847.eurprd03.prod.outlook.com (2603:10a6:10:3dd::13) by AM9PR03MB7980.eurprd03.prod.outlook.com (2603:10a6:20b:43d::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5880.10; Mon, 12 Dec 2022 19:13:19 +0000 Received: from DB9PR03MB8847.eurprd03.prod.outlook.com ([fe80::2b95:1fe4:5d8f:22fb]) by DB9PR03MB8847.eurprd03.prod.outlook.com ([fe80::2b95:1fe4:5d8f:22fb%7]) with mapi id 15.20.5880.019; Mon, 12 Dec 2022 19:13:19 +0000 From: Sean Anderson To: u-boot@lists.denx.de, Tom Rini Cc: Rasmus Villemoes , Simon Glass , Sean Anderson Subject: [PATCH v4 2/5] test: Add test for source command Date: Mon, 12 Dec 2022 14:12:08 -0500 Message-Id: <20221212191211.2105335-3-sean.anderson@seco.com> X-Mailer: git-send-email 2.35.1.1320.gc452695387.dirty In-Reply-To: <20221212191211.2105335-1-sean.anderson@seco.com> References: <20221212191211.2105335-1-sean.anderson@seco.com> X-ClientProxiedBy: MN2PR20CA0046.namprd20.prod.outlook.com (2603:10b6:208:235::15) To DB9PR03MB8847.eurprd03.prod.outlook.com (2603:10a6:10:3dd::13) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DB9PR03MB8847:EE_|AM9PR03MB7980:EE_ X-MS-Office365-Filtering-Correlation-Id: 7a80e480-79e5-4d93-0c32-08dadc74edf7 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: aHY2u1SXR1ADcPzpsI6oVf3h07LtMYaO9eOYssIpec0xdgpth+oLCIp9kp/vjwqD47dLNDFeylrCpLx1gk1XCwk/IA0Ri7uBoxBXmG1ZUEF6PtYFJw7RqbS9FeGYd0u0WzYsxTExTNRq6BLFjj+FoHhCMtqYwD6UVMFmbjGAge8MCLDOYNVNfxKdWnmvdgxB7bVY0b5EYGk99kH+a71DKBqaaqk50OZ0bqJ4kiDi0vjpXgNfcAjqVOe+kbDtPYxdm8XfZAaAswarYIsxpybqk4xte4Paks1MhFAHVC5RURDW7kxEPi4XZXPWBHhlms1RFVfpUuEdYfqMvuwuNdhoZv+7hLmhrpd5jgFdDa14Lp5ZXWtBAJHgYDbpu9VRwqeWTreeCnTr8DrS/+n/OHzTCfsupOsl81eicFkADEYmzZasYbQxZH2ys8iSM+CXPUbLSrHaw7ty2Zshej5C+45Dm4yIUWen9E6QuyRvdm4uFcqIZ7JHKt+psWPxJLCOuq5lPSNkwhrtyIqn1lhM9o9Vxq+t92qhy0vCzo8ntJoC+5GD7qlUaLcpLVClhmHQbDjDFRnTtQtpUi8h7eLSFLhFeQm6m9jPFczbGurewHlWZajh9ZLcBHxPZSeD1KPGsK9Ua7gh0WCEBWL7mDkp8V/0WhDv3+iLP1dSp6coKn8EM+65yPDfPa/zfgNPoaaNF4N2CwN2Ue15yNx5R+cq6UjNOg== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DB9PR03MB8847.eurprd03.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(346002)(136003)(366004)(396003)(376002)(39850400004)(451199015)(66556008)(36756003)(41300700001)(52116002)(66476007)(8676002)(66946007)(4326008)(6916009)(5660300002)(54906003)(316002)(8936002)(86362001)(38350700002)(38100700002)(107886003)(6666004)(6486002)(478600001)(186003)(1076003)(6506007)(26005)(2616005)(6512007)(44832011)(2906002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: PxG8vy7pyBYNGkN5gq0OQXF2A5/aOkwJPsf2XF42zVziSfQ45CLQ8nTNayfjgZUdquXcXD3B2OHA1VT9HEDrZXKyfBasOiInFLI1HuyASfMqNxBQshUCP00qNSE4l6A6fuD12vB0uUjqoEkJ+m+7nutR0BlINoj+K3z/cme2b1TH4G38prIdBhWbgPTNLjetU6e9uSLVprtPFNHRRnNNRsCpX1g8Ews4KeujUbliV4zWy7GE4pWqi1FQyKAMZ9gDCoATUiMR5sNBAfoUUunNi7I5a1AGf8VjsyVcVQd+PXLzNEEYX3asOO/RPV77SfiF4B7SxkleVQpJ76LG0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Vqdd7dR3ZWtWSFSeh9Pm55n8pPNJSb6Ap9wCpm007DesyzR4Nnh/w8S2pqN8AR45iWR9ivndgH35LCXaisk8fzWsPw2R5ttOGVOTPBnupzS/o2HssHtR7BO65ls1VZPgeWLXomI3p/7uvtOMEj5VIbniHxmT7TEW+n1V8KrLl2S25glAZbHD/WJt1++Snq0L4lQGYx4XPYzR5Tg== X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7a80e480-79e5-4d93-0c32-08dadc74edf7 X-MS-Exchange-CrossTenant-AuthSource: DB9PR03MB8847.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Dec 2022 19:13:19.4459 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: bebe97c3-6438-442e-ade3-ff17aa50e733 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: +/4SQvfdl1zUXVqRu7OO8cgmrPUhqWKwM610sAuyXVp3+A8UmGDbBUuG6XoyE9Gr6Ucv2mnY3DX35R55j7WV3g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR03MB7980 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 This adds a basic test for FIT image handling by the source command. It's a python test becase we need to run mkimage. Signed-off-by: Sean Anderson Reviewed-by: Simon Glass --- (no changes since v3) Changes in v3: - Halve the quotes Changes in v2: - New test/py/tests/source.its | 43 ++++++++++++++++++++++++++++++++++++ test/py/tests/test_source.py | 28 +++++++++++++++++++++++ 2 files changed, 71 insertions(+) create mode 100644 test/py/tests/source.its create mode 100644 test/py/tests/test_source.py diff --git a/test/py/tests/source.its b/test/py/tests/source.its new file mode 100644 index 0000000000..3c62f777f1 --- /dev/null +++ b/test/py/tests/source.its @@ -0,0 +1,43 @@ +/dts-v1/; + +/ { + description = "FIT image to test the source command"; + #address-cells = <1>; + + images { + default = "script-1"; + + script-1 { + data = "echo 1"; + type = "script"; + arch = "sandbox"; + compression = "none"; + }; + + script-2 { + data = "echo 2"; + type = "script"; + arch = "sandbox"; + compression = "none"; + }; + + not-a-script { + data = "echo 3"; + type = "kernel"; + arch = "sandbox"; + compression = "none"; + }; + }; + + configurations { + default = "conf-2"; + + conf-1 { + script = "script-1"; + }; + + conf-2 { + script = "script-2"; + }; + }; +}; diff --git a/test/py/tests/test_source.py b/test/py/tests/test_source.py new file mode 100644 index 0000000000..e5ffdfe3fc --- /dev/null +++ b/test/py/tests/test_source.py @@ -0,0 +1,28 @@ +# SPDX-License-Identifier: GPL-2.0+ +# Copyright (C) 2022 Sean Anderson + +import os +import pytest +import u_boot_utils as util + +@pytest.mark.boardspec('sandbox') +@pytest.mark.buildconfigspec('cmd_echo') +@pytest.mark.buildconfigspec('cmd_source') +@pytest.mark.buildconfigspec('fit') +def test_source(u_boot_console): + # Compile our test script image + cons = u_boot_console + mkimage = os.path.join(cons.config.build_dir, 'tools/mkimage') + its = os.path.join(cons.config.source_dir, 'test/py/tests/source.its') + fit = os.path.join(cons.config.build_dir, 'source.itb') + util.run_and_log(cons, (mkimage, '-f', its, fit)) + cons.run_command(f'host load hostfs - $loadaddr {fit}') + + assert '1' in cons.run_command('source') + assert '1' in cons.run_command('source :script-1') + assert '2' in cons.run_command('source :script-2') + assert 'Fail' in cons.run_command('source :not-a-script || echo Fail') + + cons.run_command('fdt addr $loadaddr') + cons.run_command('fdt rm /images default') + assert 'Fail' in cons.run_command('source || echo Fail')