Message ID | 20230616154405.220502-5-marpagan@redhat.com (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | fpga: add initial KUnit tests for the subsystem | expand |
On 2023-06-16 at 17:44:05 +0200, Marco Pagani wrote: > Add configuration for the KUnit test suites for the core components > of the FPGA subsystem. > > Signed-off-by: Marco Pagani <marpagan@redhat.com> > --- > drivers/fpga/Kconfig | 2 ++ > drivers/fpga/Makefile | 3 +++ > drivers/fpga/tests/.kunitconfig | 5 +++++ > drivers/fpga/tests/Kconfig | 11 +++++++++++ > drivers/fpga/tests/Makefile | 5 +++++ > 5 files changed, 26 insertions(+) > create mode 100644 drivers/fpga/tests/.kunitconfig > create mode 100644 drivers/fpga/tests/Kconfig > create mode 100644 drivers/fpga/tests/Makefile > > diff --git a/drivers/fpga/Kconfig b/drivers/fpga/Kconfig > index 0a00763b9f28..2f689ac4ba3a 100644 > --- a/drivers/fpga/Kconfig > +++ b/drivers/fpga/Kconfig > @@ -276,4 +276,6 @@ config FPGA_MGR_LATTICE_SYSCONFIG_SPI > FPGA manager driver support for Lattice FPGAs programming over slave > SPI sysCONFIG interface. > > +source "drivers/fpga/tests/Kconfig" > + > endif # FPGA > diff --git a/drivers/fpga/Makefile b/drivers/fpga/Makefile > index 72e554b4d2f7..352a2612623e 100644 > --- a/drivers/fpga/Makefile > +++ b/drivers/fpga/Makefile > @@ -55,3 +55,6 @@ obj-$(CONFIG_FPGA_DFL_NIOS_INTEL_PAC_N3000) += dfl-n3000-nios.o > > # Drivers for FPGAs which implement DFL > obj-$(CONFIG_FPGA_DFL_PCI) += dfl-pci.o > + > +# KUnit tests > +obj-$(CONFIG_FPGA_KUNIT_TESTS) += tests/ > diff --git a/drivers/fpga/tests/.kunitconfig b/drivers/fpga/tests/.kunitconfig > new file mode 100644 > index 000000000000..a1c2a2974c39 > --- /dev/null > +++ b/drivers/fpga/tests/.kunitconfig > @@ -0,0 +1,5 @@ > +CONFIG_KUNIT=y > +CONFIG_FPGA=y > +CONFIG_FPGA_REGION=y > +CONFIG_FPGA_BRIDGE=y > +CONFIG_FPGA_KUNIT_TESTS=y > diff --git a/drivers/fpga/tests/Kconfig b/drivers/fpga/tests/Kconfig > new file mode 100644 > index 000000000000..e4a64815f16d > --- /dev/null > +++ b/drivers/fpga/tests/Kconfig > @@ -0,0 +1,11 @@ > +config FPGA_KUNIT_TESTS > + tristate "KUnit test for the FPGA subsystem" if !KUNIT_ALL_TESTS > + depends on FPGA && FPGA_REGION && FPGA_BRIDGE && KUNIT=y Why KUNIT shouldn't be 'm' > + default KUNIT_ALL_TESTS > + help > + This builds unit tests for the FPGA subsystem > + > + For more information on KUnit and unit tests in general, > + please refer to the KUnit documentation in Documentation/dev-tools/kunit/. > + > + If unsure, say N. > diff --git a/drivers/fpga/tests/Makefile b/drivers/fpga/tests/Makefile > new file mode 100644 > index 000000000000..faa5fa230ab0 > --- /dev/null > +++ b/drivers/fpga/tests/Makefile > @@ -0,0 +1,5 @@ > +# SPDX-License-Identifier: GPL-2.0 > + > +obj-$(CONFIG_FPGA_KUNIT_TESTS) += fpga-mgr-test.o > +obj-$(CONFIG_FPGA_KUNIT_TESTS) += fpga-bridge-test.o > +obj-$(CONFIG_FPGA_KUNIT_TESTS) += fpga-region-test.o Could be integrated in one line? Thanks, Yilun > -- > 2.40.1 >
On 2023-06-25 10:23, Xu Yilun wrote: > On 2023-06-16 at 17:44:05 +0200, Marco Pagani wrote: >> Add configuration for the KUnit test suites for the core components >> of the FPGA subsystem. >> >> Signed-off-by: Marco Pagani <marpagan@redhat.com> >> --- >> drivers/fpga/Kconfig | 2 ++ >> drivers/fpga/Makefile | 3 +++ >> drivers/fpga/tests/.kunitconfig | 5 +++++ >> drivers/fpga/tests/Kconfig | 11 +++++++++++ >> drivers/fpga/tests/Makefile | 5 +++++ >> 5 files changed, 26 insertions(+) >> create mode 100644 drivers/fpga/tests/.kunitconfig >> create mode 100644 drivers/fpga/tests/Kconfig >> create mode 100644 drivers/fpga/tests/Makefile >> >> diff --git a/drivers/fpga/Kconfig b/drivers/fpga/Kconfig >> index 0a00763b9f28..2f689ac4ba3a 100644 >> --- a/drivers/fpga/Kconfig >> +++ b/drivers/fpga/Kconfig >> @@ -276,4 +276,6 @@ config FPGA_MGR_LATTICE_SYSCONFIG_SPI >> FPGA manager driver support for Lattice FPGAs programming over slave >> SPI sysCONFIG interface. >> >> +source "drivers/fpga/tests/Kconfig" >> + >> endif # FPGA >> diff --git a/drivers/fpga/Makefile b/drivers/fpga/Makefile >> index 72e554b4d2f7..352a2612623e 100644 >> --- a/drivers/fpga/Makefile >> +++ b/drivers/fpga/Makefile >> @@ -55,3 +55,6 @@ obj-$(CONFIG_FPGA_DFL_NIOS_INTEL_PAC_N3000) += dfl-n3000-nios.o >> >> # Drivers for FPGAs which implement DFL >> obj-$(CONFIG_FPGA_DFL_PCI) += dfl-pci.o >> + >> +# KUnit tests >> +obj-$(CONFIG_FPGA_KUNIT_TESTS) += tests/ >> diff --git a/drivers/fpga/tests/.kunitconfig b/drivers/fpga/tests/.kunitconfig >> new file mode 100644 >> index 000000000000..a1c2a2974c39 >> --- /dev/null >> +++ b/drivers/fpga/tests/.kunitconfig >> @@ -0,0 +1,5 @@ >> +CONFIG_KUNIT=y >> +CONFIG_FPGA=y >> +CONFIG_FPGA_REGION=y >> +CONFIG_FPGA_BRIDGE=y >> +CONFIG_FPGA_KUNIT_TESTS=y >> diff --git a/drivers/fpga/tests/Kconfig b/drivers/fpga/tests/Kconfig >> new file mode 100644 >> index 000000000000..e4a64815f16d >> --- /dev/null >> +++ b/drivers/fpga/tests/Kconfig >> @@ -0,0 +1,11 @@ >> +config FPGA_KUNIT_TESTS >> + tristate "KUnit test for the FPGA subsystem" if !KUNIT_ALL_TESTS >> + depends on FPGA && FPGA_REGION && FPGA_BRIDGE && KUNIT=y > > Why KUNIT shouldn't be 'm' > The "running tips" section of KUnit documentation suggests that tests should ideally depend on KUNIT=y in their Kconfigs because some features will not work when KUNIT=m >> + default KUNIT_ALL_TESTS >> + help >> + This builds unit tests for the FPGA subsystem >> + >> + For more information on KUnit and unit tests in general, >> + please refer to the KUnit documentation in Documentation/dev-tools/kunit/. >> + >> + If unsure, say N. >> diff --git a/drivers/fpga/tests/Makefile b/drivers/fpga/tests/Makefile >> new file mode 100644 >> index 000000000000..faa5fa230ab0 >> --- /dev/null >> +++ b/drivers/fpga/tests/Makefile >> @@ -0,0 +1,5 @@ >> +# SPDX-License-Identifier: GPL-2.0 >> + >> +obj-$(CONFIG_FPGA_KUNIT_TESTS) += fpga-mgr-test.o >> +obj-$(CONFIG_FPGA_KUNIT_TESTS) += fpga-bridge-test.o >> +obj-$(CONFIG_FPGA_KUNIT_TESTS) += fpga-region-test.o > > Could be integrated in one line? Yes. > > Thanks, > Yilun > >> -- >> 2.40.1 >> >
diff --git a/drivers/fpga/Kconfig b/drivers/fpga/Kconfig index 0a00763b9f28..2f689ac4ba3a 100644 --- a/drivers/fpga/Kconfig +++ b/drivers/fpga/Kconfig @@ -276,4 +276,6 @@ config FPGA_MGR_LATTICE_SYSCONFIG_SPI FPGA manager driver support for Lattice FPGAs programming over slave SPI sysCONFIG interface. +source "drivers/fpga/tests/Kconfig" + endif # FPGA diff --git a/drivers/fpga/Makefile b/drivers/fpga/Makefile index 72e554b4d2f7..352a2612623e 100644 --- a/drivers/fpga/Makefile +++ b/drivers/fpga/Makefile @@ -55,3 +55,6 @@ obj-$(CONFIG_FPGA_DFL_NIOS_INTEL_PAC_N3000) += dfl-n3000-nios.o # Drivers for FPGAs which implement DFL obj-$(CONFIG_FPGA_DFL_PCI) += dfl-pci.o + +# KUnit tests +obj-$(CONFIG_FPGA_KUNIT_TESTS) += tests/ diff --git a/drivers/fpga/tests/.kunitconfig b/drivers/fpga/tests/.kunitconfig new file mode 100644 index 000000000000..a1c2a2974c39 --- /dev/null +++ b/drivers/fpga/tests/.kunitconfig @@ -0,0 +1,5 @@ +CONFIG_KUNIT=y +CONFIG_FPGA=y +CONFIG_FPGA_REGION=y +CONFIG_FPGA_BRIDGE=y +CONFIG_FPGA_KUNIT_TESTS=y diff --git a/drivers/fpga/tests/Kconfig b/drivers/fpga/tests/Kconfig new file mode 100644 index 000000000000..e4a64815f16d --- /dev/null +++ b/drivers/fpga/tests/Kconfig @@ -0,0 +1,11 @@ +config FPGA_KUNIT_TESTS + tristate "KUnit test for the FPGA subsystem" if !KUNIT_ALL_TESTS + depends on FPGA && FPGA_REGION && FPGA_BRIDGE && KUNIT=y + default KUNIT_ALL_TESTS + help + This builds unit tests for the FPGA subsystem + + For more information on KUnit and unit tests in general, + please refer to the KUnit documentation in Documentation/dev-tools/kunit/. + + If unsure, say N. diff --git a/drivers/fpga/tests/Makefile b/drivers/fpga/tests/Makefile new file mode 100644 index 000000000000..faa5fa230ab0 --- /dev/null +++ b/drivers/fpga/tests/Makefile @@ -0,0 +1,5 @@ +# SPDX-License-Identifier: GPL-2.0 + +obj-$(CONFIG_FPGA_KUNIT_TESTS) += fpga-mgr-test.o +obj-$(CONFIG_FPGA_KUNIT_TESTS) += fpga-bridge-test.o +obj-$(CONFIG_FPGA_KUNIT_TESTS) += fpga-region-test.o
Add configuration for the KUnit test suites for the core components of the FPGA subsystem. Signed-off-by: Marco Pagani <marpagan@redhat.com> --- drivers/fpga/Kconfig | 2 ++ drivers/fpga/Makefile | 3 +++ drivers/fpga/tests/.kunitconfig | 5 +++++ drivers/fpga/tests/Kconfig | 11 +++++++++++ drivers/fpga/tests/Makefile | 5 +++++ 5 files changed, 26 insertions(+) create mode 100644 drivers/fpga/tests/.kunitconfig create mode 100644 drivers/fpga/tests/Kconfig create mode 100644 drivers/fpga/tests/Makefile