Skip to contentSkip to conversation

interconnect: Add kunit tests for core functionality

PATCH New Kuan-Wei Chiu 1 participant 1 message Jan 10

Subsystems (2)
lore
Share & tools
lore

Kuan-Wei Chiu

author maintainer
#0 lore raw

PATCH v2 1/1 interconnect: Add kunit tests for core functionality

The interconnect framework currently lacks in-tree unit tests to verify the core logic in isolation. This makes it difficult to validate regression stability when modifying the provider/consumer APIs or aggregation logic.

Introduce a kunit test suite that verifies the fundamental behavior of the subsystem. The tests cover:
- Provider API (node creation, linking, topology construction).
- Consumer API (path enabling/disabling, bandwidth requests).
- Standard aggregation logic (accumulating bandwidth across links).
- Bulk operations for setting bandwidth on multiple paths.

The suite simulates a simple SoC topology with multiple masters and a shared bus to validate traffic aggregation behavior in a controlled software environment, without requiring specific hardware or Device Tree support.

---
Changes in v2:
- Switch to 0-based node IDs to avoid sparse array usage.
- Implement .get_bw callback to ensure zero initial bandwidth.

 drivers/interconnect/Kconfig     |  14 ++
 drivers/interconnect/Makefile    |   2 +
 drivers/interconnect/icc-kunit.c | 324 +++++++++++++++++++++++++++++++
 3 files changed, 340 insertions(+)
 create mode 100644 drivers/interconnect/icc-kunit.c
drivers/interconnect/Kconfig +14 -0
index f2e49bd97d31..882dcb0b4a5b 100644
@@ -22,4 +22,18 @@ config INTERCONNECT_CLK
 	help
 	  Support for wrapping clocks into the interconnect nodes.
 
+config INTERCONNECT_KUNIT_TEST
+	tristate "KUnit tests for Interconnect framework"
+	depends on KUNIT
+	default KUNIT_ALL_TESTS
+	help
+	  This builds the KUnit test suite for the generic system interconnect
+	  framework.
+
+	  The tests cover the core functionality of the interconnect subsystem,
+	  including provider/consumer APIs, topology management, and bandwidth
+	  aggregation logic.
+
+	  If unsure, say N.
+
 endif
drivers/interconnect/Makefile +2 -0
index b0a9a6753b9d..dc4c7b657c9d 100644
@@ -10,3 +10,5 @@ obj-$(CONFIG_INTERCONNECT_QCOM)		+= qcom/
 obj-$(CONFIG_INTERCONNECT_SAMSUNG)	+= samsung/
 
 obj-$(CONFIG_INTERCONNECT_CLK)		+= icc-clk.o
+
+obj-$(CONFIG_INTERCONNECT_KUNIT_TEST) += icc-kunit.o
drivers/interconnect/icc-kunit.c new file +324 -0

324 lines not on this page · raw message

Signature · 1 line
2.52.0.457.g6b5491de43-goog