Hi Jason,
Modernize the open coded test framework by using kunit.
The kunit tool can be used to build a kernel and run it in a VM with:
$ tools/testing/kunit/kunit.py run --build_dir build_kunit_x86_64 --arch x86_64 --kunitconfig ./drivers/dma-buf/.kunitconfig
Along with the other ways to run kunits.
To make the kunit tool work like this the DMABUF_KUNIT_TEST kconfig must select DMA_SHARED_BUFFER to get it turned on without building a driver using it.
Signed-off-by: Jason Gunthorpe jgg@nvidia.com
Thanks for your patch, which is now commit 15b9bde78baddc27 ("dma-buf: Change st-dma-resv.c to use kunit") upstream.
--- /dev/null +++ b/drivers/dma-buf/.kunitconfig @@ -0,0 +1,2 @@ +CONFIG_KUNIT=y +CONFIG_DMABUF_KUNIT_TEST=y diff --git a/drivers/dma-buf/Kconfig b/drivers/dma-buf/Kconfig index 8d4f2f89f24e3c..7d13c8f4484dd3 100644 --- a/drivers/dma-buf/Kconfig +++ b/drivers/dma-buf/Kconfig @@ -54,6 +54,14 @@ config DMABUF_SELFTESTS default n depends on DMA_SHARED_BUFFER +config DMABUF_KUNIT_TEST
- tristate "KUnit tests for DMA-BUF" if !KUNIT_ALL_TESTS
- depends on KUNIT
- select DMA_SHARED_BUFFER
This select means that enabling KUNIT_ALL_TESTS also enables extra functionality, which may not be desirable in a production system. Unfortunately DMA_SHARED_BUFFER is invisible, so just changing this from "select" to "depends on" may not be the most desirable solution.
- default KUNIT_ALL_TESTS
- help
Enable kunit tests for DMA-BUFmenuconfig DMABUF_HEAPS bool "DMA-BUF Userland Memory Heaps" select DMA_SHARED_BUFFER
Gr{oetje,eeting}s,
Geert
-- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds