Documentation/core-api/printk-formats.rst | 4 +-
Documentation/dev-tools/kselftest.rst | 2 +-
MAINTAINERS | 2 +-
lib/Kconfig.debug | 12 +-
lib/Makefile | 1 -
lib/tests/Makefile | 1 +
lib/{test_printf.c => tests/printf_kunit.c} | 442 ++++++++++++----------------
tools/testing/selftests/kselftest/module.sh | 2 +-
tools/testing/selftests/lib/Makefile | 2 +-
tools/testing/selftests/lib/config | 1 -
tools/testing/selftests/lib/printf.sh | 4 -
11 files changed, 207 insertions(+), 266 deletions(-)
This is one of just 3 remaining "Test Module" kselftests (the others
being bitmap and scanf), the rest having been converted to KUnit.
I tested this using:
$ tools/testing/kunit/kunit.py run --arch arm64 --make_options LLVM=1 printf
I have also sent out a series converting scanf[0].
Link: https://lore.kernel.org/all/20250204-scanf-kunit-convert-v3-0-386d7c3ee714@gmail.com/T/#u [0]
Signed-off-by: Tamir Duberstein <tamird@gmail.com>
---
Changes in v6:
- Use __printf correctly on `__test`. (Petr Mladek)
- Rebase on linux-next.
- Remove leftover references to `printf.sh`.
- Update comment in `hash_pointer`. (Petr Mladek)
- Avoid overrun in `KUNIT_EXPECT_MEMNEQ`. (Petr Mladek)
- Restore trailing newlines on printk strings and add some missing ones.
(Petr Mladek)
- Use `kunit_skip` on not-yet-initialized crng. (Petr Mladek)
- Link to v5: https://lore.kernel.org/r/20250221-printf-kunit-convert-v5-0-5db840301730@gmail.com
Changes in v5:
- Update `do_test` `__printf` annotation (Rasmus Villemoes).
- Link to v4: https://lore.kernel.org/r/20250214-printf-kunit-convert-v4-0-c254572f1565@gmail.com
Changes in v4:
- Add patch "implicate test line in failure messages".
- Rebase on linux-next, move scanf_kunit.c into lib/tests/.
- Link to v3: https://lore.kernel.org/r/20250210-printf-kunit-convert-v3-0-ee6ac5500f5e@gmail.com
Changes in v3:
- Remove extraneous trailing newlines from failure messages.
- Replace `pr_warn` with `kunit_warn`.
- Drop arch changes.
- Remove KUnit boilerplate from CONFIG_PRINTF_KUNIT_TEST help text.
- Restore `total_tests` counting.
- Remove tc_fail macro in last patch.
- Link to v2: https://lore.kernel.org/r/20250207-printf-kunit-convert-v2-0-057b23860823@gmail.com
Changes in v2:
- Incorporate code review from prior work[0] by Arpitha Raghunandan.
- Link to v1: https://lore.kernel.org/r/20250204-printf-kunit-convert-v1-0-ecf1b846a4de@gmail.com
Link: https://lore.kernel.org/lkml/20200817043028.76502-1-98.arpi@gmail.com/t/#u [0]
---
Tamir Duberstein (3):
printf: convert self-test to KUnit
printf: break kunit into test cases
printf: implicate test line in failure messages
Documentation/core-api/printk-formats.rst | 4 +-
Documentation/dev-tools/kselftest.rst | 2 +-
MAINTAINERS | 2 +-
lib/Kconfig.debug | 12 +-
lib/Makefile | 1 -
lib/tests/Makefile | 1 +
lib/{test_printf.c => tests/printf_kunit.c} | 442 ++++++++++++----------------
tools/testing/selftests/kselftest/module.sh | 2 +-
tools/testing/selftests/lib/Makefile | 2 +-
tools/testing/selftests/lib/config | 1 -
tools/testing/selftests/lib/printf.sh | 4 -
11 files changed, 207 insertions(+), 266 deletions(-)
---
base-commit: 7ec162622e66a4ff886f8f28712ea1b13069e1aa
change-id: 20250131-printf-kunit-convert-fd4012aa2ec6
Best regards,
--
Tamir Duberstein <tamird@gmail.com>
On Fri, 07 Mar 2025 17:08:55 -0500, Tamir Duberstein wrote:
> This is one of just 3 remaining "Test Module" kselftests (the others
> being bitmap and scanf), the rest having been converted to KUnit.
>
> I tested this using:
>
> $ tools/testing/kunit/kunit.py run --arch arm64 --make_options LLVM=1 printf
>
> [...]
Applied to for-next/move-kunit-tests, thanks!
[1/3] printf: convert self-test to KUnit
https://git.kernel.org/kees/c/7a79e7daa84e
[2/3] printf: break kunit into test cases
https://git.kernel.org/kees/c/81a03aa9b88c
[3/3] printf: implicate test line in failure messages
https://git.kernel.org/kees/c/034bee685fd4
Take care,
--
Kees Cook
On Fri 2025-03-07 17:08:55, Tamir Duberstein wrote: > This is one of just 3 remaining "Test Module" kselftests (the others > being bitmap and scanf), the rest having been converted to KUnit. > > I tested this using: > > $ tools/testing/kunit/kunit.py run --arch arm64 --make_options LLVM=1 printf > > I have also sent out a series converting scanf[0]. > > Link: https://lore.kernel.org/all/20250204-scanf-kunit-convert-v3-0-386d7c3ee714@gmail.com/T/#u [0] > > Signed-off-by: Tamir Duberstein <tamird@gmail.com> For the entire patchset: Reviewed-by: Petr Mladek <pmladek@suse.com> Tested-by: Petr Mladek <pmladek@suse.com> Best Regards, Petr
On Fri, Mar 07, 2025 at 05:08:55PM -0500, Tamir Duberstein wrote: > This is one of just 3 remaining "Test Module" kselftests (the others > being bitmap and scanf), the rest having been converted to KUnit. > > I tested this using: > > $ tools/testing/kunit/kunit.py run --arch arm64 --make_options LLVM=1 printf > > I have also sent out a series converting scanf[0]. > > Link: https://lore.kernel.org/all/20250204-scanf-kunit-convert-v3-0-386d7c3ee714@gmail.com/T/#u [0] > > Signed-off-by: Tamir Duberstein <tamird@gmail.com> > --- > Changes in v6: > - Use __printf correctly on `__test`. (Petr Mladek) > - Rebase on linux-next. Thanks for doing this! If Petr, Rasmus, Andy, and/or others Ack this I can carry it in my "lib/ kunit tests move to lib/tests/" tree, as that's where all the infrastructure in lib/tests/ exists. -Kees -- Kees Cook
On Fri, Mar 7, 2025 at 11:49 PM Kees Cook <kees@kernel.org> wrote: > > On Fri, Mar 07, 2025 at 05:08:55PM -0500, Tamir Duberstein wrote: > > This is one of just 3 remaining "Test Module" kselftests (the others > > being bitmap and scanf), the rest having been converted to KUnit. > > > > I tested this using: > > > > $ tools/testing/kunit/kunit.py run --arch arm64 --make_options LLVM=1 printf > > > > I have also sent out a series converting scanf[0]. > > > > Link: https://lore.kernel.org/all/20250204-scanf-kunit-convert-v3-0-386d7c3ee714@gmail.com/T/#u [0] > > > > Signed-off-by: Tamir Duberstein <tamird@gmail.com> > > --- > > Changes in v6: > > - Use __printf correctly on `__test`. (Petr Mladek) > > - Rebase on linux-next. > > Thanks for doing this! > > If Petr, Rasmus, Andy, and/or others Ack this I can carry it in my > "lib/ kunit tests move to lib/tests/" tree, as that's where all the > infrastructure in lib/tests/ exists. I think the plan is to take it through the printk tree. We're still working on it, here's v6: https://lore.kernel.org/all/20250307-printf-kunit-convert-v6-0-4d85c361c241@gmail.com/ where I've rebased and put the test in lib/tests.
On Sat, Mar 8, 2025 at 7:51 AM Tamir Duberstein <tamird@gmail.com> wrote: > > On Fri, Mar 7, 2025 at 11:49 PM Kees Cook <kees@kernel.org> wrote: > > > > On Fri, Mar 07, 2025 at 05:08:55PM -0500, Tamir Duberstein wrote: > > > This is one of just 3 remaining "Test Module" kselftests (the others > > > being bitmap and scanf), the rest having been converted to KUnit. > > > > > > I tested this using: > > > > > > $ tools/testing/kunit/kunit.py run --arch arm64 --make_options LLVM=1 printf > > > > > > I have also sent out a series converting scanf[0]. > > > > > > Link: https://lore.kernel.org/all/20250204-scanf-kunit-convert-v3-0-386d7c3ee714@gmail.com/T/#u [0] > > > > > > Signed-off-by: Tamir Duberstein <tamird@gmail.com> > > > --- > > > Changes in v6: > > > - Use __printf correctly on `__test`. (Petr Mladek) > > > - Rebase on linux-next. > > > > Thanks for doing this! > > > > If Petr, Rasmus, Andy, and/or others Ack this I can carry it in my > > "lib/ kunit tests move to lib/tests/" tree, as that's where all the > > infrastructure in lib/tests/ exists. > > I think the plan is to take it through the printk tree. We're still > working on it, here's v6: > https://lore.kernel.org/all/20250307-printf-kunit-convert-v6-0-4d85c361c241@gmail.com/ > where I've rebased and put the test in lib/tests. Whoops, this is already the v6 thread! Does the layout here look correct to you?
On Sat 2025-03-08 07:52:49, Tamir Duberstein wrote: > On Sat, Mar 8, 2025 at 7:51 AM Tamir Duberstein <tamird@gmail.com> wrote: > > > > On Fri, Mar 7, 2025 at 11:49 PM Kees Cook <kees@kernel.org> wrote: > > > > > > On Fri, Mar 07, 2025 at 05:08:55PM -0500, Tamir Duberstein wrote: > > > > This is one of just 3 remaining "Test Module" kselftests (the others > > > > being bitmap and scanf), the rest having been converted to KUnit. > > > > > > > > I tested this using: > > > > > > > > $ tools/testing/kunit/kunit.py run --arch arm64 --make_options LLVM=1 printf > > > > > > > > I have also sent out a series converting scanf[0]. > > > > > > > > Link: https://lore.kernel.org/all/20250204-scanf-kunit-convert-v3-0-386d7c3ee714@gmail.com/T/#u [0] > > > > > > > > Signed-off-by: Tamir Duberstein <tamird@gmail.com> > > > > --- > > > > Changes in v6: > > > > - Use __printf correctly on `__test`. (Petr Mladek) > > > > - Rebase on linux-next. > > > > > > Thanks for doing this! > > > > > > If Petr, Rasmus, Andy, and/or others Ack this I can carry it in my > > > "lib/ kunit tests move to lib/tests/" tree, as that's where all the > > > infrastructure in lib/tests/ exists. > > > > I think the plan is to take it through the printk tree. It would be much easier when Kees takes it together with the move to lib/texts. It causes several conflicts... Kees, could you take it, please? Note that %pGg test currently fails in linux-next. It is a regression caused by a change in tracing code and should be fixed in the tracing code, see https://lore.kernel.org/all/Z9L5HsVzQ0bVZtjp@pathway.suse.cz/ Best Regards, Petr
© 2016 - 2025 Red Hat, Inc.