Linux Kernel Selftest development
 help / color / mirror / Atom feed
From: Randy Dunlap <rdunlap@infradead.org>
To: Iurii Zaikin <yzaikin@google.com>,
	"open list:KERNEL SELFTEST FRAMEWORK" 
	<linux-kselftest@vger.kernel.org>,
	linux-ext4@vger.kernel.org, skhan@linuxfoundation.org,
	Theodore Ts'o <tytso@mit.edu>,
	adilger.kernel@dilger.ca
Cc: kunit-dev@googlegroups.com, Brendan Higgins <brendanhiggins@google.com>
Subject: Re: [PATCH v1] fs/ext4/inode-test: KUnit test for ext4 inode.
Date: Wed, 9 Oct 2019 09:48:37 -0700	[thread overview]
Message-ID: <12a4da55-24a5-919d-2def-e3bbe340136e@infradead.org> (raw)
In-Reply-To: <CAAXuY3rcz78vxvXbvg+wjFBFonmOx9dfweo3od6U6TaT8JVHsQ@mail.gmail.com>

On 10/8/19 7:42 PM, Iurii Zaikin wrote:
> Note: this patch is intended to be applied against kselftest/test branch:
> https://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest.git/log/?h=test
> 
> KUnit tests for decoding extended 64 bit timestamps.
> 
> Signed-off-by: Iurii Zaikin <yzaikin@google.com>

Whitespace in this patch (ok, I'm assuming that there was some whitespace)
is severely damaged.  I.e., gone.

> ---
>  fs/ext4/Kconfig      |  12 +++
>  fs/ext4/Makefile     |   1 +
>  fs/ext4/inode-test.c | 217 +++++++++++++++++++++++++++++++++++++++++++
>  3 files changed, 230 insertions(+)
>  create mode 100644 fs/ext4/inode-test.c
> 
> diff --git a/fs/ext4/Kconfig b/fs/ext4/Kconfig
> index cbb5ca830e57..72c26abbce4c 100644
> --- a/fs/ext4/Kconfig
> +++ b/fs/ext4/Kconfig
> @@ -106,3 +106,15 @@ config EXT4_DEBUG
>    If you select Y here, then you will be able to turn on debugging
>    with a command such as:
>   echo 1 > /sys/module/ext4/parameters/mballoc_debug
> +
> +config EXT4_INODE_KUNIT_TEST
> + bool "KUnit test for ext4 inode"
> + depends on EXT4_FS
> + depends on KUNIT
> + help

The 4 lines above should begin with a tab, not a space.

> +  This builds the ext4 inode sysctl unit test, which runs on boot.
> +  Tests the encoding correctness of ext4 inode.
> +  For more information on KUnit and unit tests in general please refer
> +  to the KUnit documentation in Documentation/dev-tools/kunit/.
> +
> +  If unsure, say N.

The C source file is also missing lots of tabs (indentation).


> new file mode 100644
> index 000000000000..0ecb8dd5e0c5
> --- /dev/null
> +++ b/fs/ext4/inode-test.c
> @@ -0,0 +1,217 @@
> +// SPDX-License-Identifier: GPL-2.0
> +/*
> + * KUnit test of ext4 inode.
> + */
> +
> +#include <kunit/test.h>
> +#include <linux/kernel.h>
> +#include <linux/time64.h>
> +
> +#include "ext4.h"
> +
> +// binary: 00000000 00000000 00000000 00000000
> +#define LOWER_MSB_0 0L
> +// binary: 01111111 11111111 11111111 11111111
> +#define UPPER_MSB_0 0x7fffffffL
> +// binary: 10000000 00000000 00000000 00000000
> +#define LOWER_MSB_1 (-0x80000000L)
> +// binary: 11111111 11111111 11111111 11111111
> +#define UPPER_MSB_1 (-1L)
> +
> +#define CASE_NAME_FORMAT "%s: msb:%x lower_bound:%x extra_bits: %x"
> +
> +struct timestamp_expectation {
> + const char *test_case_name;
> + struct timespec64 expected;
> + u32 extra_bits;
> + bool msb_set;
> + bool lower_bound;
> +};
> +
> +static time64_t get_32bit_time(const struct timestamp_expectation * const test)
> +{
> + if (test->msb_set) {
> + if (test->lower_bound)
> + return LOWER_MSB_1;
> +
> + return UPPER_MSB_1;
> + }
> +
> + if (test->lower_bound)
> + return LOWER_MSB_0;
> + return UPPER_MSB_0;
> +}


-- 
~Randy

  parent reply	other threads:[~2019-10-09 16:48 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-09  2:42 [PATCH v1] fs/ext4/inode-test: KUnit test for ext4 inode Iurii Zaikin
2019-10-09 13:48 ` Shuah Khan
2019-10-10  2:40   ` Iurii Zaikin
2019-10-09 16:48 ` Randy Dunlap [this message]
2019-10-09 16:53 ` Theodore Y. Ts'o

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=12a4da55-24a5-919d-2def-e3bbe340136e@infradead.org \
    --to=rdunlap@infradead.org \
    --cc=adilger.kernel@dilger.ca \
    --cc=brendanhiggins@google.com \
    --cc=kunit-dev@googlegroups.com \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=skhan@linuxfoundation.org \
    --cc=tytso@mit.edu \
    --cc=yzaikin@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox