lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Sat, 20 Aug 2022 14:46:06 -0700
From:   Yury Norov <yury.norov@...il.com>
To:     Sander Vanheule <sander@...nheule.net>
Cc:     Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
        Rasmus Villemoes <linux@...musvillemoes.dk>,
        Brendan Higgins <brendan.higgins@...ux.dev>,
        David Gow <davidgow@...gle.com>,
        linux-kselftest@...r.kernel.org, kunit-dev@...glegroups.com,
        MaĆ­ra Canal <mairacanal@...eup.net>,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 4/5] lib/cpumask_kunit: log mask contents

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@...gle.com>
> Signed-off-by: Sander Vanheule <sander@...nheule.net>
> Reviewed-by: David Gow <davidgow@...gle.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? 

>  	return 0;
>  }
>  
> -- 
> 2.37.2

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ