cxl: Add KUnit tests and documentation
Get series with b4
b4 am [email protected]Versions newest first · linked by author and title
- v2 Latest4 patches 1 replyIn review
- v14 patches 18 repliesSuperseded
Changes in v2 from the cover letter
- Use explicit hex designators in the decoder count table to match the spec (JonathanC)
- Generalize arch option and add help ref in testing page (AnisaS)
- Explicitly initialize the mock return_code to SUCCESS (MingL)
- Add a 'Maintaining KUnit tests' section to testing page
- Wrap long lines in testing page (JonathanC)
- Rebase on 7.4-rc1
v1: https://lore.kernel.org/linux-cxl/[email protected]/
Patches in v2 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/4 | Documentation/driver-api/cxl: Add a testing pageDocumentation/ Documentation/ | +137 | 0 replies | |
| 2/4 | cxl: Add KUnit tests for HDM decoder encoding helpersdrivers/ drivers/ drivers/ +2 more | +185 | 0 replies | |
| 3/4 | cxl/mbox: Treat unknown device return codes as errorsdrivers/ | +6 | 0 replies | |
| 4/4 | cxl/mbox: Add KUnit tests for cxl_internal_send_cmd()Documentation/ drivers/ drivers/ +1 more | +259 | 0 replies |
Reviews trailers per patch
All 4 patches have a Reviewed-by or Acked-by.
| Patch | Anisa Su | Jonathan Cameron | Dave Jiang | Li Ming |
|---|---|---|---|---|
| 1/4 | R-b | R-b | R-b | |
| 2/4 | R-b | R-b | R-b | |
| 3/4 | R-b | R-b | R-b | |
| 4/4 | R-b |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 4 reviewers.
Cover letter [PATCH v2 0/4] cxl: Add KUnit tests and documentation
Changes in v2:
- Use explicit hex designators in the decoder count table to match the spec (JonathanC)
- Generalize arch option and add help ref in testing page (AnisaS)
- Explicitly initialize the mock return_code to SUCCESS (MingL)
- Add a 'Maintaining KUnit tests' section to testing page
- Wrap long lines in testing page (JonathanC)
- Rebase on 7.4-rc1
v1: https://lore.kernel.org/linux-cxl/[email protected]/
The CXL subsystem has no KUnit tests. Its automated test coverage comes from cxl_test and the ndctl suite, which exercise the driver stack through an emulated CXL topology. KUnit complements that coverage by testing self- contained logic and error paths in isolation.
This series introduces CXL KUnit infrastructure and documentation describing how it complements the existing cxl_test coverage.
The first KUnit suite, a collection of related test cases, exercises the HDM decoder interleave encoding helpers, providing a starting point for testing self-contained CXL logic. The second suite exercises mailbox command handling, including error paths that are difficult to reach through cxl_test.
The mailbox tests also demonstrate the value of regression coverage. An unknown device return code can cause an out-of-bounds read and allow a failed command to be reported as successful. The series corrects that behavior, then adds tests that reproduce the failure without the correction. With KASAN enabled, the tests also expose the out-of-bounds read.
Together, the two suites establish a pattern for adding KUnit coverage to CXL, both for existing functionality and for bugs as they are found.
Alison Schofield (3):
Documentation/driver-api/cxl: Add a testing page
cxl: Add KUnit tests for HDM decoder encoding helpers cxl/mbox: Add KUnit tests for cxl_internal_send_cmd()
Gaobin Huang (1):
cxl/mbox: Treat unknown device return codes as errors
Documentation/driver-api/cxl/index.rst | 1 + Documentation/driver-api/cxl/testing.rst | 139 +++++++++++++ drivers/cxl/.kunitconfig | 4 + drivers/cxl/Kconfig | 16 ++ drivers/cxl/Makefile | 1 + drivers/cxl/core/Makefile | 1 + drivers/cxl/core/tests/Makefile | 5 + drivers/cxl/core/tests/mbox_kunit.c | 250 +++++++++++++++++++++++ drivers/cxl/cxlmem.h | 6 + drivers/cxl/tests/Makefile | 5 + drivers/cxl/tests/hdm_encoding_kunit.c | 159 ++++++++++++++ 11 files changed, 587 insertions(+) create mode 100644 Documentation/driver-api/cxl/testing.rst create mode 100644 drivers/cxl/.kunitconfig create mode 100644 drivers/cxl/core/tests/Makefile create mode 100644 drivers/cxl/core/tests/mbox_kunit.c create mode 100644 drivers/cxl/tests/Makefile create mode 100644 drivers/cxl/tests/hdm_encoding_kunit.c
base-commit: 6628e7d4c6b25c8d18f1345e3a20d21829aae7e4
Signature · 1 line
2.37.3