Re: [RFC PATCH 0/4] fpga: add initial KUnit test suite for the subsystem

From: Russ Weight
Date: Mon Feb 13 2023 - 20:20:27 EST




On 2/3/23 09:06, Marco Pagani wrote:
> This patch set introduces a KUnit suite to test the core components
> of the FPGA subsystem. More specifically, the suite tests the core
> functions of the FPGA manager, FPGA bridge, and FPGA region.
>
> These components are tested using "fake" modules that allow
> observing their internals without altering the source code.
>
> The test suite can be run using
> [user@localhost linux]$ ./tools/testing/kunit/kunit.py run --kunitconfig=drivers/fpga/tests
When I tried running these tests, I got an error until I created this file:

drivers/fpga/tests/.kunitconfig:
CONFIG_KUNIT=y
CONFIG_FPGA=y
CONFIG_FPGA_REGION=y
CONFIG_FPGA_BRIDGE=y
CONFIG_FPGA_KUNIT_TESTS=y

I think this file needs to be included in your patchset?

- Russ

>
> Marco Pagani (4):
> fpga: add initial KUnit test suite
> fpga: add fake FPGA region
> fpga: add fake FPGA manager
> fpga: add fake FPGA bridge
>
> drivers/fpga/Kconfig | 2 +
> drivers/fpga/Makefile | 3 +
> drivers/fpga/tests/.kunitconfig | 5 +
> drivers/fpga/tests/Kconfig | 15 ++
> drivers/fpga/tests/Makefile | 6 +
> drivers/fpga/tests/fake-fpga-bridge.c | 214 +++++++++++++++
> drivers/fpga/tests/fake-fpga-bridge.h | 36 +++
> drivers/fpga/tests/fake-fpga-mgr.c | 365 ++++++++++++++++++++++++++
> drivers/fpga/tests/fake-fpga-mgr.h | 42 +++
> drivers/fpga/tests/fake-fpga-region.c | 186 +++++++++++++
> drivers/fpga/tests/fake-fpga-region.h | 37 +++
> drivers/fpga/tests/fpga-tests.c | 264 +++++++++++++++++++
> 12 files changed, 1175 insertions(+)
> create mode 100644 drivers/fpga/tests/.kunitconfig
> create mode 100644 drivers/fpga/tests/Kconfig
> create mode 100644 drivers/fpga/tests/Makefile
> create mode 100644 drivers/fpga/tests/fake-fpga-bridge.c
> create mode 100644 drivers/fpga/tests/fake-fpga-bridge.h
> create mode 100644 drivers/fpga/tests/fake-fpga-mgr.c
> create mode 100644 drivers/fpga/tests/fake-fpga-mgr.h
> create mode 100644 drivers/fpga/tests/fake-fpga-region.c
> create mode 100644 drivers/fpga/tests/fake-fpga-region.h
> create mode 100644 drivers/fpga/tests/fpga-tests.c
>