linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Isabella Basso <isabbasso@riseup.net>
To: geert@linux-m68k.org, brendanhiggins@google.com,
	dlatypov@google.com, davidgow@google.com,
	akpm@linux-foundation.org, skhan@linuxfoundation.org
Cc: ferreiraenzoa@gmail.com, augusto.duraes33@gmail.com,
	linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org,
	kunit-dev@googlegroups.com, ~lkcamp/patches@lists.sr.ht,
	rodrigosiqueiramelo@gmail.com,
	Isabella Basso <isabbasso@riseup.net>
Subject: [PATCH RESEND v3 0/5] test_hash.c: refactor into KUnit
Date: Wed,  8 Dec 2021 15:37:06 -0300	[thread overview]
Message-ID: <20211208183711.390454-1-isabbasso@riseup.net> (raw)

We refactored the lib/test_hash.c file into KUnit as part of the student
group LKCAMP [1] introductory hackathon for kernel development.

This test was pointed to our group by Daniel Latypov [2], so its full
conversion into a pure KUnit test was our goal in this patch series, but
we ran into many problems relating to it not being split as unit tests,
which complicated matters a bit, as the reasoning behind the original
tests is quite cryptic for those unfamiliar with hash implementations.

Some interesting developments we'd like to highlight are:

- In patch 1/5 we noticed that there was an unused define directive that
  could be removed.
- In patch 4/5 we noticed how stringhash and hash tests are all under
  the lib/test_hash.c file, which might cause some confusion, and we
  also broke those kernel config entries up.

Overall KUnit developments have been made in the other patches in this
series:

In patches 2/5, 3/5 and 5/5 we refactored the lib/test_hash.c
file so as to make it more compatible with the KUnit style, whilst
preserving the original idea of the maintainer who designed it (i.e.
George Spelvin), which might be undesirable for unit tests, but we
assume it is enough for a first patch.

This is our first patch series so we hope our contributions are
interesting and also hope to get some useful criticism from the
community. :)

Changes since v2:
- Added comments on struct elements.
- Removed unecessary __init bits from KUnit test functions.
- Change KUnit's "EXPECT_FALSE"s for "EXPECT_EQ"s.
Changes since v1:
- Fixed compilation on parisc and m68k.
- Fixed whitespace mistakes.
- Renamed a few functions.
- Refactored globals into struct for test function params, thus removing
  a patch.
- Reworded some commit messages.

[1] - https://lkcamp.dev/
[2] - https://lore.kernel.org/linux-kselftest/CAGS_qxojszgM19u=3HLwFgKX5bm5KhywvsSunuBAt5RtR+GyxQ@mail.gmail.com/

Isabella Basso (5):
  hash.h: remove unused define directive
  test_hash.c: split test_int_hash into arch-specific functions
  test_hash.c: split test_hash_init
  lib/Kconfig.debug: properly split hash test kernel entries
  test_hash.c: refactor into kunit

 include/linux/hash.h       |   5 +-
 lib/Kconfig.debug          |  28 +++-
 lib/Makefile               |   3 +-
 lib/test_hash.c            | 259 +++++++++++++++++--------------------
 tools/include/linux/hash.h |   5 +-
 5 files changed, 147 insertions(+), 153 deletions(-)

-- 
2.34.1


             reply	other threads:[~2021-12-08 18:37 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-08 18:37 Isabella Basso [this message]
2021-12-08 18:37 ` [PATCH RESEND v3 1/5] hash.h: remove unused define directive Isabella Basso
2021-12-08 18:37 ` [PATCH RESEND v3 2/5] test_hash.c: split test_int_hash into arch-specific functions Isabella Basso
2021-12-08 18:37 ` [PATCH RESEND v3 3/5] test_hash.c: split test_hash_init Isabella Basso
2021-12-08 18:37 ` [PATCH RESEND v3 4/5] lib/Kconfig.debug: properly split hash test kernel entries Isabella Basso
2021-12-08 18:37 ` [PATCH RESEND v3 5/5] test_hash.c: refactor into kunit Isabella Basso
2021-12-08 20:58 ` [PATCH RESEND v3 0/5] test_hash.c: refactor into KUnit 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=20211208183711.390454-1-isabbasso@riseup.net \
    --to=isabbasso@riseup.net \
    --cc=akpm@linux-foundation.org \
    --cc=augusto.duraes33@gmail.com \
    --cc=brendanhiggins@google.com \
    --cc=davidgow@google.com \
    --cc=dlatypov@google.com \
    --cc=ferreiraenzoa@gmail.com \
    --cc=geert@linux-m68k.org \
    --cc=kunit-dev@googlegroups.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=rodrigosiqueiramelo@gmail.com \
    --cc=skhan@linuxfoundation.org \
    --cc=~lkcamp/patches@lists.sr.ht \
    /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).