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]
Message-Id: <20210525144948.5bf487414edd6e0655902cf4@linux-foundation.org>
Date:   Tue, 25 May 2021 14:49:48 -0700
From:   Andrew Morton <akpm@...ux-foundation.org>
To:     Trent Piepho <tpiepho@...il.com>
Cc:     linux-kernel@...r.kernel.org, andy@...nel.org, oskar@...ra.com,
        Daniel Latypov <dlatypov@...gle.com>
Subject: Re: [PATCH v2 2/2] lib/math/rational: Add Kunit test cases

On Tue, 25 May 2021 07:42:50 -0700 Trent Piepho <tpiepho@...il.com> wrote:

> Adds a number of test cases that cover a range of possible code paths.
> 
> --- /dev/null
> +++ b/lib/math/rational-test.c
> @@ -0,0 +1,56 @@
> +// SPDX-License-Identifier: GPL-2.0
> +
> +#include <kunit/test.h>
> +
> +#include <linux/rational.h>
> +
> +struct rational_test_param {
> +	unsigned long num, den;
> +	unsigned long max_num, max_den;
> +	unsigned long exp_num, exp_den;
> +
> +	const char *name;
> +};
> +
> +static const struct rational_test_param test_parameters[] = {
> +	{ 1230,	10,	100, 20,	100, 1,    "Exceeds bounds, semi-convergent term > ½ last term" },
> +	{ 34567,100, 	120, 20,	120, 1,    "Exceeds bounds, semi-convergent term < ½ last term" },

It seems to be asking for trouble to use these characters in kernel
output - heaven knows what sort of weird output devices people
are using.  So I think I'll switch to "1/2", OK?

> +	{ 1, 30,	100, 10,	0, 1,	   "Closest to zero" },
> +	{ 1, 19,	100, 10,	1, 10,     "Closest to smallest non-zero" },
> +	{ 27,32,	16, 16,		11, 13,    "Use convergent" },
> +	{ 1155, 7735,	255, 255,	33, 221,   "Exact answer" },
> +	{ 87, 32,	70, 32,		68, 25,    "Semiconvergent, numerator limit" },
> +	{ 14533, 4626,	15000, 2400,	7433, 2366, "Semiconvergent, demominator limit" },
> +};
> ...
> +static struct kunit_case rational_test_cases[] = {
> +       KUNIT_CASE_PARAM(rational_test, rational_gen_params),
> +       {}
> +};
> +
> +static struct kunit_suite rational_test_suite = {
> +       .name = "rational",
> +       .test_cases = rational_test_cases,
> +};

And let's use tabs to indent here.  checkpatch detects this.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ