Skip to content

deterministic random testing

Rasmus Villemoes linux-kselftest lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest4 patches 6 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4prandom.h: add *_state variant of prandom_u32_maxinclude/linux/prandom.h+29 -01 reply
2/4kselftest_module.h: unconditionally expand the KSTM_MODULE_GLOBALS() macroDocumentation/dev-tools/kselftest.rst lib/test_bitmap.c lib/test_printf.c +2 more+2 -121 reply
3/4kselftest_module.h: add struct rnd_state and seed parametertools/testing/selftests/kselftest_module.h+32 -31 reply
4/4lib/test_printf.c: use deterministic sequence of random numberslib/test_printf.c+9 -21 reply

Reviews trailers per patch

All 4 patches have a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchAndy ShevchenkoPetr Mladek
SeriesR-b
1/4R-b
2/4R-b
3/4R-b
4/4R-b

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

Read the v1 thread

Cover letter [PATCH 0/4] deterministic random testing

This is a bit of a mixed bag.

The background is that I have some sort() and list_sort() rework planned, but as part of that series I want to extend their their test suites somewhat to make sure I don't goof up - and I want to use lots of random list lengths with random contents to increase the chance of somebody eventually hitting "hey, sort() is broken when the length is 3 less than a power of 2 and only the last two elements are out of order". But when such a case is hit, it's vitally important that the developer can reproduce the exact same test case, which means using a deterministic sequence of random numbers.

Since Petr noticed [1] the non-determinism in test_printf in connection with Arpitha's work on rewriting it to kunit, this prompted me to use test_printf as a first place to apply that principle, and get the infrastructure in place that will avoid repeating the "module parameter/seed the rnd_state/report the seed used" boilerplate in each module.

Shuah, assuming the kselftest_module.h changes are ok, I think it's most natural if you carry these patches, though I'd be happy with any other route as well.

[1] https://lore.kernel.org/lkml/20200821113710.GA26290@alley/

Rasmus Villemoes (4):
prandom.h: add *_state variant of prandom_u32_max kselftest_module.h: unconditionally expand the KSTM_MODULE_GLOBALS()
macro
kselftest_module.h: add struct rnd_state and seed parameter lib/test_printf.c: use deterministic sequence of random numbers

 Documentation/dev-tools/kselftest.rst      |  2 --
 include/linux/prandom.h                    | 29 ++++++++++++++++
 lib/test_bitmap.c                          |  3 --
 lib/test_printf.c                          | 13 ++++---
 lib/test_strscpy.c                         |  2 --
 tools/testing/selftests/kselftest_module.h | 40 ++++++++++++++++++----
 6 files changed, 72 insertions(+), 17 deletions(-)
Signature · 1 line
2.23.0