From patchwork Tue Apr 20 08:42:25 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Neil Armstrong X-Patchwork-Id: 1468249 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=baylibre-com.20150623.gappssmtp.com header.i=@baylibre-com.20150623.gappssmtp.com header.a=rsa-sha256 header.s=20150623 header.b=PlqUPyTc; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4FPcdJ3jZDz9t1r for ; Tue, 20 Apr 2021 18:42:44 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 09335826BA; Tue, 20 Apr 2021 10:42:37 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=baylibre.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=baylibre-com.20150623.gappssmtp.com header.i=@baylibre-com.20150623.gappssmtp.com header.b="PlqUPyTc"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id E41C982AFD; Tue, 20 Apr 2021 10:42:33 +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,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-wr1-x432.google.com (mail-wr1-x432.google.com [IPv6:2a00:1450:4864:20::432]) (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 123E7826BA for ; Tue, 20 Apr 2021 10:42:30 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=narmstrong@baylibre.com Received: by mail-wr1-x432.google.com with SMTP id h4so27680417wrt.12 for ; Tue, 20 Apr 2021 01:42:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=C6oUf7PH+EmQ3ijUIbGsEc2XUbOVSlE2ziIFpUqpLcM=; b=PlqUPyTc/J8sj18rMMmI9Dtz+2VXu6Z671byp/j4o18pQtWmWKHq+fLRZ/ebnXWVGJ hndlgM5dvCbli3wilLhNS6etFMjoHx084/3360YFVxfju5D6P+kc/pKSFq2JwXCqy5lR zsEc545tV/F0EjA3+ggxEr9VwSa5nA2+xT7ioq7wmuv6FTwJAUSAi7n8KPG/aezshwUp FV8Fsdss2hQaFzdtRmBCoW0DzrIgBrYkwDZQ0q9RdrqxqkzjCOPYA426YwYdQczUS6PS 3PGPMhhaB6SSHB3Pt8rL62dfN7s3+2a6mniaIS5wd7nPQdnhPFa9tXL9P4K3KQLaFi47 YcAA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=C6oUf7PH+EmQ3ijUIbGsEc2XUbOVSlE2ziIFpUqpLcM=; b=Xrc0r6mJgUWmDYtbd2ABo3HfohAny35Pjw0dWse+QzznfL/zLaA3H2oPpksWyof0uG reGPLXzh/2D+jTJccKDCTeslU0Lbo+GoOZGd+DDGmcx0qI6Ue/anINHuWmG4hU2k7yXY SvxkIDyApWI1rt2dVKZLOp1cr9QO5TUg9Ga9Kh9u9TcOovZhHW38U0EIq0YP0aGZIfAK p7nlomUmKTyrTBNRTGG3y1NA3cQRkhilGh2RQfO0QpnMZjwpJdzbh2dtu0x+GGr8HMxe bp1U1hv7vcpLRAnZVyzr1kZpNgdV6hHFWQ7x3HggUU9Dgid5RXx/mVJ2uiiC7uk36VpF KPSw== X-Gm-Message-State: AOAM533bbMGTcuymLXkmpTFBpjhpdxPx5Vx6kfEHNtz46o13lGFKMihN Gc+CuVF4xG3ZNMHgdtlTup4MCg== X-Google-Smtp-Source: ABdhPJxL9v5Lf8k53i16ao7CEVbHyorhwOQ3jwSouBsV+lwzyO01q/JXnfrVhbmMsHeLVKoE0gHYkg== X-Received: by 2002:adf:dc8d:: with SMTP id r13mr19195839wrj.339.1618908149576; Tue, 20 Apr 2021 01:42:29 -0700 (PDT) Received: from bojack.baylibre.local (laubervilliers-658-1-213-31.w90-63.abo.wanadoo.fr. [90.63.244.31]) by smtp.gmail.com with ESMTPSA id a2sm27440510wrt.82.2021.04.20.01.42.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Apr 2021 01:42:29 -0700 (PDT) From: Neil Armstrong To: sjg@chromium.org Cc: jagan@amarulasolutions.com, u-boot@lists.denx.de, trini@konsulko.com, u-boot-amlogic@groups.io, Neil Armstrong Subject: [PATCH 1/2] test: reset: Extend base reset test to catch error Date: Tue, 20 Apr 2021 10:42:25 +0200 Message-Id: <20210420084226.2996654-2-narmstrong@baylibre.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210420084226.2996654-1-narmstrong@baylibre.com> References: <20210420084226.2996654-1-narmstrong@baylibre.com> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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.102.4 at phobos.denx.de X-Virus-Status: Clean With this extended test, we get the following failure : => ut dm reset_base Test: dm_test_reset_base: reset.c test/dm/reset.c:52, dm_test_reset_base(): reset_method3.id == reset_method3_1.id: Expected 0x14 (20), got 0x2 (2) Test: dm_test_reset_base: reset.c (flat tree) test/dm/reset.c:52, dm_test_reset_base(): reset_method3.id == reset_method3_1.id: Expected 0x14 (20), got 0x2 (2) Failures: 2 A fix is needed in reset_get_by_index_nodev() when introduced in [1]. [1] ea9dc35aab ("reset: Get the RESET by index without device") Signed-off-by: Neil Armstrong --- arch/sandbox/dts/test.dts | 4 ++-- test/dm/reset.c | 39 ++++++++++++++++++++++++++++++++++----- 2 files changed, 36 insertions(+), 7 deletions(-) diff --git a/arch/sandbox/dts/test.dts b/arch/sandbox/dts/test.dts index 48240aa26f..4fde923e9a 100644 --- a/arch/sandbox/dts/test.dts +++ b/arch/sandbox/dts/test.dts @@ -997,8 +997,8 @@ reset-ctl-test { compatible = "sandbox,reset-ctl-test"; - resets = <&resetc 100>, <&resetc 2>; - reset-names = "other", "test"; + resets = <&resetc 100>, <&resetc 2>, <&resetc 20>, <&resetc 40>; + reset-names = "other", "test", "test2", "test3"; }; rng { diff --git a/test/dm/reset.c b/test/dm/reset.c index fc8e9250b0..9c00452336 100644 --- a/test/dm/reset.c +++ b/test/dm/reset.c @@ -24,18 +24,47 @@ static int dm_test_reset_base(struct unit_test_state *uts) { struct udevice *dev; - struct reset_ctl reset_method1; - struct reset_ctl reset_method2; + struct reset_ctl reset_method1, reset_method1_1; + struct reset_ctl reset_method2, reset_method2_1; + struct reset_ctl reset_method3, reset_method3_1; + struct reset_ctl reset_method4, reset_method4_1; /* Get the device using the reset device */ ut_assertok(uclass_get_device_by_name(UCLASS_MISC, "reset-ctl-test", &dev)); /* Get the same reset port in 2 different ways and compare */ - ut_assertok(reset_get_by_index(dev, 1, &reset_method1)); + ut_assertok(reset_get_by_index(dev, 0, &reset_method1)); + ut_assertok(reset_get_by_index_nodev(dev_ofnode(dev), 0, + &reset_method1_1)); + ut_assertok(reset_get_by_index(dev, 1, &reset_method2)); ut_assertok(reset_get_by_index_nodev(dev_ofnode(dev), 1, - &reset_method2)); - ut_asserteq(reset_method1.id, reset_method2.id); + &reset_method2_1)); + ut_assertok(reset_get_by_index(dev, 2, &reset_method3)); + ut_assertok(reset_get_by_index_nodev(dev_ofnode(dev), 2, + &reset_method3_1)); + ut_assertok(reset_get_by_index(dev, 3, &reset_method4)); + ut_assertok(reset_get_by_index_nodev(dev_ofnode(dev), 3, + &reset_method4_1)); + + ut_asserteq(reset_method1.id, reset_method1_1.id); + ut_asserteq(reset_method2.id, reset_method2_1.id); + ut_asserteq(reset_method3.id, reset_method3_1.id); + ut_asserteq(reset_method4.id, reset_method4_1.id); + + ut_asserteq(true, reset_method1.id != reset_method2.id); + ut_asserteq(true, reset_method1.id != reset_method3.id); + ut_asserteq(true, reset_method1.id != reset_method4.id); + ut_asserteq(true, reset_method2.id != reset_method3.id); + ut_asserteq(true, reset_method2.id != reset_method4.id); + ut_asserteq(true, reset_method3.id != reset_method4.id); + + ut_asserteq(true, reset_method1_1.id != reset_method2_1.id); + ut_asserteq(true, reset_method1_1.id != reset_method3_1.id); + ut_asserteq(true, reset_method1_1.id != reset_method4_1.id); + ut_asserteq(true, reset_method2_1.id != reset_method3_1.id); + ut_asserteq(true, reset_method2_1.id != reset_method4_1.id); + ut_asserteq(true, reset_method3_1.id != reset_method4_1.id); return 0; }