From: Thadeu Lima de Souza Cascardo <cascardo@igalia.com>
To: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Arnd Bergmann <arnd@arndb.de>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Andrew Morton <akpm@linux-foundation.org>,
Dirk VanDerMerwe <dirk.vandermerwe@sophos.com>,
Vimal Agrawal <vimal.agrawal@sophos.com>,
linux-kernel@vger.kernel.org, kernel-dev@igalia.com,
"open list:KERNEL SELFTEST FRAMEWORK"
<linux-kselftest@vger.kernel.org>,
KUnit Development <kunit-dev@googlegroups.com>
Subject: Re: [PATCH v5] char: misc: add test cases
Date: Wed, 30 Jul 2025 08:05:32 -0300 [thread overview]
Message-ID: <aIn8fDpGz7MCACQ3@quatroqueijos.cascardo.eti.br> (raw)
In-Reply-To: <CAMuHMdVxTW-6Wpw6qDc_ZoSE-f21WvJ478j+0jQURL+SiM_n7A@mail.gmail.com>
On Wed, Jul 30, 2025 at 09:08:57AM +0200, Geert Uytterhoeven wrote:
> Hi Thadeu,,
>
> On Sun, 15 Jun 2025 at 23:31, Thadeu Lima de Souza Cascardo
> <cascardo@igalia.com> wrote:
> >
> > Add test cases for static and dynamic minor number allocation and
> > deallocation.
> >
> > While at it, improve description and test suite name.
> >
> > Some of the cases include:
> >
> > - that static and dynamic allocation reserved the expected minors.
> >
> > - that registering duplicate minors or duplicate names will fail.
> >
> > - that failing to create a sysfs file (due to duplicate names) will
> > deallocate the dynamic minor correctly.
> >
> > - that dynamic allocation does not allocate a minor number in the static
> > range.
> >
> > - that there are no collisions when mixing dynamic and static allocations.
> >
> > - that opening devices with various minor device numbers work.
> >
> > - that registering a static number in the dynamic range won't conflict with
> > a dynamic allocation.
> >
> > This last test verifies the bug fixed by commit 6d04d2b554b1 ("misc:
> > misc_minor_alloc to use ida for all dynamic/misc dynamic minors") has not
> > regressed.
> >
> > Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@igalia.com>
>
> Thanks for your patch, which is now commit 74d8361be3441dff ("char:
> misc: add test cases") in linus/master stable/master
>
> > Changes in v5:
> > - Make miscdevice unit test built-in only
> > - Make unit test require CONFIG_KUNIT=y
>
> Why were these changes made? This means the test is no longer available
> if KUNIT=m, and I can no longer just load the module when I want to
> run the test.
>
These were made because a bug was found that devices with minor > 255 could
not be opened. So I added a test for that, which used __init functions, so
the test now had to be built-in. The alternative is to make these functions
not __init anymore and export them. Those functions are init_mknod and
init_unlink.
I will see if I can cook an RFC later today.
Cascardo.
> > - Link to v4: https://lore.kernel.org/r/20250423-misc-dynrange-v4-0-133b5ae4ca18@igalia.com
>
> > --- a/lib/Kconfig.debug
> > +++ b/lib/Kconfig.debug
> > @@ -2506,8 +2506,8 @@ config TEST_IDA
> > tristate "Perform selftest on IDA functions"
> >
> > config TEST_MISC_MINOR
> > - tristate "miscdevice KUnit test" if !KUNIT_ALL_TESTS
> > - depends on KUNIT
> > + bool "miscdevice KUnit test" if !KUNIT_ALL_TESTS
> > + depends on KUNIT=y
> > default KUNIT_ALL_TESTS
> > help
> > Kunit test for miscdevice API, specially its behavior in respect to
>
> Gr{oetje,eeting}s,
>
> Geert
>
> --
> Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
>
> In personal conversations with technical people, I call myself a hacker. But
> when I'm talking to journalists I just say "programmer" or something like that.
> -- Linus Torvalds
prev parent reply other threads:[~2025-07-30 11:05 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-12 17:32 Thadeu Lima de Souza Cascardo
2025-07-09 13:14 ` kernel test robot
2025-07-09 13:23 ` Thadeu Lima de Souza Cascardo
2025-07-11 6:46 ` Oliver Sang
2025-07-30 7:08 ` Geert Uytterhoeven
2025-07-30 11:05 ` Thadeu Lima de Souza Cascardo [this message]
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=aIn8fDpGz7MCACQ3@quatroqueijos.cascardo.eti.br \
--to=cascardo@igalia.com \
--cc=akpm@linux-foundation.org \
--cc=arnd@arndb.de \
--cc=dirk.vandermerwe@sophos.com \
--cc=geert@linux-m68k.org \
--cc=gregkh@linuxfoundation.org \
--cc=kernel-dev@igalia.com \
--cc=kunit-dev@googlegroups.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=vimal.agrawal@sophos.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
all inboxes | Powered by JetHome®