Skip to content

printf: convert self-test to KUnit

Tamir Duberstein linux-doc linux-kselftest linux-m68k linuxppc-dev lkml workflows 6 versions – In review

Get series with b4
b4 am [email protected] change-id 20250131-printf-kunit-convert-fd4012aa2ec6

Versions newest first

  1. v6 Latest3 patches 6 repliesIn review
  2. v53 patches 13 repliesSuperseded
  3. v43 patches 2 repliesSuperseded
Earlier versions · 3
VersionPostedPatchesRepliesStatus
v32 patches5 repliesSuperseded
v22 patches5 repliesSuperseded
v12 patches12 repliesSuperseded

Changes in v6 from the cover letter

- 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/[email protected]

Patches in v6 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3printf: convert self-test to KUnitDocumentation/core-api/printk-formats.rst Documentation/dev-tools/kselftest.rst MAINTAINERS +8 more+132 -1060 replies
2/3printf: break kunit into test caseslib/tests/printf_kunit.c+102 -1930 replies
3/3printf: implicate test line in failure messageslib/tests/printf_kunit.c+33 -270 replies

Reviews trailers per patch

None of the 3 patches has a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchPetr Mladek
SeriesR-b T-b
1/3
2/3
3/3

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v6 thread

Cover letter [PATCH v6 0/3] printf: convert self-test to KUnit

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].

---
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/[email protected]

Changes in v5:
- Update do_test __printf annotation (Rasmus Villemoes).
- Link to v4: https://lore.kernel.org/r/[email protected]

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/[email protected]

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/[email protected]

Changes in v2:
- Incorporate code review from prior work[0] by Arpitha Raghunandan.
- Link to v1: https://lore.kernel.org/r/[email protected]

---
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,

Signature · 1 line
Tamir Duberstein <[email protected]>