From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id CCC23C433F5 for ; Fri, 31 Dec 2021 16:18:31 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id F22CB8375B; Fri, 31 Dec 2021 17:16:29 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=amarulasolutions.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=amarulasolutions.com header.i=@amarulasolutions.com header.b="R1Xshy+W"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id D1FA283759; Fri, 31 Dec 2021 17:16:21 +0100 (CET) Received: from mail-wm1-x329.google.com (mail-wm1-x329.google.com [IPv6:2a00:1450:4864:20::329]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id A557283592 for ; Fri, 31 Dec 2021 17:14:13 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=amarulasolutions.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=francis.laniel@amarulasolutions.com Received: by mail-wm1-x329.google.com with SMTP id b73so17576061wmd.0 for ; Fri, 31 Dec 2021 08:14:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=kasyDdPtKrnnuTOWkk+L0ycvzb5X01epMlPbpzuuXWM=; b=R1Xshy+WQfr7KwB0OIYGoHHgdyJk8Bxu3u0/c22XkaLGNgROYqRDNJQKnkOSgkgm60 t59YW4bNW5BgstpoiGZPhkTvyp3ImQXgRrOavu+wwOsL4D2ycpj5AbHtGF8qJTOSKylR zJfo3M5W4tuHj6QlWPAhwyQu6CzCOSfSlKxfA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=kasyDdPtKrnnuTOWkk+L0ycvzb5X01epMlPbpzuuXWM=; b=uC5LWYlXs4c0dXvKI35VzrpGg4zcu75bWqha8LBX6VGnovSdBzpM2sTO3Hm36dmtzH nliLK0JuRN3/pniD9pVQ7BmXLERygJ12bqqGrNQUAfoauOeImJmhP5heMX4ZD4YA+b8B h7oJ2JraOUJUEQTOer9CiOmMc+ISS4i9RiwNCY6wF0e/t8mhqhij+ZEcwfFJvsvIWyUP GmSP2tA1bKPsiI4Cpq6zWaV7P4L+CUf0cnqlltQBzn6T4fNJnuFXu1TfJp+qH7kFXDE1 w7ntyjHWDtVWeiafTpJzdeOuUVuuzZk3iuS2U4u/gfxO0c0jhStq+juqi+vvlPiVl7vy GBhg== X-Gm-Message-State: AOAM532mZxO+XhAyQ5CZAA6w1KSa6UuMzbFe4P8IczfLRodbHRTVyh/C 7bBwczUH9YVbXLKUZwuswre8dRNPHvMSVg== X-Google-Smtp-Source: ABdhPJxxtJdt50K6Oohqw6OFYzKrBlRzmVaeVeJsfYrYRWnf7xdSdZTj67MyfFBbeNjQ7yy/ZkUq9A== X-Received: by 2002:a05:600c:3ca1:: with SMTP id bg33mr30451228wmb.80.1640967253222; Fri, 31 Dec 2021 08:14:13 -0800 (PST) Received: from pwmachine.home ([2a01:cb14:983:1f00:eef7:8bf8:8ee0:cb1a]) by smtp.gmail.com with ESMTPSA id f6sm31855522wmq.6.2021.12.31.08.14.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 31 Dec 2021 08:14:12 -0800 (PST) From: Francis Laniel To: u-boot@lists.denx.de Cc: Marek Behun , Michael Nazzareno Trimarchi , Simon Glass , Wolfgang Denk , Harald Seiler , Francis Laniel Subject: [RFC PATCH v1 15/21] test: hush: Fix instructions list tests for hush 2021. Date: Fri, 31 Dec 2021 17:13:21 +0100 Message-Id: <20211231161327.24918-16-francis.laniel@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211231161327.24918-1-francis.laniel@amarulasolutions.com> References: <20211231161327.24918-1-francis.laniel@amarulasolutions.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.38 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.2 at phobos.denx.de X-Virus-Status: Clean This commit modifies the expected result for hush 2021. Indeed, there were bugs in actual U-Boot hush which were fixed in upstream Busybox. As hush 2021 is based on upstream Busybox, these bugs no longer exist. Signed-off-by: Francis Laniel --- test/hush/list.c | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/test/hush/list.c b/test/hush/list.c index 052cf2783c..096bb4f034 100644 --- a/test/hush/list.c +++ b/test/hush/list.c @@ -50,8 +50,32 @@ static int hush_test_and_or(struct unit_test_state *uts) { /* A && B || C truth table. */ ut_asserteq(1, run_command("false && false || false", 0)); +#ifdef CONFIG_HUSH_OLD_PARSER ut_asserteq(1, run_command("false && false || true", 0)); +#elif defined(CONFIG_HUSH_2021_PARSER) + /* + * This difference seems to come from a bug solved in Busybox hush. + * + * Indeed, the following expression can be seen like this: + * (false && false) || true + * So, (false && false) returns 1, the second false is not executed, and + * true is executed because of ||. + */ + ut_assertok(run_command("false && false || true", 0)); +#endif /* CONFIG_HUSH_2021_PARSER */ +#ifdef CONFIG_HUSH_OLD_PARSER ut_asserteq(1, run_command("false && true || true", 0)); +#elif defined(CONFIG_HUSH_2021_PARSER) + /* + * This difference seems to come from a bug solved in Busybox hush. + * + * Indeed, the following expression can be seen like this: + * (false && true) || true + * So, (false && true) returns 1, the true is not executed, and true is + * executed because of ||. + */ + ut_assertok(run_command("false && true || true", 0)); +#endif /* CONFIG_HUSH_2021_PARSER */ ut_asserteq(1, run_command("false && true || false", 0)); ut_assertok(run_command("true && true || false", 0)); ut_asserteq(1, run_command("true && false || false", 0)); @@ -69,8 +93,32 @@ static int hush_test_or_and(struct unit_test_state *uts) ut_asserteq(1, run_command("false || false && true", 0)); ut_assertok(run_command("false || true && true", 0)); ut_asserteq(1, run_command("false || true && false", 0)); +#ifdef CONFIG_HUSH_OLD_PARSER ut_assertok(run_command("true || true && false", 0)); +#elif defined(CONFIG_HUSH_2021_PARSER) + /* + * This difference seems to come from a bug solved in Busybox hush. + * + * Indeed, the following expression can be seen like this: + * (true || true) && false + * So, (true || true) returns 0, the second true is not executed, and + * then false is executed because of &&. + */ + ut_asserteq(1, run_command("true || true && false", 0)); +#endif /* CONFIG_HUSH_2021_PARSER */ +#ifdef CONFIG_HUSH_OLD_PARSER ut_assertok(run_command("true || false && false", 0)); +#elif defined(CONFIG_HUSH_2021_PARSER) + /* + * This difference seems to come from a bug solved in Busybox hush. + * + * Indeed, the following expression can be seen like this: + * (true || false) && false + * So, (true || false) returns 0, the false is not executed, and then + * false is executed because of &&. + */ + ut_asserteq(1, run_command("true || false && false", 0)); +#endif /* CONFIG_HUSH_2021_PARSER */ ut_assertok(run_command("true || false && true", 0)); ut_assertok(run_command("true || true && true", 0)); -- 2.25.1