From patchwork Mon Apr 3 13:50:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Herbrechtsmeier X-Patchwork-Id: 1764449 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 (1024-bit key; unprotected) header.d=weidmueller.onmicrosoft.com header.i=@weidmueller.onmicrosoft.com header.a=rsa-sha256 header.s=selector1-weidmueller-onmicrosoft-com header.b=TosssKxR; 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 4Pqsjh5YWFz1yZT for ; Mon, 3 Apr 2023 23:50:48 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id D17A085E36; Mon, 3 Apr 2023 15:50:32 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=weidmueller.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=weidmueller.onmicrosoft.com header.i=@weidmueller.onmicrosoft.com header.b="TosssKxR"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 82A8C85E36; Mon, 3 Apr 2023 15:50:26 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,FORGED_SPF_HELO,SPF_HELO_PASS,T_SPF_PERMERROR autolearn=ham autolearn_force=no version=3.4.2 Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-vi1eur04on0620.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe0e::620]) (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 C81F385E36 for ; Mon, 3 Apr 2023 15:50:19 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=weidmueller.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=stefan.herbrechtsmeier-oss@weidmueller.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=We3CPa4WzUbgbDcSWTEfzfzqrPts0SDLM/pOYSGU770j8X6w+zgL2tbVcg9FNhTPyGUBk1frGooeQNKBHMERmukQn6kwV8Iyz0vSO5OTtQQPqHragfNhPPmZphWnvBO3id1y2W7UGnfBqSDeYkqCE20xb75jm3C1aFA42x2lhEZl8aCGpBqdrQBREJgDS/K/LyC4smzmjoPoq9VEfajjbllHvOco0c9fubQK5epaVQRuArwnVcBFZGWvFYa/8Gemidy+deMpkVyHOYexWn8ypqKoaPpvXlQJmDsLCisfo0elqghLtph5aZdn6vVzdEMOC2DlVGk2z5sSPcTk1TbT2g== 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=4uiwu+RoeUglmt9V63dAKa2TaKdlwp1NNpnrZcn8IJU=; b=iI46AA7lIqFchE8vOIuprrKp/NBsOCQyK6+gZNzEeXBSJ0Pn8fbunpFvzknRprHE7m6/5hXelwdEA2vIswts1wHFzjM3i8/gpputAKabXDnXCmH9U/S9kRtFU0+YbLI+4RDEOL+QdEnCMRNVmxcw6yv+7u+LoegVDjDFfP/E0uL8bIW5sAOSEDKKInIwpAiQBX3Z7RS3PU4ejiWOrYVYt6BMRUEka0c4Q3it02oWB6OX4gmhN3YQ/CuFOYXzIJ52TMKWME1GIZkLCRIKPme3TkUQgAj5VK0+8oaOKsFpA8D0IL47xvYcNjA7MzA12zh1khOUyWcVP2eoMU0JODZC9w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=weidmueller.com; dmarc=pass action=none header.from=weidmueller.com; dkim=pass header.d=weidmueller.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=weidmueller.onmicrosoft.com; s=selector1-weidmueller-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=4uiwu+RoeUglmt9V63dAKa2TaKdlwp1NNpnrZcn8IJU=; b=TosssKxR6q7upiAwxJOVKKRBsqeLYGeZsV33GHNA7gXXDaD4BR+Gj/Hg3Ii+7aEtbJE+7S8jZzRaksTn7hLbS56ar30n7h04cnYc+KuXijH6DGtQpgKXYRPH98Vl9DdGJ5obsXRnOVe5rx66L+tNFoN4VP9RPBA3OHuc6E8BT3w= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=weidmueller.com; Received: from PAXPR08MB6969.eurprd08.prod.outlook.com (2603:10a6:102:1d8::23) by AS2PR08MB9690.eurprd08.prod.outlook.com (2603:10a6:20b:606::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6254.30; Mon, 3 Apr 2023 13:50:18 +0000 Received: from PAXPR08MB6969.eurprd08.prod.outlook.com ([fe80::7789:9e19:9554:4717]) by PAXPR08MB6969.eurprd08.prod.outlook.com ([fe80::7789:9e19:9554:4717%2]) with mapi id 15.20.6254.033; Mon, 3 Apr 2023 13:50:18 +0000 From: Stefan Herbrechtsmeier To: u-boot@lists.denx.de, Simon Glass Cc: Stefan Herbrechtsmeier Subject: [PATCH v2 2/2] test: hush_if_test: Add hush variable test Date: Mon, 3 Apr 2023 15:50:01 +0200 Message-Id: <20230403135001.14573-2-stefan.herbrechtsmeier-oss@weidmueller.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230403135001.14573-1-stefan.herbrechtsmeier-oss@weidmueller.com> References: <20230403135001.14573-1-stefan.herbrechtsmeier-oss@weidmueller.com> X-ClientProxiedBy: FR3P281CA0175.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:a0::12) To PAXPR08MB6969.eurprd08.prod.outlook.com (2603:10a6:102:1d8::23) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR08MB6969:EE_|AS2PR08MB9690:EE_ X-MS-Office365-Filtering-Correlation-Id: d7ca89de-1eea-4707-850c-08db344a5bf8 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ddS3X8RHrLotjI83ps7oMKns/YL+kemCGgH1njXXE/4+BHEDPiv1nCYf07J+sO26Ikg6PPzh/afC5iZOCsSUlqGy3Btp2y3lUCyk6oi2CB/Msxn4dmc/3VBCJP1nEUsECDFJPAmY586kA7KrXnzcySOPYNkcFNQv1Rcoa5p6TXXzdbNukhxcug3CU4IAmCmaSeVAk/PVf3PHx5G5kEZaWIA/rTj7/HEbKW8zcBC2gmQdkeWzVT98wfAHq7F4cjfpc+CryviwAgf0ggAmMf0yKTQwd6K1OyG7sRu+0U869ijBIcGrdcSauJpuzd2Kb/d+ZYvD2aicgLFpGtNfxGhflg9gQiX6UfM1zCqa7eM36uX58S+cpn7xebg9GOnVOTuD0WZUEGSC4Rkv+vuqHxYZWNw7yoldt88CoIZA4fVFYx309lswtYYD+qWtZqe3Eo5BR7dAP5Zjugb1FYs8y1yHHAGjkyxp/L8+cFMxE6uWJYvRMHjcTdyIOQ55Nafi/fB0F8hjKqJ7++XGFeb3lvVUM+JTj3vUq2lt5Ne2FNmZKrZ8NJ7VE9ZPkXNh62coLYVg7GHuz2waivwrx6RAfRuKsuFnv08G4CshenKtJXnPGnzPExe4eH+RnbvH0EXcWxne X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PAXPR08MB6969.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230028)(4636009)(396003)(366004)(346002)(136003)(39860400002)(376002)(451199021)(4326008)(6916009)(66946007)(66556008)(66476007)(478600001)(316002)(8936002)(5660300002)(8676002)(41300700001)(38100700002)(38350700002)(186003)(52116002)(2616005)(6486002)(107886003)(6666004)(1076003)(6506007)(26005)(6512007)(86362001)(36756003)(2906002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: QMhNltn/oUCg1QDyLMLWOyzPY2RS7L/QEeA41n7OAr6ppnDXusL2D6Reg1O63QiWDXjHqn5Vyare+KBJLw7dNRK5Uy2Y5HVIOS89W8uVX6HGtYxLxBhsZPRzKmzTZvmfaG0difN68AljqUsWdcxiJYyEzyYu8TXhYN7Iw3Td8k/ppm6wKivJ+HNFDfdvhY5N9BhS7lodPxUm9Tikgf7b4atl7TwAipUMyY+0/ntzYSFnwX+qufzzc/Q+JourNKqdccUDkkGxMs5hzVxTKoOx7tOnB8pj3UBKkZtgjCzUT8CBV8W6uncXnusD7kZnF+L00iRYrmAlDP4fpe/3URZhDiJ6QU/eyVejgLW5jo/6SNTNyXsQ+MdGmcEGzqAmSY8SQKLDsPED0MDCnn+MiR+CjCrDd41LlarJhRwaLPylh7w4ZuXSJXQSEcxCn3I76h564Li+pYlEZjl6vWIxxsj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NHbmnICa+2TPwT9Itd3V06vKZ8XdUwl+sOPrp/uYBRfM+r4yj/eLPHg== X-OriginatorOrg: weidmueller.com X-MS-Exchange-CrossTenant-Network-Message-Id: d7ca89de-1eea-4707-850c-08db344a5bf8 X-MS-Exchange-CrossTenant-AuthSource: PAXPR08MB6969.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Apr 2023 13:50:18.1183 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: e4289438-1c5f-4c95-a51a-ee553b8b18ec X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: kbJgtDFXVL4oWJDMJaTpIG56xJfhl9kbG1gDSpnT00G+WUIeYaxkFPkHqw2jORoijteehcE5hFM+Q9wCuBvqRA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS2PR08MB9690 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.8 at phobos.denx.de X-Virus-Status: Clean From: Stefan Herbrechtsmeier Add a test for the hush shell variable assignment and clear. Signed-off-by: Stefan Herbrechtsmeier Reviewed-by: Simon Glass --- (no changes since v1) test/py/tests/test_hush_if_test.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) -- 2.30.2 diff --git a/test/py/tests/test_hush_if_test.py b/test/py/tests/test_hush_if_test.py index 37c1608bb2..3b4b6fcaf4 100644 --- a/test/py/tests/test_hush_if_test.py +++ b/test/py/tests/test_hush_if_test.py @@ -182,3 +182,16 @@ def test_hush_if_test_host_file_exists(u_boot_console): expr = 'test -e hostfs - ' + test_file exec_hush_if(u_boot_console, expr, False) + +def test_hush_var(u_boot_console): + """Test the set and unset of variables""" + u_boot_console.run_command('ut_var_nonexistent=') + u_boot_console.run_command('ut_var_exists=1') + u_boot_console.run_command('ut_var_unset=1') + exec_hush_if(u_boot_console, 'test -z "$ut_var_nonexistent"', True) + exec_hush_if(u_boot_console, 'test -z "$ut_var_exists"', False) + exec_hush_if(u_boot_console, 'test -z "$ut_var_unset"', False) + exec_hush_if(u_boot_console, 'ut_var_unset=', True) + exec_hush_if(u_boot_console, 'test -z "$ut_var_unset"', True) + u_boot_console.run_command('ut_var_exists=') + u_boot_console.run_command('ut_var_unset=')