From: David Gow <davidgow@google.com>
To: shuah <shuah@kernel.org>
Cc: Brendan Higgins <brendanhiggins@google.com>,
Andrew Morton <akpm@linux-foundation.org>,
Kees Cook <keescook@chromium.org>,
"open list:KERNEL SELFTEST FRAMEWORK"
<linux-kselftest@vger.kernel.org>,
kunit-dev@googlegroups.com, linux-kernel@vger.kernel.org,
Dan Carpenter <dan.carpenter@oracle.com>
Subject: Re: [PATCH linux-kselftest/test v6] lib/list-test: add a test for the 'list' doubly linked list
Date: Wed, 30 Oct 2019 01:02:11 -0700 [thread overview]
Message-ID: <CABVgOSmCHbGjZBjeWSbPEZbJw22SaBQnoO77xxNzN_ugAwzNiQ@mail.gmail.com> (raw)
In-Reply-To: <0cb1d948-0da3-eb0f-c58f-ae3a785dd0dd@kernel.org>
On Tue, Oct 29, 2019 at 6:00 AM shuah <shuah@kernel.org> wrote:
> On 10/24/19 4:46 PM, David Gow wrote:
> > Add a KUnit test for the kernel doubly linked list implementation in
> > include/linux/list.h
> >
> > Each test case (list_test_x) is focused on testing the behaviour of the
> > list function/macro 'x'. None of the tests pass invalid lists to these
> > macros, and so should behave identically with DEBUG_LIST enabled and
> > disabled.
> >
> > Note that, at present, it only tests the list_ types (not the
> > singly-linked hlist_), and does not yet test all of the
> > list_for_each_entry* macros (and some related things like
> > list_prepare_entry).
> >
> > Signed-off-by: David Gow <davidgow@google.com>
> > Reviewed-by: Brendan Higgins <brendanhiggins@google.com>
> > Tested-by: Brendan Higgins <brendanhiggins@google.com>
> > ---
> >
> > This revision addresses Brendan's comments in
> > https://lore.kernel.org/linux-kselftest/20191023220248.GA55483@google.com/
> >
> > Specifically:
> > - Brendan's Reviewed-by/Tested-by being included in the description.
> > - A couple of trailing tabs in Kconfig.debug & list-test.c
> > - Reformatting of previously >80 character lines.
> >
> >
> > Earlier versions of this patchset can be found:
> >
> > v5:
> > https://lore.kernel.org/linux-kselftest/20191022221322.122788-1-davidgow@google.com/
> > v4:
> > https://lore.kernel.org/linux-kselftest/20191018215549.65000-1-davidgow@google.com/
> > v3:
> > https://lore.kernel.org/linux-kselftest/20191016215707.95317-1-davidgow@google.com/
> > v2:
> > https://lore.kernel.org/linux-kselftest/20191010185631.26541-1-davidgow@google.com/
> > v1:
> > https://lore.kernel.org/linux-kselftest/20191007213633.92565-1-davidgow@google.com/
> >
>
> CHECK: Unnecessary parentheses around test_struct.list
> #699: FILE: lib/list-test.c:510:
> + KUNIT_EXPECT_PTR_EQ(test, &test_struct, list_entry(&(test_struct.list),
>
> CHECK: Alignment should match open parenthesis
> #700: FILE: lib/list-test.c:511:
> + KUNIT_EXPECT_PTR_EQ(test, &test_struct, list_entry(&(test_struct.list),
> + struct list_test_struct, list));
>
> CHECK: Please don't use multiple blank lines
> #711: FILE: lib/list-test.c:522:
> +
> +
>
> CHECK: Alignment should match open parenthesis
> #713: FILE: lib/list-test.c:524:
> + KUNIT_EXPECT_PTR_EQ(test, &test_struct1, list_first_entry(&list,
> + struct list_test_struct, list));
>
> CHECK: Please don't use multiple blank lines
> #724: FILE: lib/list-test.c:535:
> +
> +
>
> CHECK: Alignment should match open parenthesis
> #726: FILE: lib/list-test.c:537:
> + KUNIT_EXPECT_PTR_EQ(test, &test_struct2, list_last_entry(&list,
> + struct list_test_struct, list));
>
> CHECK: Alignment should match open parenthesis
> #735: FILE: lib/list-test.c:546:
> + KUNIT_EXPECT_FALSE(test, list_first_entry_or_null(&list,
> + struct list_test_struct, list));
>
> CHECK: Alignment should match open parenthesis
> #741: FILE: lib/list-test.c:552:
> + KUNIT_EXPECT_PTR_EQ(test, &test_struct1,
> + list_first_entry_or_null(&list,
>
> CHECK: Alignment should match open parenthesis
> #742: FILE: lib/list-test.c:553:
> + list_first_entry_or_null(&list,
> + struct list_test_struct, list));
>
> CHECK: Please don't use multiple blank lines
> #753: FILE: lib/list-test.c:564:
> +
> +
>
> CHECK: Alignment should match open parenthesis
> #755: FILE: lib/list-test.c:566:
> + KUNIT_EXPECT_PTR_EQ(test, &test_struct2, list_next_entry(&test_struct1,
> + list));
>
> CHECK: Please don't use multiple blank lines
> #766: FILE: lib/list-test.c:577:
> +
> +
>
> CHECK: Alignment should match open parenthesis
> #768: FILE: lib/list-test.c:579:
> + KUNIT_EXPECT_PTR_EQ(test, &test_struct1, list_prev_entry(&test_struct2,
> + list));
>
> ERROR: that open brace { should be on the previous line
> #789: FILE: lib/list-test.c:600:
> +static void list_test_list_for_each_prev(struct kunit *test)
> +{
>
> ERROR: that open brace { should be on the previous line
> #807: FILE: lib/list-test.c:618:
> +static void list_test_list_for_each_safe(struct kunit *test)
> +{
>
> CHECK: Please don't use multiple blank lines
> #813: FILE: lib/list-test.c:624:
> +
> +
>
> ERROR: that open brace { should be on the previous line
> #828: FILE: lib/list-test.c:639:
> +static void list_test_list_for_each_prev_safe(struct kunit *test)
> +{
>
> ERROR: that open brace { should be on the previous line
> #848: FILE: lib/list-test.c:659:
> +static void list_test_list_for_each_entry(struct kunit *test)
> +{
>
> ERROR: that open brace { should be on the previous line
> #869: FILE: lib/list-test.c:680:
> +static void list_test_list_for_each_entry_reverse(struct kunit *test)
> +{
>
>
> I am seeing these error and warns. As per our hallway conversation, the
> "for_each*" in the test naming is tripping up checkpatch.pl
>
> For now you can change the name a bit to not trip checkpatch and maybe
> explore fixing checkpatch to differentiate between function names
> with "for_each" in them vs. the actual for_each usages in the code.
Thanks, Shuah.
Yes, the problem here is that checkpatch.pl believes that anything
with "for_each" in its name must be a loop, so expects that the open
brace is placed on the same line as for a for loop.
Longer term, I think it'd be nicer, naming-wise, to fix or work around
this issue in checkpatch.pl itself, as that'd allow the tests to
continue to follow a naming pattern of "list_test_[x]", where [x] is
the name of the function/macro being tested. Of course, short of
trying to fit a whole C parser in checkpatch.pl, that's going to
involve some compromises as well.
In the meantime, I'm sending out v7 which replaces "for_each" with
"for__each" (adding the extra underscore), so that checkpatch is
happy.
Cheers,
-- David
next prev parent reply other threads:[~2019-10-30 8:02 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-24 22:46 [PATCH linux-kselftest/test v6] lib/list-test: add a test for the 'list' doubly linked list David Gow
2019-10-29 13:00 ` shuah
2019-10-30 8:02 ` David Gow [this message]
2019-10-30 10:42 ` Dan Carpenter
2019-10-30 16:27 ` shuah
2019-10-30 16:35 ` Brendan Higgins
2019-10-30 17:18 ` Joe Perches
2019-10-31 8:51 ` Brendan Higgins
2019-10-31 10:07 ` Joe Perches
2019-10-31 10:20 ` Dan Carpenter
2019-10-30 18:46 ` Dan Carpenter
2019-10-30 19:15 ` Joe Perches
2019-10-31 6:59 ` Dan Carpenter
2019-11-01 10:50 ` Rasmus Villemoes
2019-10-30 19:12 ` Dan Carpenter
2019-10-30 19:23 ` Joe Perches
2019-10-31 7:12 ` David Gow
2019-10-31 7:42 ` Dan Carpenter
2019-11-01 16:49 ` shuah
2019-10-30 16:31 ` Joe Perches
2019-10-31 18:50 ` Kees Cook
2019-11-01 10:25 ` David Gow
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=CABVgOSmCHbGjZBjeWSbPEZbJw22SaBQnoO77xxNzN_ugAwzNiQ@mail.gmail.com \
--to=davidgow@google.com \
--cc=akpm@linux-foundation.org \
--cc=brendanhiggins@google.com \
--cc=dan.carpenter@oracle.com \
--cc=keescook@chromium.org \
--cc=kunit-dev@googlegroups.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=shuah@kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).