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 E9BF2C433F5 for ; Sun, 6 Feb 2022 18:40:33 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id D723683C0B; Sun, 6 Feb 2022 19:38:37 +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="TJt2+wau"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id BC05E83C04; Sun, 6 Feb 2022 19:38:32 +0100 (CET) Received: from mail-wm1-x32c.google.com (mail-wm1-x32c.google.com [IPv6:2a00:1450:4864:20::32c]) (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 3898783BCC for ; Sun, 6 Feb 2022 19:37:51 +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-x32c.google.com with SMTP id o1-20020a1c4d01000000b0034d95625e1fso13005428wmh.4 for ; Sun, 06 Feb 2022 10:37:51 -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=eRIggPMo/NnyUmTQR++eQapTa46HH1AjsdXLxtMvobA=; b=TJt2+wauf413dBQc7NIhC/r3Y0CuYCJx3qXeBsX5bP8/rfT4mGUvqIcjdeo5aUxcS7 msi5OAQu0mm3b44WC0UocYIFswckpP2K8brsZQ28OR6D3zuseQ43h4BNWZIbtuZQksOW 9whRV3gD8X18cIAhkXQtqxjEr1Y9SkKyO/lLQ= 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=eRIggPMo/NnyUmTQR++eQapTa46HH1AjsdXLxtMvobA=; b=1EZDGd1m+E4MG0mQBTogXzQv0Yt55kiUQPy3+O1clk+O3DNhveYwzH6z/nECWyJdRa 7otwUb+KRM82DcWquShD9Pf3cTo9pznen4GTLE6vhoo2glWmUFRTeboEMXugMjhjTgUY gW2flLfhDl3Xi6RVb0TRqn0JxfcnXFxKns+Hzz4On2G+Ce8U9IBchcBm5PPzhGO6PDar 0FtUnffJlB5PkQRiB1tVZ/rESlHck2yX30dhlcLvEY7VzYK945dwZm8MY3KGKspfkdsJ x/Ei/uRKjOLmCPxsp4fPgzHhrkwNt8qsR8Jt5xQzlE5KMyRyDu6UKfTQQ0gz/wE+wY3b YXqg== X-Gm-Message-State: AOAM530JUpO9upwaNRzeAZD0TNALcxhiFqgG17wv1tVdq4cTsqNkz3v2 vW/FK7meI16ygxwzUFvFWaGgXMGq9iCMgw== X-Google-Smtp-Source: ABdhPJwkUnnxTrCOcEj6OKIeKG05y8vv6fKsKfSaU3AqyDv2INLDh55RQYqUKMV8nfLhZB6LgJFNrA== X-Received: by 2002:a05:600c:5118:: with SMTP id o24mr8056349wms.153.1644172670851; Sun, 06 Feb 2022 10:37:50 -0800 (PST) Received: from pwmachine.home ([2a01:cb14:983:1f00:e5b3:218b:cb92:2549]) by smtp.gmail.com with ESMTPSA id ay29sm7095011wmb.38.2022.02.06.10.37.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 06 Feb 2022 10:37:50 -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 v2 15/21] test: hush: Fix instructions list tests for hush 2021 Date: Sun, 6 Feb 2022 19:37:11 +0100 Message-Id: <20220206183717.57446-16-francis.laniel@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220206183717.57446-1-francis.laniel@amarulasolutions.com> References: <20220206183717.57446-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.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.5 at phobos.denx.de X-Virus-Status: Clean 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 Reviewed-by: Simon Glass --- 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