[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CABVgOSme356Q1efgBZrEScTEbr1L_Sdc1MY_F=knYR+pjHRTew@mail.gmail.com>
Date: Sat, 25 Oct 2025 10:01:42 +0800
From: David Gow <davidgow@...gle.com>
To: Carlos Llamas <cmllamas@...gle.com>
Cc: Brendan Higgins <brendan.higgins@...ux.dev>, Rae Moar <rmoar@...gle.com>,
Shuah Khan <skhan@...uxfoundation.org>, Marie Zhussupova <marievic@...gle.com>, kernel-team@...roid.com,
linux-kernel@...r.kernel.org, Tiffany Yang <ynaffit@...gle.com>,
"open list:KERNEL UNIT TESTING FRAMEWORK (KUnit)" <linux-kselftest@...r.kernel.org>,
"open list:KERNEL UNIT TESTING FRAMEWORK (KUnit)" <kunit-dev@...glegroups.com>
Subject: Re: [PATCH] kunit: prevent log overwrite in param_tests
On Sat, 25 Oct 2025 at 03:01, Carlos Llamas <cmllamas@...gle.com> wrote:
>
> When running parameterized tests, each test case is initialized with
> kunit_init_test(). This function takes the test_case->log as a parameter
> but it clears it via string_stream_clear() on each iteration.
>
> This results in only the log from the last parameter being preserved in
> the test_case->log and the results from the previous parameters are lost
> from the debugfs entry.
>
> Fix this by manually setting the param_test.log to the test_case->log
> after it has been initialized. This prevents kunit_init_test() from
> clearing the log on each iteration.
>
> Fixes: 4b59300ba4d2 ("kunit: Add parent kunit for parameterized test context")
> Signed-off-by: Carlos Llamas <cmllamas@...gle.com>
> ---
Thanks, Carlos: this is a nice catch!
There was some thought about keeping a separate struct kunit_case (or
equivalent) for individual test parameter (so we could provide more
detail in debugfs), which would negate the need for this, but there
are other problems with that, so just re-using the test_case->log is
definitely the way to go for now.
Reviewed-by: David Gow <davidgow@...gle.com>
Cheers,
-- David
Download attachment "smime.p7s" of type "application/pkcs7-signature" (5281 bytes)
Powered by blists - more mailing lists