Skip to content

kunit: Add test attributes API

Rae Moar linux-hardening linux-kselftest lkml llvm oe-kbuild-all 1 version New

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest9 patches 0 repliesNew

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/9kunit: Add test attributes API structureinclude/kunit/attributes.h include/kunit/test.h lib/kunit/Makefile +3 more+161 -120 replies
2/9kunit: Add speed attributeinclude/kunit/test.h lib/kunit/attributes.c lib/kunit/kunit-example-test.c+85 -20 replies
3/9kunit: Add module attributeinclude/kunit/test.h lib/kunit/attributes.c+35 -60 replies
4/9kunit: Add ability to filter attributesinclude/kunit/attributes.h lib/kunit/attributes.c lib/kunit/executor.c +2 more+390 -280 replies
5/9kunit: tool: Add command line interface to filter and report attributestools/testing/kunit/kunit.py tools/testing/kunit/kunit_kernel.py tools/testing/kunit/kunit_parser.py +1 more+99 -290 replies
6/9kunit: memcpy: Mark tests as slow using test attributeslib/Kconfig.debug lib/memcpy_kunit.c+7 -40 replies
7/9kunit: time: Mark test as slow using test attributeskernel/time/time_test.c+1 -10 replies
8/9kunit: add tests for filtering attributeslib/kunit/executor_test.c+116 -00 replies
9/9kunit: Add documentation of KUnit test attributesDocumentation/dev-tools/kunit/running_tips.rst+166 -00 replies

Reviews trailers per patch

5 of 9 patches have a Reviewed-by or Acked-by.

PatchDavid GowKees Cook
1/9
2/9R-b
3/9R-b
4/9
5/9
6/9A-b
7/9R-b
8/9
9/9R-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 v1 0/9] kunit: Add test attributes API

Hello everyone,

This patch series adds a test attributes framework to KUnit.

There has been interest in filtering out "slow" KUnit tests. Most notably, a new config, CONFIG_MEMCPY_SLOW_KUNIT_TEST, has been added to exclude a particularly slow memcpy test
(https://lore.kernel.org/all/[email protected]/).

This attributes framework can be used to save and access test associated data, including whether a test is slow. These attributes are reportable (via KTAP and command line output) and are also filterable.

This framework is designed to allow for the addition of other attributes in the future. These attributes could include whether the test can be run concurrently, test file path, etc.

To try out the framework I suggest running:
"./tools/testing/kunit/kunit.py run --filter speed!=slow"

This patch series was originally sent out as an RFC. Here is a link to the RFC v2:
https://lore.kernel.org/all/[email protected]/

Thanks!
Rae

Rae Moar (9):
kunit: Add test attributes API structure
kunit: Add speed attribute
kunit: Add module attribute
kunit: Add ability to filter attributes
kunit: tool: Add command line interface to filter and report
attributes
kunit: memcpy: Mark tests as slow using test attributes
kunit: time: Mark test as slow using test attributes
kunit: add tests for filtering attributes
kunit: Add documentation of KUnit test attributes

 .../dev-tools/kunit/running_tips.rst          | 166 +++++++
 include/kunit/attributes.h                    |  50 +++
 include/kunit/test.h                          |  70 ++-
 kernel/time/time_test.c                       |   2 +-
 lib/Kconfig.debug                             |   3 +
 lib/kunit/Makefile                            |   3 +-
 lib/kunit/attributes.c                        | 421 ++++++++++++++++++
 lib/kunit/executor.c                          | 115 ++++-
 lib/kunit/executor_test.c                     | 128 +++++-
 lib/kunit/kunit-example-test.c                |   9 +
 lib/kunit/test.c                              |  27 +-
 lib/memcpy_kunit.c                            |   8 +-
 tools/testing/kunit/kunit.py                  |  70 ++-
 tools/testing/kunit/kunit_kernel.py           |   8 +-
 tools/testing/kunit/kunit_parser.py           |  11 +-
 tools/testing/kunit/kunit_tool_test.py        |  39 +-
 16 files changed, 1054 insertions(+), 76 deletions(-)
 create mode 100644 include/kunit/attributes.h
 create mode 100644 lib/kunit/attributes.c

base-commit: 64bd4641310c41a1ecf07c13c67bc0ed61045dfd

Signature · 1 line
2.41.0.255.g8b1d071c50-goog