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 B767FC433EF for ; Wed, 6 Jul 2022 13:32:37 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 0EA9584549; Wed, 6 Jul 2022 15:32:36 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org 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=linaro.org header.i=@linaro.org header.b="vNaPQwum"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 5A27F8454B; Wed, 6 Jul 2022 15:32:34 +0200 (CEST) Received: from mail-wm1-x32a.google.com (mail-wm1-x32a.google.com [IPv6:2a00:1450:4864:20::32a]) (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 12E8E8453B for ; Wed, 6 Jul 2022 15:32:32 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=ilias.apalodimas@linaro.org Received: by mail-wm1-x32a.google.com with SMTP id v67-20020a1cac46000000b003a1888b9d36so9182936wme.0 for ; Wed, 06 Jul 2022 06:32:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=k3eBTlgkzhNjNGWWBubRmaWxGIkjgYrBHJxjmuxiqxk=; b=vNaPQwumliOZeLZNOM/etM6C8YfgT9d7yGCL8EC0AGuWHpanRAuLw/i/VFw5VJOOFf UAEUgxI+bshllb4t+L8KnMfR3CNwh6wNCDgNITGUZqwt0qbstcJhiX18EVFpWXQseKMF 4tdq0oAzVwUb4+5gZtftkXFH7+IsHmM15b9lEB1MJsOpU/+ktH6jL+JApiQ+nFZnCPwa CSaoi8JAJQh6seFhmLa82cquoLmVFA6fscDU06bvRcjewmaIRIyOkq9H8siS0F64keWz MEeQMvhrDpoW9qQ/3ilJ55JH3Y5NHvWmzS0E/FEBA29H02mKIFjThz/gy6FK05qNuDVv bgOA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=k3eBTlgkzhNjNGWWBubRmaWxGIkjgYrBHJxjmuxiqxk=; b=Z7h1A/4m0AJ+Bmzbu3jBDk+22FFtiFHETBkhrNvwD/ka5jKpOkAW/p/wCm60xYbmDl AMOu9kygArZeHs8XNYonK5Bd4nvpEr79SoUoWbLPrLz86uxpVRegqUHjIm2LvWXxyTdI Glrd573X9nMEco0VO8it8wmitR9ayBpWw2KnVwVgKjr+Fm1mb3WA2Gcf/nABFoZmKjWq qUtg7Z5p51YU6C/F4Vw0bBKQdOO16oJd0g+SQQoIo8N0Bby7kjqWKXdkvMXnPns9EWw/ T+UQ5lDMagDFkWLB64RYkm1VupgLAQuefbtCVnYDdi6AEqkX7Ygwr7PqYEsqG43oS+5k CjaQ== X-Gm-Message-State: AJIora8IskYOZp7/RhNpTFk6BNPzoQdJ+/Do/gbqcS6YXFRDH4FWCB6X z3ALb0OXYNNRzawuxF9XJHoLMg== X-Google-Smtp-Source: AGRyM1s3v9djBQPtv5FZrKjtZ8jnlVsdSluK68unYVcVREgYu8ncYSYPJRr28glUM4VGXqhff06tMQ== X-Received: by 2002:a05:600c:2315:b0:3a1:772e:b9a6 with SMTP id 21-20020a05600c231500b003a1772eb9a6mr38866344wmo.34.1657114351609; Wed, 06 Jul 2022 06:32:31 -0700 (PDT) Received: from hera ([46.103.15.185]) by smtp.gmail.com with ESMTPSA id i13-20020a0560001acd00b0021d78b570dfsm3977636wry.108.2022.07.06.06.32.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Jul 2022 06:32:31 -0700 (PDT) Date: Wed, 6 Jul 2022 16:32:28 +0300 From: Ilias Apalodimas To: Sughosh Ganu Cc: u-boot@lists.denx.de, Heinrich Schuchardt , Simon Glass , Tom Rini Subject: Re: [PATCH v6 7/7] test: rng: Add a UT testcase for the rng command Message-ID: References: <20220704133444.1110715-1-sughosh.ganu@linaro.org> <20220704133444.1110715-8-sughosh.ganu@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220704133444.1110715-8-sughosh.ganu@linaro.org> 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.6 at phobos.denx.de X-Virus-Status: Clean On Mon, Jul 04, 2022 at 07:04:44PM +0530, Sughosh Ganu wrote: > The 'rng' command dumps a number of random bytes on the console. Add a > set of tests for the 'rng' command. The test function performs basic > sanity testing of the command. > > Since a unit test is being added for the command, enable it by default > in the sandbox platforms. > > Reviewed-by: Simon Glass > Signed-off-by: Sughosh Ganu > --- > cmd/Kconfig | 1 + > test/dm/rng.c | 29 +++++++++++++++++++++++++++++ > 2 files changed, 30 insertions(+) > > diff --git a/cmd/Kconfig b/cmd/Kconfig > index 09193b61b9..eee5d44348 100644 > --- a/cmd/Kconfig > +++ b/cmd/Kconfig > @@ -1916,6 +1916,7 @@ config CMD_GETTIME > config CMD_RNG > bool "rng command" > depends on DM_RNG > + default y if SANDBOX > select HEXDUMP > help > Print bytes from the hardware random number generator. > diff --git a/test/dm/rng.c b/test/dm/rng.c > index 5b34c93ed6..6d1f68848d 100644 > --- a/test/dm/rng.c > +++ b/test/dm/rng.c > @@ -25,3 +25,32 @@ static int dm_test_rng_read(struct unit_test_state *uts) > return 0; > } > DM_TEST(dm_test_rng_read, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); > + > +/* Test the rng command */ > +static int dm_test_rng_cmd(struct unit_test_state *uts) > +{ > + struct udevice *dev; > + > + ut_assertok(uclass_get_device(UCLASS_RNG, 0, &dev)); > + ut_assertnonnull(dev); > + > + ut_assertok(console_record_reset_enable()); > + > + run_command("rng", 0); > + ut_assert_nextlinen("00000000:"); > + ut_assert_nextlinen("00000010:"); > + ut_assert_nextlinen("00000020:"); > + ut_assert_nextlinen("00000030:"); > + ut_assert_console_end(); > + > + run_command("rng 0 10", 0); > + ut_assert_nextlinen("00000000:"); > + ut_assert_console_end(); > + > + run_command("rng 20", 0); > + ut_assert_nextlinen("No RNG device"); > + ut_assert_console_end(); > + > + return 0; > +} > +DM_TEST(dm_test_rng_cmd, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT | UT_TESTF_CONSOLE_REC); > -- > 2.25.1 > Acked-by: Ilias Apalodimas