From: Sander Vanheule <sander@svanheule.net>
To: Yury Norov <yury.norov@gmail.com>
Cc: "Andy Shevchenko" <andriy.shevchenko@linux.intel.com>,
"Rasmus Villemoes" <linux@rasmusvillemoes.dk>,
"Brendan Higgins" <brendan.higgins@linux.dev>,
"David Gow" <davidgow@google.com>,
linux-kselftest@vger.kernel.org, kunit-dev@googlegroups.com,
"Maíra Canal" <mairacanal@riseup.net>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 4/5] lib/cpumask_kunit: log mask contents
Date: Sun, 21 Aug 2022 15:13:50 +0200 [thread overview]
Message-ID: <49f6eaa7e8586e4eba39d636ef034fc1626e3bc2.camel@svanheule.net> (raw)
In-Reply-To: <YwFWHj0p/Uc0njme@yury-laptop>
On Sat, 2022-08-20 at 14:46 -0700, Yury Norov wrote:
> On Sat, Aug 20, 2022 at 05:03:12PM +0200, Sander Vanheule wrote:
> > For extra context, log the contents of the masks under test. This
> > should help with finding out why a certain test fails.
> >
> > Link:
> > https://lore.kernel.org/lkml/CABVgOSkPXBc-PWk1zBZRQ_Tt+Sz1ruFHBj3ixojymZF=Vi4tpQ@mail.gmail.com/
> > Suggested-by: David Gow <davidgow@google.com>
> > Signed-off-by: Sander Vanheule <sander@svanheule.net>
> > Reviewed-by: David Gow <davidgow@google.com>
> > ---
> > lib/cpumask_kunit.c | 10 ++++++++++
> > 1 file changed, 10 insertions(+)
> >
> > diff --git a/lib/cpumask_kunit.c b/lib/cpumask_kunit.c
> > index 4d353614d853..0f8059a5e93b 100644
> > --- a/lib/cpumask_kunit.c
> > +++ b/lib/cpumask_kunit.c
> > @@ -51,6 +51,10 @@
> > static cpumask_t mask_empty;
> > static cpumask_t mask_all;
> >
> > +#define STR_MASK(m) #m
> > +#define TEST_CPUMASK_PRINT(test, mask) \
> > + kunit_info(test, "%s = '%*pbl'\n", STR_MASK(mask), nr_cpumask_bits,
> > cpumask_bits(mask))
> > +
> > static void test_cpumask_weight(struct kunit *test)
> > {
> > KUNIT_EXPECT_TRUE(test, cpumask_empty(&mask_empty));
> > @@ -103,6 +107,9 @@ static void test_cpumask_iterators_builtin(struct kunit
> > *test)
> > /* Ensure the dynamic masks are stable while running the tests */
> > cpu_hotplug_disable();
> >
> > + TEST_CPUMASK_PRINT(test, cpu_online_mask);
> > + TEST_CPUMASK_PRINT(test, cpu_present_mask);
> > +
> > EXPECT_FOR_EACH_CPU_BUILTIN_EQ(test, online);
> > EXPECT_FOR_EACH_CPU_BUILTIN_EQ(test, present);
> >
> > @@ -114,6 +121,9 @@ static int test_cpumask_init(struct kunit *test)
> > cpumask_clear(&mask_empty);
> > cpumask_setall(&mask_all);
> >
> > + TEST_CPUMASK_PRINT(test, &mask_all);
> > + TEST_CPUMASK_PRINT(test, cpu_possible_mask);
> > +
>
> It sort of breaks the rule of silence. Can you make this print conditional
> on a test failure? If everything is OK, who wants to look into details?
I will change the macros to the _MSG versions, and log the mask there.
I implemented this with kunit_info() as David proposed. AFAICT I can't call
kunit_info() only when the test fails, because the EXPECT_ macros don't return
any result.
Best,
Sander
>
> > return 0;
> > }
> >
> > --
> > 2.37.2
next prev parent reply other threads:[~2022-08-21 13:14 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-20 15:03 [PATCH v2 0/5] cpumask: KUnit test suite fixes and improvements Sander Vanheule
2022-08-20 15:03 ` [PATCH v2 1/5] lib/test_cpumask: drop cpu_possible_mask full test Sander Vanheule
2022-08-20 21:35 ` Yury Norov
2022-08-21 13:08 ` Sander Vanheule
[not found] ` <CAAH8bW9yZUMn2shYAB1LaDyzgFMYtWCRUXxq=bMCiFys=gzKig@mail.gmail.com>
2022-08-21 13:27 ` Sander Vanheule
2022-08-20 15:03 ` [PATCH v2 2/5] lib/test_cpumask: fix cpu_possible_mask last test Sander Vanheule
2022-08-20 15:03 ` [PATCH v2 3/5] lib/test_cpumask: follow KUnit style guidelines Sander Vanheule
2022-08-20 15:03 ` [PATCH v2 4/5] lib/cpumask_kunit: log mask contents Sander Vanheule
2022-08-20 21:46 ` Yury Norov
2022-08-21 13:13 ` Sander Vanheule [this message]
2022-08-21 14:02 ` Maíra Canal
2022-08-21 16:39 ` Sander Vanheule
2022-08-20 15:03 ` [PATCH v2 5/5] lib/cpumask_kunit: add tests file to MAINTAINERS Sander Vanheule
2022-08-20 22:06 ` [PATCH v2 0/5] cpumask: KUnit test suite fixes and improvements Yury Norov
2022-08-21 13:25 ` Sander Vanheule
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=49f6eaa7e8586e4eba39d636ef034fc1626e3bc2.camel@svanheule.net \
--to=sander@svanheule.net \
--cc=andriy.shevchenko@linux.intel.com \
--cc=brendan.higgins@linux.dev \
--cc=davidgow@google.com \
--cc=kunit-dev@googlegroups.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux@rasmusvillemoes.dk \
--cc=mairacanal@riseup.net \
--cc=yury.norov@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox