[PATCH v2 2/7] of: unittest: Add a test case for API of_find_node_opts_by_path()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Zijun Hu <quic_zijuhu@xxxxxxxxxxx>

To test of_find_node_opts_by_path() take @path argument with pattern:

"alias-name/node-name-1/.../node-name-N:options", for example:
"testcase-alias/phandle-tests/consumer-a:testaliasoption"

Signed-off-by: Zijun Hu <quic_zijuhu@xxxxxxxxxxx>
---
 drivers/of/unittest.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/of/unittest.c b/drivers/of/unittest.c
index daf9a2dddd7e0dbc680f708496b6dce6d23999cf..ed343509505f536436f8457bd200ccc323acffdf 100644
--- a/drivers/of/unittest.c
+++ b/drivers/of/unittest.c
@@ -161,6 +161,15 @@ static void __init of_unittest_find_node_by_name(void)
 		 "option alias path test, subcase #1 failed\n");
 	of_node_put(np);
 
+	np = of_find_node_opts_by_path("testcase-alias/phandle-tests/consumer-a:testaliasoption",
+				       &options);
+	name = kasprintf(GFP_KERNEL, "%pOF", np);
+	unittest(np && name && !strcmp("/testcase-data/phandle-tests/consumer-a", name) &&
+		 !strcmp("testaliasoption", options),
+		 "option alias path test, subcase #2 failed\n");
+	of_node_put(np);
+	kfree(name);
+
 	np = of_find_node_opts_by_path("testcase-alias:testaliasoption", NULL);
 	unittest(np, "NULL option alias path test failed\n");
 	of_node_put(np);

-- 
2.34.1





[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux