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>] [day] [month] [year] [list]
Date: Mon, 19 Feb 2024 15:31:04 -0800
From: Guenter Roeck <linux@...ck-us.net>
To: Kent Overstreet <kent.overstreet@...ux.dev>
Cc: Brian Foster <bfoster@...hat.com>, linux-bcachefs@...r.kernel.org,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH] mean and variance: More tests

Hi,

On Thu, May 25, 2023 at 10:22:25PM -0400, Kent Overstreet wrote:
> Add some more tests that test conventional and weighted mean
> simultaneously, and with a table of values that represents events that
> we'll be using this to look for so we can verify-by-eyeball that the
> output looks sane.

[...]

> +/* Test behaviour with a single outlier, then back to steady state: */
> +static void mean_and_variance_test_1(struct kunit *test)
> +{
> +	s64 d[]			= { 100, 10, 10, 10, 10, 10, 10 };
> +	s64 mean[]		= {  22, 21, 20, 19, 18, 17, 16 };
> +	s64 stddev[]		= {  32, 29, 28, 27, 26, 25, 24 };
> +	s64 weighted_mean[]	= {  32, 27, 22, 19, 17, 15, 14 };
> +	s64 weighted_stddev[]	= {  38, 35, 31, 27, 24, 21, 18 };
> +
> +	do_mean_and_variance_test(test, 10, 6, ARRAY_SIZE(d), 2,
> +			d, mean, stddev, weighted_mean, weighted_stddev);
> +}
> +
> +static void mean_and_variance_test_2(struct kunit *test)
> +{
> +	s64 d[]			= { 100, 10, 10, 10, 10, 10, 10 };
> +	s64 mean[]		= {  10, 10, 10, 10, 10, 10, 10 };
> +	s64 stddev[]		= {   9,  9,  9,  9,  9,  9,  9 };
> +	s64 weighted_mean[]	= {  32, 27, 22, 19, 17, 15, 14 };
> +	s64 weighted_stddev[]	= {  38, 35, 31, 27, 24, 21, 18 };
> +
> +	do_mean_and_variance_test(test, 10, 6, ARRAY_SIZE(d), 2,
> +			d, mean, stddev, weighted_mean, weighted_stddev);
> +}
> +
> +/* Test behaviour where we switch from one steady state to another: */
> +static void mean_and_variance_test_3(struct kunit *test)
> +{
> +	s64 d[]			= { 100, 100, 100, 100, 100 };
> +	s64 mean[]		= {  22,  32,  40,  46,  50 };
> +	s64 stddev[]		= {  32,  39,  42,  44,  45 };
> +	s64 weighted_mean[]	= {  32,  49,  61,  71,  78 };
> +	s64 weighted_stddev[]	= {  38,  44,  44,  41,  38 };
> +
> +	do_mean_and_variance_test(test, 10, 6, ARRAY_SIZE(d), 2,
> +			d, mean, stddev, weighted_mean, weighted_stddev);
> +}
> +
> +static void mean_and_variance_test_4(struct kunit *test)
> +{
> +	s64 d[]			= { 100, 100, 100, 100, 100 };
> +	s64 mean[]		= {  10,  11,  12,  13,  14 };
> +	s64 stddev[]		= {   9,  13,  15,  17,  19 };
> +	s64 weighted_mean[]	= {  32,  49,  61,  71,  78 };
> +	s64 weighted_stddev[]	= {  38,  44,  44,  41,  38 };
> +
> +	do_mean_and_variance_test(test, 10, 6, ARRAY_SIZE(d), 2,
> +			d, mean, stddev, weighted_mean, weighted_stddev);
>  }

Tests 2 and 4 fail for me, and I fail to see how they could ever pass,
given that the input parameters of test 2 are identical to those of test 1,
and the input parameters of test 4 are identical to those of test 3,
but the expected results for mean[] and stddev[] tests are different.

What am I missing ?

Thanks,
Guenter

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ