From patchwork Mon Apr 3 13:50:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Stefan Herbrechtsmeier X-Patchwork-Id: 1764448 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=PIm4tdMw; 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 4PqsjZ341Yz1yZT for ; Mon, 3 Apr 2023 23:50:40 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 5F84685C98; Mon, 3 Apr 2023 15:50:25 +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="PIm4tdMw"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id B21C385E8E; Mon, 3 Apr 2023 15:50:22 +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 EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on20628.outbound.protection.outlook.com [IPv6:2a01:111:f400:7d00::628]) (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 439E4859D6 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=ZJ8EXR/AdzpqTZ62p2umcLTzFtRFRFUsqdNClouISH16QB6CmxkI/PjQrXlrailI2UcAs0eMCTw1g4KPkdvb4qRcNr+TVR4r9pOnZMTULu9CbYOBG4WD2By3kl7R/bpKNs+EWsby7oebvS3hKqGJV4qH98GiLOcv1uJNLyi4e62Yw0q381TfdAQdd5U7mUzGSnvdn/AollNLFAwbXYaLuJfDyPI6FgPsfA5MWRZ2WVaLvAr/ZsobCJ3i8aOEsETUwSi+CDuluUh4NZ9lTUGPHg5M7r/EjmClGjOo5BI1RmHaiwfTyuTZhr9JTtTKlIE6FsnfqYLMRJpzIpsmlLDeyw== 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=6jhlGfopvLVMDMfaFwJ52Lt6LX9oNFGrWpOs6mxXWFU=; b=DEOqPbcTGtFr5IqryV/uksYMZ1nfP3BaiC4dkJ2is4hb0/JLpIxFWXR4eRdDVQTWIUfdp7gWYZDhXg+FZ73Vrud4tfiWBTTDsZSXmxDxVSRQ5ZU4C+EiqVmY/PrHNsu1w0RcEe9BnfShXT5kUnRUVCUm8lzgpJdcFlAALCU7T3idR4MXMJkizo1JGXUrhQZFwkn3qKIl90twl7jla3QcDMjdEs5Ygqej3V3iCBDtv/PqSdrqOOwyMojbEFjQtBKebQg7xddsLsYueuqrXKKCQXfEVnIT3BOe09Lz2KrVbjuBNavsIZvgcGeVJBVEGLRQEoeXa7piI3GMjfNUm2Wt8w== 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=6jhlGfopvLVMDMfaFwJ52Lt6LX9oNFGrWpOs6mxXWFU=; b=PIm4tdMwuIdLfnEDTtKvBvitZYlHkIlK5rJ4dp0+7zYJmVRRK9QGKxjWzrddij7pdou1tpksM1tRDUCkD3Lhwnlcisc4IPY2rGPWKUt/k4X+9AfmYGKI2zWkZ1Zh3EpqaWQcV60n0HD0og0LzTrJYr7rkexUy3ALSHldUctSp48= 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 DU2PR08MB10159.eurprd08.prod.outlook.com (2603:10a6:10:46f::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6254.33; Mon, 3 Apr 2023 13:50:17 +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:17 +0000 From: Stefan Herbrechtsmeier To: u-boot@lists.denx.de, Simon Glass Cc: Stefan Herbrechtsmeier , Hector Palacios , Marek Vasut Subject: [PATCH v2 1/2] common: cli_hush: Restore clear local variable support Date: Mon, 3 Apr 2023 15:50:00 +0200 Message-Id: <20230403135001.14573-1-stefan.herbrechtsmeier-oss@weidmueller.com> X-Mailer: git-send-email 2.30.2 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_|DU2PR08MB10159:EE_ X-MS-Office365-Filtering-Correlation-Id: 1351d4d2-89d6-4d2b-8ac3-08db344a5b9b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: p66R3WK3MXR5o6W93wbIa7WEXoWGn7WrSAUwAnf5uGD8dguiH5BDqWF+16WYNz8ODDcaNrAiHPO9/8LU5wXTFI2pTvnL1g/CY2kJf1CH9a4A8AdahVDzlm11BoxoRdi4ePKwEOax4l90jiBadvxHOrRASMNtL20HRVOhd9KZnhAAKeCmMGZSyJ+0FhBoMW8Bm8BbUwsHIXI15K+cfW9jLDTikBka/v4wzwmAVibnoAXWtHn7SVV0zd+dG4yKO6Sgn87oReDmCGxfttGIH6ztVbZvaNCCtpQHin2m8+njWQ1hUj5gCpOlc0RDGz676J7qppI75xSJ4S3dZ8UlBMq032phtxW83E5C1EVXLK4FNTiIQw0WEBNuP7mxOWzXtfJm+ls1rt5JIKkyFim3juiDsOIvGQ6ssEiLV5/f8x7Q+Ro7zDFz+BNClbpQP02iI71hbDyRpOILALgOoVKD5ml0UorVwzXV3d7b33Znu0rZpMz7+JTQYVAXoa4PybMaKzKD4enpdIcX1kLyo4ChuIXGtAhpKs4Yril4Ca3z+tRkRk1mZUHQNKeuJEOmi4ir+oDdStHO3WDrOC0uHZZoD3y0od5Kb797GNpfj+PRtK8zXqtrpvsTzVdiIY6SHZdTK9s3 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)(136003)(366004)(346002)(39860400002)(376002)(451199021)(5660300002)(86362001)(2616005)(186003)(83380400001)(66574015)(1076003)(6506007)(6512007)(26005)(38350700002)(38100700002)(8936002)(478600001)(54906003)(6486002)(52116002)(4326008)(41300700001)(36756003)(6916009)(66556008)(66476007)(66946007)(8676002)(316002)(6666004)(2906002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?SocF7Yto3vTuSt5CoJwr+Qg2fA6t?= =?utf-8?q?qu3P4yBoVUUhCWQKpM0eqb1Fie8AWCeqNIEoguOdiwkML3MLuuAdQ+pXtOJYJOUxW?= =?utf-8?q?d87VUHqamZKavX25F228RcEliLwi+3DE/rEh27j53tKYFG3slpnSmsndUozfGqmog?= =?utf-8?q?lTL8VDvsDH4uOPUBm4x3QB9CzSOZErNsJAy29EH+xcPQzeLlkV4PM1RLP6h/FeLoE?= =?utf-8?q?IRDhgV/QP+L0S/G+wu2xTx0CingjyB/ocjt5mcPtb/y2+WUC6re7hpqdB26nylUff?= =?utf-8?q?ZiT41b+Ae0zuSLpq40Jf3f7fqM2AzderEd4OyvKnWkjK5IC9vGiK8Opee4rrw9Ocd?= =?utf-8?q?bSYXCLGvR5HGpkXeVoQSk+WUGvJplBBfDHCEd/eVDusseQPcQEOOzQOQTtOaaf3Fr?= =?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dSdOg?= =?utf-8?q?Ryownul2I6NQz3oH+ifq5aDq1NJOtGepbhrFpiQqfcfXUCYqoXt6HEzhf5y5c7p2c?= =?utf-8?q?pJOQm6PGBsOC9rlQAyI7QuLeWwTwiZvq02Yk7IYqyNQA7RozJVEAYaR+TCBVQdBxH?= =?utf-8?q?CFBn8WiaP57LoX8WPzDE2k5+lZA6RVwVKfv0cFEBhUj4vPf9hllnxARQP7BTTLMEW?= =?utf-8?q?qpVqBjN0Ti+WgHtLEUwPxuqYwlH7LmOV+oxhgFatDEHyRXOklWTVI3XfvSaiRkZK4?= =?utf-8?q?6ebCITtYiLX0koQk4Gz8h8WGKhfoudE3QQ=3D=3D?= X-OriginatorOrg: weidmueller.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1351d4d2-89d6-4d2b-8ac3-08db344a5b9b 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:17.3969 (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: r5NRKmnI+YzxbFEzTevOYom/irV9r7Te8clcF9LyOcxRbt/NG+6fAs1ohZxGGSXcj+erc9ENADQMhurNCltkig== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU2PR08MB10159 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 The u-boot hush shell doesn’t support the unset command to clear a variable and therefore an empty value ("c=") should be a valid value for the set_local_var function to clear the variable. This partial reverts commit aa722529635c ("common: cli_hush: avoid dead code") and only checks for a `=` in the string. Additionally explicit call the unset_local_var function to remove the variable if the value is empty. Signed-off-by: Stefan Herbrechtsmeier Reviewed-by: Simon Glass --- Changes in v2: - Use `!var` instead of `var == NULL` common/cli_hush.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) -- 2.30.2 diff --git a/common/cli_hush.c b/common/cli_hush.c index 1ad7a509df..171069f5f4 100644 --- a/common/cli_hush.c +++ b/common/cli_hush.c @@ -2171,12 +2171,18 @@ int set_local_var(const char *s, int flg_export) * NAME=VALUE format. So the first order of business is to * split 's' on the '=' into 'name' and 'value' */ value = strchr(name, '='); - if (value == NULL || *(value + 1) == 0) { + if (!value) { free(name); return -1; } *value++ = 0; + if (!*value) { + unset_local_var(name); + free(name); + return 0; + } + for(cur = top_vars; cur; cur = cur->next) { if(strcmp(cur->name, name)==0) break; 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-AntiS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okUvn+vA2MZH+0He5+DywxnNEfXfZV+AUogUVBZaFO1uZO2IohSXafaeF40NWxWIEngGPSfCWJA5w6z6R/Ume+p1THCpHM+I8zjnYruGuMdUdEv9cc63r8EcWQadDmdLQIUSqlm04u63PDtLij4OXVwULSxzBN//hKimqBTYC6sj0O34jJyhiPhW4gJPPqwF5klaETqxSIHxyeHtIz1E5yBIhSZG1wNry1ygCQurh2JMs9j6taSrE70l/AKDEc92voEviAR+SGLiA4Gn4lBb0ZTKJIsywePcOtqtUieGfGW14zci7+XeZ2cHFkCN03i+dfwkuCMn8ogiA6P8qE6WvIqMz7A8N/big23WTUrjASg4GZVCR+jeIoKgyIBX9PJbat0ktLXtYX2jJCUEurDbVEGCfEH5POVbWRnB2nFBarjHPH2UuXXm2XrlH9I+1lnXJr2B11V9tmMpoF0mf3FggkmHQiXkiU3+DaE48scaUtMm3U7+F26NZdGTBBinqm6vDvs950mR0cPLLOEO/iYlCJNHbmnICa+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=')