All of lore.kernel.org
 help / color / mirror / Atom feed
From: Miquel Raynal <miquel.raynal@bootlin.com>
To: Stephen Boyd <sboyd@kernel.org>
Cc: Antoine Tenart <atenart@kernel.org>,
	 Christian Marangi <ansuelsmth@gmail.com>,
	 Conor Dooley <conor+dt@kernel.org>,
	 David S. Miller <davem@davemloft.net>,
	 Geert Uytterhoeven <geert+renesas@glider.be>,
	 Herbert Xu <herbert@gondor.apana.org.au>,
	Jayesh Choudhary <j-choudhary@ti.com>,
	 Krzysztof Kozlowski <krzk+dt@kernel.org>,
	 Magnus Damm <magnus.damm@gmail.com>,
	 Michael Turquette <mturquette@baylibre.com>,
	 Olivia Mackall <olivia@selenic.com>,
	Rob Herring <robh@kernel.org>,  Thomas Gleixner <tglx@kernel.org>,
	Thomas Petazzoni <thomas.petazzoni@bootlin.com>,
	 Pascal EBERHARD <pascal.eberhard@se.com>,
	 Wolfram Sang <wsa+renesas@sang-engineering.com>,
	 linux-clk@vger.kernel.org, devicetree@vger.kernel.org,
	 linux-kernel@vger.kernel.org, linux-crypto@vger.kernel.org,
	 linux-renesas-soc@vger.kernel.org
Subject: Re: [PATCH 07/16] clk: tests: Add Kunit testing for of_clk_get_parent_name()
Date: Fri, 10 Jul 2026 14:09:53 +0200	[thread overview]
Message-ID: <87echbgi5q.fsf@bootlin.com> (raw)
In-Reply-To: <177595738949.5403.11279360430887628318@lazor> (Stephen Boyd's message of "Sat, 11 Apr 2026 18:29:49 -0700")

Hi Stephen,

On 11/04/2026 at 18:29:49 -07, Stephen Boyd <sboyd@kernel.org> wrote:

> Quoting Miquel Raynal (Schneider Electric) (2026-03-27 13:09:29)
>> diff --git a/drivers/clk/clk_test.c b/drivers/clk/clk_test.c
>> index b814b45f1f7e..8a17ad0d185f 100644
>> --- a/drivers/clk/clk_test.c
>> +++ b/drivers/clk/clk_test.c
>> @@ -3651,9 +3651,19 @@ static void clk_parse_clkspec_with_incorrect_index_and_name(struct kunit *test)
>>         KUNIT_EXPECT_TRUE(test, IS_ERR(hw));
>>  }
>>  
>
> Add a comment here to tell us what the test is expecting.

Yep, done.

>> +static void clk_parse_and_get_parent_name(struct kunit *test)
>> +{
>> +       struct clk_parse_clkspec_ctx *ctx = test->priv;
>> +
>> +       KUNIT_EXPECT_STREQ(test,
>> +                          of_clk_get_parent_name(ctx->cons_np, 0),
>> +                          clk_parse_clkspec_1_init_data.name);
>> +}
>
> Reading this test is pretty hard because all the context is in the
> common setup. Maybe the common setup is too broad in this case and
> should be simplified so that tests can show more setup and assert code
> for the things it wants to do. For example, if the name can be passed
> from this test directly it would clarify by moving context into test
> function scope.
>
> 	const char *pname = "expected-name";
>
> 	KUNIT_ASSERT_EQ(test, 0, setup_parent(pname));
>
> 	KUNIT_EXPECT_STREQ(test, pname,
> 			   of_clk_get_parent_name(ctx->cons_np, 0));

While I understand the feeling, provider 1 and 2 are shared with other
test cases which would require restructuring quite a bit the whole test
suite for IMHO little benefit. I can however make more obvious the string
that is actually expected by redefining it in plain sight at the call
site.

>>  static struct kunit_case clk_parse_clkspec_test_cases[] = {
>>         KUNIT_CASE(clk_parse_clkspec_with_correct_index_and_name),
>>         KUNIT_CASE(clk_parse_clkspec_with_incorrect_index_and_name),
>> +       KUNIT_CASE(clk_parse_and_get_parent_name),
>
> Better to call the test something like
> of_clk_get_parent_name_gets_parent_name to indicate what we're
> testing.

Fine by me.

Thanks,
Miquèl

  reply	other threads:[~2026-07-10 12:10 UTC|newest]

Thread overview: 56+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-27 20:09 [PATCH 00/16] Add support for Inside-Secure EIP-150 crypto block Miquel Raynal (Schneider Electric)
2026-03-27 20:09 ` [PATCH 01/16] dt-bindings: clock: Introduce nexus nodes Miquel Raynal (Schneider Electric)
2026-04-07 19:29   ` Rob Herring
2026-07-10  9:35     ` Miquel Raynal
2026-04-12  1:16   ` Stephen Boyd
2026-07-10  9:33     ` Miquel Raynal
2026-03-27 20:09 ` [PATCH 02/16] dt-bindings: interrupt-controller: Describe EIP-201 AIC Miquel Raynal (Schneider Electric)
2026-04-07 19:45   ` Rob Herring (Arm)
2026-04-16 18:04   ` Aleksander Jan Bajkowski
2026-04-17  7:50     ` Miquel Raynal
2026-04-17 15:22       ` Aleksander Jan Bajkowski
2026-07-10  9:48     ` Miquel Raynal
2026-03-27 20:09 ` [PATCH 03/16] dt-bindings: rng: Rename the title of the EIP-76 file Miquel Raynal (Schneider Electric)
2026-04-07 19:47   ` Rob Herring (Arm)
2026-03-27 20:09 ` [PATCH 04/16] dt-bindings: crypto: eip28: Describe EIP-28 PKA Miquel Raynal (Schneider Electric)
2026-04-07 19:49   ` Rob Herring
2026-03-27 20:09 ` [PATCH 05/16] dt-bindings: bus: eip150: Describe the EIP-150 container node Miquel Raynal (Schneider Electric)
2026-04-07 19:44   ` Rob Herring
2026-07-10 12:59     ` Miquel Raynal
2026-03-27 20:09 ` [PATCH 06/16] clk: tests: Add clk_parse_clkspec() Kunit testing Miquel Raynal (Schneider Electric)
2026-03-30 14:48   ` Brian Masney
2026-04-01  8:59     ` Miquel Raynal
2026-04-01 13:55       ` Brian Masney
2026-07-10  9:13         ` Miquel Raynal
2026-03-27 20:09 ` [PATCH 07/16] clk: tests: Add Kunit testing for of_clk_get_parent_name() Miquel Raynal (Schneider Electric)
2026-04-12  1:29   ` Stephen Boyd
2026-07-10 12:09     ` Miquel Raynal [this message]
2026-03-27 20:09 ` [PATCH 08/16] clk: Improve a couple of comments Miquel Raynal (Schneider Electric)
2026-03-30 14:50   ` Brian Masney
2026-03-27 20:09 ` [PATCH 09/16] clk: Use the generic OF phandle parsing in only one place Miquel Raynal (Schneider Electric)
2026-03-30 15:01   ` Brian Masney
2026-04-01  8:49     ` Miquel Raynal
2026-03-27 20:09 ` [PATCH 10/16] clk: Add support for clock nexus dt bindings Miquel Raynal (Schneider Electric)
2026-03-30 15:09   ` Brian Masney
2026-03-30 15:16   ` Brian Masney
2026-04-01  8:47     ` Miquel Raynal
2026-04-01 14:04       ` Brian Masney
2026-04-12  1:12       ` Stephen Boyd
2026-07-10 11:44         ` Miquel Raynal
2026-05-13 15:05   ` Frank Li
2026-03-27 20:09 ` [PATCH 11/16] clk: tests: Add Kunit testing for nexus nodes Miquel Raynal (Schneider Electric)
2026-04-12  1:40   ` Stephen Boyd
2026-07-10 10:35     ` Miquel Raynal
2026-03-27 20:09 ` [PATCH 12/16] irqchip/eip201-aic: Add support for Safexcel EIP-201 AIC Miquel Raynal (Schneider Electric)
2026-03-28 13:10   ` Thomas Gleixner
2026-04-01  9:10     ` Miquel Raynal
2026-04-08  8:05   ` Geert Uytterhoeven
2026-07-08 12:59     ` Miquel Raynal
2026-03-27 20:09 ` [PATCH 13/16] hwrng: omap: Enable on Renesas RZ/N1D Miquel Raynal (Schneider Electric)
2026-03-27 20:09 ` [PATCH 14/16] crypto: Group Inside-Secure IPs together and align the titles Miquel Raynal (Schneider Electric)
2026-03-27 20:09 ` [PATCH 15/16] crypto: eip28: Add support for SafeXcel EIP-28 Public Key Accelerator Miquel Raynal (Schneider Electric)
2026-03-27 20:09 ` [PATCH 16/16] ARM: dts: renesas: r9a06g032: Describe the EIP-150 block Miquel Raynal (Schneider Electric)
2026-04-07 19:33   ` Rob Herring
2026-07-08 12:55     ` Miquel Raynal
2026-03-30 13:33 ` [PATCH 00/16] Add support for Inside-Secure EIP-150 crypto block Geert Uytterhoeven
2026-04-01  9:02   ` Miquel Raynal

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87echbgi5q.fsf@bootlin.com \
    --to=miquel.raynal@bootlin.com \
    --cc=ansuelsmth@gmail.com \
    --cc=atenart@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=davem@davemloft.net \
    --cc=devicetree@vger.kernel.org \
    --cc=geert+renesas@glider.be \
    --cc=herbert@gondor.apana.org.au \
    --cc=j-choudhary@ti.com \
    --cc=krzk+dt@kernel.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=magnus.damm@gmail.com \
    --cc=mturquette@baylibre.com \
    --cc=olivia@selenic.com \
    --cc=pascal.eberhard@se.com \
    --cc=robh@kernel.org \
    --cc=sboyd@kernel.org \
    --cc=tglx@kernel.org \
    --cc=thomas.petazzoni@bootlin.com \
    --cc=wsa+renesas@sang-engineering.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.