Skip to contentSkip to conversation

of: unittest: unflatten device tree on UML when testing

PATCH Superseded Brendan Higgins 2 participants 4 messages Feb 16, 2019 – Feb 19, 2019 Device tree

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 of: unittest: unflatten device tree on UML when testing

UML supports enabling OF, and is useful for running the device tree tests, so add support for unflattening device tree blobs so we can actually use it.

---
 drivers/of/unittest.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/of/unittest.c +3 -0
index 84427384654d5..6de34d5fa0e85 100644
@@ -2527,6 +2527,9 @@ static int __init of_unittest(void)
 	}
 	of_node_put(np);
 
+	if (IS_ENABLED(CONFIG_UML))
+		unittest_unflatten_overlay_base();
+
 	pr_info("start of unittest - you will see error messages\n");
 	of_unittest_check_tree_linkage();
 	of_unittest_check_phandles();
Signature · 1 line
2.21.0.rc0.258.g878e2cd30e-goog
#1 lore raw
Quoted 14 lines · Brendan Higgins

UML supports enabling OF, and is useful for running the device tree tests, so add support for unflattening device tree blobs so we can actually use it.

---
 drivers/of/unittest.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/of/unittest.c +0 -0
index 84427384654d5..6de34d5fa0e85 100644

drivers/of/unittest.c static int __init of_unittest(void) · line 2532

Quoted 6 lines
drivers/of/unittest.c +3 -0
@@ -2527,6 +2527,9 @@ static int __init of_unittest(void)
 	}
 	of_node_put(np);
 
+	if (IS_ENABLED(CONFIG_UML))
+		unittest_unflatten_overlay_base();
+

This is still the wrong location. It should be at the top of the function.

I'll try moving it to the top and see if it still works -- should only take me a few minutes.

-Frank

Quoted 4 lines
drivers/of/unittest.c +0 -0
 	pr_info("start of unittest - you will see error messages\n");
 	of_unittest_check_tree_linkage();
 	of_unittest_check_phandles();
#2 lore raw
Quoted 18 lines · Frank Rowand
Quoted 17 lines · Brendan Higgins

UML supports enabling OF, and is useful for running the device tree tests, so add support for unflattening device tree blobs so we can actually use it.

---
 drivers/of/unittest.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/of/unittest.c +0 -0
index 84427384654d5..6de34d5fa0e85 100644
@@ -2527,6 +2527,9 @@ static int __init of_unittest(void)
 	}
 	of_node_put(np);
 
Quoted 8 lines

drivers/of/unittest.c static int __init of_unittest(void) · line 2532

Quoted 3 lines
drivers/of/unittest.c +3 -0
+	if (IS_ENABLED(CONFIG_UML))
+		unittest_unflatten_overlay_base();
+

This is still the wrong location. It should be at the top of the function.

I'll try moving it to the top and see if it still works -- should only take me a few minutes.

Yep, see below.

Quoted 8 lines

-Frank

Quoted 4 lines
drivers/of/unittest.c +0 -0
 	pr_info("start of unittest - you will see error messages\n");
 	of_unittest_check_tree_linkage();
 	of_unittest_check_phandles();

This is probably white space damaged because I used cut and paste, but this is what I meant above.

Tested on 5.0-rc3.

Applied patches 1-14 of series:

[RFC v4 00/17] kunit: introduce KUnit, the Linux kernel unit testing framework

booted uml, saw the expected 219 pass, 1 fail.

Applied the following patch, saw the expected 224 pass, 0 fail.

I did not apply patch 15 of the other series, but applying patch 15 should still result in errors on boot, as I reported in the mail thread for that patch series.

---
 drivers/of/unittest.c |    4 ++++
 1 file changed, 4 insertions(+)
drivers/of/unittest.c +4 -0
Index: b/drivers/of/unittest.c
===================================================================
@@ -2514,6 +2514,10 @@ static int __init of_unittest(void)
 	int res;
 
 	/* adding data for unittest */
+
+	if (IS_ENABLED(CONFIG_UML))
+		unittest_unflatten_overlay_base();
+
 	res = unittest_data_add();
 	if (res)
 		return res;
#3 lore raw
Quoted 20 lines · Frank Rowand
Quoted 18 lines · Frank Rowand
Quoted 17 lines · Brendan Higgins

UML supports enabling OF, and is useful for running the device tree tests, so add support for unflattening device tree blobs so we can actually use it.

---
 drivers/of/unittest.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/of/unittest.c +0 -0
index 84427384654d5..6de34d5fa0e85 100644
@@ -2527,6 +2527,9 @@ static int __init of_unittest(void)
     }
     of_node_put(np);
 
Quoted 5 lines
Quoted 5 lines

drivers/of/unittest.c static int __init of_unittest(void) · line 2520

Quoted 3 lines
drivers/of/unittest.c +3 -0
+    if (IS_ENABLED(CONFIG_UML))
+            unittest_unflatten_overlay_base();
+

This is still the wrong location. It should be at the top of the function.

Oh sorry, I figured since this only sets up the overlay_base that the dependency order didn't matter. I will send an updated patch shortly.

Quoted 25 lines
Quoted 3 lines

I'll try moving it to the top and see if it still works -- should only take me a few minutes.

Yep, see below.

Quoted 8 lines

-Frank

Quoted 4 lines
drivers/of/unittest.c +0 -0
     pr_info("start of unittest - you will see error messages\n");
     of_unittest_check_tree_linkage();
     of_unittest_check_phandles();

This is probably white space damaged because I used cut and paste, but this is what I meant above.

Tested on 5.0-rc3.

Applied patches 1-14 of series:

[RFC v4 00/17] kunit: introduce KUnit, the Linux kernel unit testing framework

Quoted 7 lines

booted uml, saw the expected 219 pass, 1 fail.

Applied the following patch, saw the expected 224 pass, 0 fail.

I did not apply patch 15 of the other series, but applying patch 15 should still result in errors on boot, as I reported in the mail thread for that patch series.

Sure, I will address that there.

Thanks!