2024-02-25 16:29:37

by Guenter Roeck

[permalink] [raw]
Subject: [PATCH] mean_and_variance: Drop always failing tests

mean_and_variance_test_2 and mean_and_variance_test_4 always fail.
The input parameters to those tests are identical to the input parameters
to tests 1 and 3, yet the expected result for tests 2 and 4 is different
for the mean and stddev tests. That will always fail.

Expected mean_and_variance_get_mean(mv) == mean[i], but
mean_and_variance_get_mean(mv) == 22 (0x16)
mean[i] == 10 (0xa)

Drop the bad tests.

Fixes: 65bc41090720 ("mean and variance: More tests")
Closes: https://lore.kernel.org/lkml/[email protected]/
Cc: Kent Overstreet <[email protected]>
Signed-off-by: Guenter Roeck <[email protected]>
---
Based on next-20240223. Sorry for the noise if this has already been
addressed.

Tested on top of mainline kernel (v6.8-rc5-329-gab0a97cffa0b)
to avoid other problems seen in next-20240223.

lib/math/mean_and_variance_test.c | 28 +---------------------------
1 file changed, 1 insertion(+), 27 deletions(-)

diff --git a/lib/math/mean_and_variance_test.c b/lib/math/mean_and_variance_test.c
index 0d8c2451a858..fe8309f456a3 100644
--- a/lib/math/mean_and_variance_test.c
+++ b/lib/math/mean_and_variance_test.c
@@ -135,20 +135,8 @@ static void mean_and_variance_test_1(struct kunit *test)
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)
+static void mean_and_variance_test_2(struct kunit *test)
{
s64 d[] = { 100, 100, 100, 100, 100 };
s64 mean[] = { 22, 32, 40, 46, 50 };
@@ -160,18 +148,6 @@ static void mean_and_variance_test_3(struct kunit *test)
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);
-}
-
static void mean_and_variance_fast_divpow2(struct kunit *test)
{
s64 i;
@@ -229,8 +205,6 @@ static struct kunit_case mean_and_variance_test_cases[] = {
KUNIT_CASE(mean_and_variance_weighted_advanced_test),
KUNIT_CASE(mean_and_variance_test_1),
KUNIT_CASE(mean_and_variance_test_2),
- KUNIT_CASE(mean_and_variance_test_3),
- KUNIT_CASE(mean_and_variance_test_4),
{}
};

--
2.39.2



2024-04-02 14:03:55

by Guenter Roeck

[permalink] [raw]
Subject: Re: [PATCH] mean_and_variance: Drop always failing tests

On Sun, Feb 25, 2024 at 08:29:25AM -0800, Guenter Roeck wrote:
> mean_and_variance_test_2 and mean_and_variance_test_4 always fail.
> The input parameters to those tests are identical to the input parameters
> to tests 1 and 3, yet the expected result for tests 2 and 4 is different
> for the mean and stddev tests. That will always fail.
>
> Expected mean_and_variance_get_mean(mv) == mean[i], but
> mean_and_variance_get_mean(mv) == 22 (0x16)
> mean[i] == 10 (0xa)
>
> Drop the bad tests.
>

I did not get any response ... ping ....

Guenter

> Fixes: 65bc41090720 ("mean and variance: More tests")
> Closes: https://lore.kernel.org/lkml/[email protected]/
> Cc: Kent Overstreet <[email protected]>
> Signed-off-by: Guenter Roeck <[email protected]>
> ---
> Based on next-20240223. Sorry for the noise if this has already been
> addressed.
>
> Tested on top of mainline kernel (v6.8-rc5-329-gab0a97cffa0b)
> to avoid other problems seen in next-20240223.
>
> lib/math/mean_and_variance_test.c | 28 +---------------------------
> 1 file changed, 1 insertion(+), 27 deletions(-)
>
> diff --git a/lib/math/mean_and_variance_test.c b/lib/math/mean_and_variance_test.c
> index 0d8c2451a858..fe8309f456a3 100644
> --- a/lib/math/mean_and_variance_test.c
> +++ b/lib/math/mean_and_variance_test.c
> @@ -135,20 +135,8 @@ static void mean_and_variance_test_1(struct kunit *test)
> 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)
> +static void mean_and_variance_test_2(struct kunit *test)
> {
> s64 d[] = { 100, 100, 100, 100, 100 };
> s64 mean[] = { 22, 32, 40, 46, 50 };
> @@ -160,18 +148,6 @@ static void mean_and_variance_test_3(struct kunit *test)
> 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);
> -}
> -
> static void mean_and_variance_fast_divpow2(struct kunit *test)
> {
> s64 i;
> @@ -229,8 +205,6 @@ static struct kunit_case mean_and_variance_test_cases[] = {
> KUNIT_CASE(mean_and_variance_weighted_advanced_test),
> KUNIT_CASE(mean_and_variance_test_1),
> KUNIT_CASE(mean_and_variance_test_2),
> - KUNIT_CASE(mean_and_variance_test_3),
> - KUNIT_CASE(mean_and_variance_test_4),
> {}
> };
>
> --
> 2.39.2
>

2024-04-02 16:27:53

by Kent Overstreet

[permalink] [raw]
Subject: Re: [PATCH] mean_and_variance: Drop always failing tests

On Tue, Apr 02, 2024 at 07:03:33AM -0700, Guenter Roeck wrote:
> On Sun, Feb 25, 2024 at 08:29:25AM -0800, Guenter Roeck wrote:
> > mean_and_variance_test_2 and mean_and_variance_test_4 always fail.
> > The input parameters to those tests are identical to the input parameters
> > to tests 1 and 3, yet the expected result for tests 2 and 4 is different
> > for the mean and stddev tests. That will always fail.
> >
> > Expected mean_and_variance_get_mean(mv) == mean[i], but
> > mean_and_variance_get_mean(mv) == 22 (0x16)
> > mean[i] == 10 (0xa)
> >
> > Drop the bad tests.
> >
>
> I did not get any response ... ping ....

Sorry, just been swamped - applying.