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:   Thu, 10 Aug 2023 18:02:21 -0500
From:   Rae Moar <rmoar@...gle.com>
To:     Richard Fitzgerald <rf@...nsource.cirrus.com>
Cc:     brendan.higgins@...ux.dev, davidgow@...gle.com,
        linux-kselftest@...r.kernel.org, kunit-dev@...glegroups.com,
        linux-kernel@...r.kernel.org, patches@...nsource.cirrus.com
Subject: Re: [PATCH v3 6/7] kunit: kunit-test: Add test of logging only a newline

On Wed, Aug 9, 2023 at 10:54 AM Richard Fitzgerald
<rf@...nsource.cirrus.com> wrote:
>
> Add a test that logging a string containing only a newline appends
> one newline to the log.
>
> Signed-off-by: Richard Fitzgerald <rf@...nsource.cirrus.com>

This is a really great idea to include a test for the simple addition
of only a newline character.

This patch looks good to me. The only comment is that the newline test
is quite large and could be broken up as I said on the previous patch.

Reviewed-by: Rae Moar <rmoar@...gle.com>

Thanks!
-Rae

> ---
>  lib/kunit/kunit-test.c | 6 ++++++
>  1 file changed, 6 insertions(+)
>
> diff --git a/lib/kunit/kunit-test.c b/lib/kunit/kunit-test.c
> index c079550c3afd..7e710c73c7e5 100644
> --- a/lib/kunit/kunit-test.c
> +++ b/lib/kunit/kunit-test.c
> @@ -627,6 +627,12 @@ static void kunit_log_newline_test(struct kunit *test)
>                 kunit_init_log_frag(frag);
>                 list_add_tail(&frag->list, suite.log);
>
> +               /* Log only a newline */
> +               kunit_log_append(suite.log, "\n");
> +               KUNIT_EXPECT_TRUE(test, list_is_singular(suite.log));
> +               KUNIT_EXPECT_STREQ(test, frag->buf, "\n");
> +               frag->buf[0] = '\0';
> +
>                 /* String that exactly fills fragment leaving no room for \n */
>                 memset(frag->buf, 0, sizeof(frag->buf));
>                 memset(frag->buf, 'x', sizeof(frag->buf) - 9);
> --
> 2.30.2
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ