Skip to contentSkip to conversation

clk: gate: Add some kunit test suites

PATCH Applied Stephen Boyd 1 participant 2 messages Jan 20, 2022 – Jan 25, 2022 Common clk

lore
Share & tools
lore

Stephen Boyd

author maintainer
#0 lore raw

PATCH v3 1/1 clk: gate: Add some kunit test suites

Test various parts of the clk gate implementation with the kunit testing framework.

---

Changes from v2 (https://lore.kernel.org/r/[email protected]):
* Drop some kfree()s that duplicate test managed free

Changes from v1 (https://lore.kernel.org/r/[email protected]):
* Changed file name to semi-match convention
* Changed Kconfig symbol name to match convention
* Changed kzalloc to test managed allocation
* Inlined check for ret where possible

 drivers/clk/.kunitconfig    |   3 +
 drivers/clk/Kconfig         |   8 +
 drivers/clk/Makefile        |   1 +
 drivers/clk/clk-gate_test.c | 464 ++++++++++++++++++++++++++++++++++++
 4 files changed, 476 insertions(+)
 create mode 100644 drivers/clk/.kunitconfig
 create mode 100644 drivers/clk/clk-gate_test.c
drivers/clk/.kunitconfig new file +3 -0
new file mode 100644
index 000000000000..3754fdb9485a
@@ -0,0 +1,3 @@
+CONFIG_KUNIT=y
+CONFIG_COMMON_CLK=y
+CONFIG_CLK_GATE_KUNIT_TEST=y
drivers/clk/Kconfig +8 -0
index c5b3dc97396a..947cd0b12dbd 100644
@@ -421,4 +421,12 @@ source "drivers/clk/x86/Kconfig"
 source "drivers/clk/xilinx/Kconfig"
 source "drivers/clk/zynqmp/Kconfig"
 
+# Kunit test cases
+config CLK_GATE_KUNIT_TEST
+	tristate "Basic gate type Kunit test" if !KUNIT_ALL_TESTS
+	depends on KUNIT
+	default KUNIT_ALL_TESTS
+	help
+	  Kunit test for the basic clk gate type.
+
 endif
drivers/clk/Makefile +1 -0
index e42312121e51..52faef37bc9b 100644
@@ -6,6 +6,7 @@ obj-$(CONFIG_COMMON_CLK)	+= clk-divider.o
 obj-$(CONFIG_COMMON_CLK)	+= clk-fixed-factor.o
 obj-$(CONFIG_COMMON_CLK)	+= clk-fixed-rate.o
 obj-$(CONFIG_COMMON_CLK)	+= clk-gate.o
+obj-$(CONFIG_CLK_GATE_KUNIT_TEST) += clk-gate_test.o
 obj-$(CONFIG_COMMON_CLK)	+= clk-multiplier.o
 obj-$(CONFIG_COMMON_CLK)	+= clk-mux.o
 obj-$(CONFIG_COMMON_CLK)	+= clk-composite.o
drivers/clk/clk-gate_test.c new file +464 -0

464 lines not on this page · raw message

base-commit: fa55b7dcdc43c1aa1ba12bca9d2dd4318c2a0dbf

Signature · 2 lines
https://git.kernel.org/pub/scm/linux/kernel/git/clk/linux.git/
https://git.kernel.org/pub/scm/linux/kernel/git/sboyd/spmi.git