Skip to content

Commit

Permalink
regmap: Add some basic kunit tests
Browse files Browse the repository at this point in the history
On the theory that it's better to make a start let's add some KUnit tests
for regmap. Currently this is a bit of a mess but it passes and hopefully
will at some point help catch problems. We provide very basic cover for
most of the core functionality that operates at the register level,
repeating each test for each cache type in order to exercise the caches.
There is no coverage of anything to do with the bulk operations at the bus
level or formatting for byte stream buses yet.

Each test creates it's own regmap since the cache structures are built
incrementally, meaning we gain coverage from the different access
patterns, and some of the tests cover different init scenarios.

Signed-off-by: Mark Brown <broonie@kernel.org>
Link: https://lore.kernel.org/r/20230324-regmap-kunit-v2-2-b208801dc2c8@kernel.org
  • Loading branch information
broonie committed Mar 30, 2023
1 parent f635242 commit 2238959
Show file tree
Hide file tree
Showing 3 changed files with 744 additions and 0 deletions.
7 changes: 7 additions & 0 deletions drivers/base/regmap/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,13 @@ config REGMAP
select MDIO_BUS if REGMAP_MDIO
bool

config REGMAP_KUNIT
tristate "KUnit tests for regmap"
depends on KUNIT
default KUNIT_ALL_TESTS
select REGMAP
select REGMAP_RAM

config REGMAP_AC97
tristate

Expand Down
1 change: 1 addition & 0 deletions drivers/base/regmap/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ CFLAGS_regmap.o := -I$(src)
obj-$(CONFIG_REGMAP) += regmap.o regcache.o
obj-$(CONFIG_REGMAP) += regcache-rbtree.o regcache-flat.o
obj-$(CONFIG_DEBUG_FS) += regmap-debugfs.o
obj-$(CONFIG_REGMAP_KUNIT) += regmap-kunit.o
obj-$(CONFIG_REGMAP_AC97) += regmap-ac97.o
obj-$(CONFIG_REGMAP_I2C) += regmap-i2c.o
obj-$(CONFIG_REGMAP_RAM) += regmap-ram.o
Expand Down
Loading

0 comments on commit 2238959

Please sign in to comment.