Skip to contentSkip to conversation

software: node: test: add test to exercise parent child add/remove

RFC New Brendan Higgins 1 participant 1 message Apr 14, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

RFC 1/1 software: node: test: add test to exercise parent child add/remove

Add test which adds a tree of software_nodes, checks that the nodes exist, and then removes the tree. This exercises a bug reported by Naresh Kamboju <[email protected]>, and pretty much just takes a test case from the test_printf Kselftest module and refocusses it on adding and then removing a tree of software_nodes.

---

I am not sure if this should be rolled into the property entry test, or should be moved somewhere else; nevertheless, testing the software node API seems like a good idea and this seems like a good place to start.

---
 drivers/base/test/Kconfig              | 14 ++++++++
 drivers/base/test/Makefile             |  2 ++
 drivers/base/test/software-node-test.c | 46 ++++++++++++++++++++++++++
 3 files changed, 62 insertions(+)
 create mode 100644 drivers/base/test/software-node-test.c
drivers/base/test/Kconfig +14 -0
index 305c7751184a..b42f385fe233 100644
@@ -11,3 +11,17 @@ config TEST_ASYNC_DRIVER_PROBE
 config KUNIT_DRIVER_PE_TEST
 	bool "KUnit Tests for property entry API"
 	depends on KUNIT=y
+config KUNIT_DRIVER_SOFTWARE_NODE_TEST
+	bool "KUnit Tests for software node API"
+	depends on KUNIT=y
+	help
+	  This builds the software node API tests.
+
+	  KUnit tests run during boot and output the results to the debug log
+	  in TAP format (http://testanything.org/). Only useful for kernel devs
+	  and are not for inclusion into a production build.
+
+	  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.
drivers/base/test/Makefile +2 -0
index 3ca56367c84b..63325e8a5288 100644
@@ -2,3 +2,5 @@
 obj-$(CONFIG_TEST_ASYNC_DRIVER_PROBE)	+= test_async_driver_probe.o
 
 obj-$(CONFIG_KUNIT_DRIVER_PE_TEST) += property-entry-test.o
+
+obj-$(CONFIG_KUNIT_DRIVER_SOFTWARE_NODE_TEST) += software-node-test.o
drivers/base/test/software-node-test.c new file +46 -0

46 lines not on this page · raw message

base-commit: 8632e9b5645bbc2331d21d892b0d6961c1a08429

Signature · 1 line
2.26.0.110.g2183baf09c-goog