diff options
| author | Honghui Jiang <jiang_hh2019@163.com> | 2026-08-14 11:14:18 +0800 |
|---|---|---|
| committer | Mark Brown <broonie@kernel.org> | 2026-08-14 16:48:52 +0100 |
| commit | 9b81a87c5244bc139357460a262d4536226ba41d (patch) | |
| tree | 32f0c4bfd3480eac7b01107c68f63f31a3efad91 /tools/testing | |
| parent | af6aaacd42f74e2139391f9853d770d61ac430ce (diff) | |
spi: Add KUnit coverage for DMA mapping error paths
Add KUnit tests for the __spi_map_msg() error paths. The tests verify
that a later TX or RX mapping failure clears the mapping state of
earlier transfers and leaves cur_{tx,rx}_dma_dev identifying the
current mapping device.
A zero-length transfer causes sg_alloc_table() to return -EINVAL,
providing deterministic failure injection without test hooks.
Additional cases cover successful map/unmap and a message which
requires no mapping.
Build the DMA suite as a separate translation unit, exposing the two
internal mapping helpers only for KUnit through the local internal
header. Enable SPI in the default and all-tests KUnit configurations so
the suite is exercised there.
Signed-off-by: Honghui Jiang <jiang_hh2019@163.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://patch.msgid.link/20260814031419.43378-5-jiang_hh2019@163.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'tools/testing')
| -rw-r--r-- | tools/testing/kunit/configs/all_tests.config | 1 | ||||
| -rw-r--r-- | tools/testing/kunit/configs/default.config | 1 |
2 files changed, 2 insertions, 0 deletions
diff --git a/tools/testing/kunit/configs/all_tests.config b/tools/testing/kunit/configs/all_tests.config index bccc2c77196d..7bdcbdec2cab 100644 --- a/tools/testing/kunit/configs/all_tests.config +++ b/tools/testing/kunit/configs/all_tests.config @@ -21,6 +21,7 @@ CONFIG_VFAT_FS=y CONFIG_PCI=y CONFIG_USB4=y CONFIG_I2C=y +CONFIG_SPI=y CONFIG_NET=y CONFIG_MCTP=y diff --git a/tools/testing/kunit/configs/default.config b/tools/testing/kunit/configs/default.config index e67af7b9f1bb..2f24147c938c 100644 --- a/tools/testing/kunit/configs/default.config +++ b/tools/testing/kunit/configs/default.config @@ -1,3 +1,4 @@ CONFIG_KUNIT=y CONFIG_KUNIT_EXAMPLE_TEST=y CONFIG_KUNIT_ALL_TESTS=y +CONFIG_SPI=y |
