linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Gow <davidgow@google.com>
To: Sander Vanheule <sander@svanheule.net>
Cc: "Yury Norov" <yury.norov@gmail.com>,
	"Andy Shevchenko" <andriy.shevchenko@linux.intel.com>,
	"Rasmus Villemoes" <linux@rasmusvillemoes.dk>,
	"Linux Kernel Mailing List" <linux-kernel@vger.kernel.org>,
	"Maíra Canal" <mairacanal@riseup.net>
Subject: Re: [PATCH v1 4/5] lib/cpumask_kunit: log mask contents
Date: Wed, 10 Aug 2022 12:07:02 +0800	[thread overview]
Message-ID: <CABVgOS=8rwx-HA6QQ8H+wM4jppdVvDeC62Fvjar_Q+YwsMyiFQ@mail.gmail.com> (raw)
In-Reply-To: <1c111f549d3c84a6fa5a96b19b17f89938314265.1660068429.git.sander@svanheule.net>

On Wed, Aug 10, 2022 at 2:09 AM Sander Vanheule <sander@svanheule.net> 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>
> ---

Thanks!

Another option would be to only print this on test failure, but it's
fine as-is as well.

Reviewed-by: David Gow <davidgow@google.com>

Cheers,
-- David


>  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);
> +
>         return 0;
>  }
>
> --
> 2.37.1
>

  reply	other threads:[~2022-08-10  4:08 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-09 18:08 [PATCH v1 0/5] cpumask: KUnit test suite fixes and improvements Sander Vanheule
2022-08-09 18:08 ` [PATCH v1 1/5] lib/test_cpumask: drop cpu_possible_mask full test Sander Vanheule
2022-08-09 22:26   ` Maíra Canal
2022-08-10  8:18     ` Sander Vanheule
2022-08-10  4:06   ` David Gow
2022-08-10  8:45     ` Sander Vanheule
2022-08-10 10:51       ` David Gow
2022-08-09 18:08 ` [PATCH v1 2/5] lib/test_cpumask: fix cpu_possible_mask last test Sander Vanheule
2022-08-09 22:27   ` Maíra Canal
2022-08-10  4:06   ` David Gow
2022-08-09 18:08 ` [PATCH v1 3/5] lib/test_cpumask: follow KUnit style guidelines Sander Vanheule
2022-08-09 22:29   ` Maíra Canal
2022-08-10  4:06   ` David Gow
2022-08-09 18:08 ` [PATCH v1 4/5] lib/cpumask_kunit: log mask contents Sander Vanheule
2022-08-10  4:07   ` David Gow [this message]
2022-08-09 18:08 ` [PATCH v1 5/5] lib/cpumask_kunit: add tests file to MAINTAINERS Sander Vanheule
2022-08-10  4:06   ` David Gow

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='CABVgOS=8rwx-HA6QQ8H+wM4jppdVvDeC62Fvjar_Q+YwsMyiFQ@mail.gmail.com' \
    --to=davidgow@google.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@rasmusvillemoes.dk \
    --cc=mairacanal@riseup.net \
    --cc=sander@svanheule.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;
as well as URLs for NNTP newsgroup(s).