clk: gate: Add some kunit test suites
Stephen Boyd
maintainerPATCH v3 1/1 clk: gate: Add some kunit test suites
Test various parts of the clk gate implementation with the kunit testing framework.
Reviewed-by Brendan Higgins <[email protected]>
Acked-by Daniel Latypov <[email protected]>
Cc <[email protected]>
Signed-off-by Stephen Boyd <[email protected]>
---
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
@@ -0,0 +1,3 @@ +CONFIG_KUNIT=y +CONFIG_COMMON_CLK=y +CONFIG_CLK_GATE_KUNIT_TEST=y
drivers/clk/Kconfig +8 -0
@@ -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
@@ -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
Quoting Stephen Boyd (2022-01-20 09:59:02)
Quoted 8 lines
Test various parts of the clk gate implementation with the kunit testing framework.
Reviewed-by Brendan Higgins <[email protected]>Acked-by Daniel Latypov <[email protected]>Cc <[email protected]>Signed-off-by Stephen Boyd <[email protected]>---
Applied to clk-next