[U-Boot] [PATCH v2 6/8] test: check u-boot properties in SPL device tree

Patrick Delaunay patrick.delaunay at st.com
Mon May 20 13:00:05 UTC 2019


Add a test to check the management of the u-boot relocation properties
(fdtgrep result) for platdata generation or device tree SPL generation:
- 'dm-pre-proper' and 'dm-tpl' not included in SPL
- 'dm-pre-reloc' and 'dm-spl' included in SPL

This patch also executes the version test (test_000_version) to check
the correct start of the U-Boot after SPL execution.

Signed-off-by: Patrick Delaunay <patrick.delaunay at st.com>
---

Changes in v2:
- add some test for SPL with device tree

 arch/sandbox/dts/test.dts        | 18 ++++++++++++++
 test/py/tests/test_ofplatdata.py | 53 ++++++++++++++++++++++++++++++++++++++++
 test/run                         |  5 ++++
 3 files changed, 76 insertions(+)

diff --git a/arch/sandbox/dts/test.dts b/arch/sandbox/dts/test.dts
index 1ac86d7..2d5bea3 100644
--- a/arch/sandbox/dts/test.dts
+++ b/arch/sandbox/dts/test.dts
@@ -621,6 +621,24 @@
 		compatible = "sandbox,spl-test.2";
 	};
 
+	spl-test5 {
+		u-boot,dm-tpl;
+		compatible = "sandbox,spl-test";
+		stringarray = "tpl";
+	};
+
+	spl-test6 {
+		u-boot,dm-pre-proper;
+		compatible = "sandbox,spl-test";
+		stringarray = "pre-proper";
+	};
+
+	spl-test7 {
+		u-boot,dm-spl;
+		compatible = "sandbox,spl-test";
+		stringarray = "spl";
+	};
+
 	syscon0: syscon at 0 {
 		compatible = "sandbox,syscon0";
 		reg = <0x10 16>;
diff --git a/test/py/tests/test_ofplatdata.py b/test/py/tests/test_ofplatdata.py
index 98103ee..bdabc5a 100644
--- a/test/py/tests/test_ofplatdata.py
+++ b/test/py/tests/test_ofplatdata.py
@@ -31,6 +31,50 @@ intarray 0 0 0 0
 longbytearray 00 00 00 00 00 00 00 00 00
 string <NULL>
 stringarray "one" "" ""
+of-platdata probe:
+bool 0
+byte 00
+bytearray 00 00 00
+int 0
+intarray 0 0 0 0
+longbytearray 00 00 00 00 00 00 00 00 00
+string <NULL>
+stringarray "spl" "" ""
+'''
+
+OF_EMBEDDED_OUTPUT = '''
+	spl-test {
+		compatible = "sandbox,spl-test";
+		boolval;
+		intval = <0x00000001>;
+		intarray = <0x00000002 0x00000003 0x00000004>;
+		byteval = [05];
+		bytearray = [06];
+		longbytearray = [09 0a 0b 0c 0d 0e 0f 10 11];
+		stringval = "message";
+		stringarray = "multi-word", "message";
+	};
+	spl-test2 {
+		compatible = "sandbox,spl-test";
+		intval = <0x00000003>;
+		intarray = <0x00000005>;
+		byteval = [08];
+		bytearray = [01 23 34];
+		longbytearray = <0x090a0b0c>;
+		stringval = "message2";
+		stringarray = "another", "multi-word", "message";
+	};
+	spl-test3 {
+		compatible = "sandbox,spl-test";
+		stringarray = "one";
+	};
+	spl-test4 {
+		compatible = "sandbox,spl-test.2";
+	};
+	spl-test7 {
+		compatible = "sandbox,spl-test";
+		stringarray = "spl";
+	};
 '''
 
 @pytest.mark.buildconfigspec('spl_of_platdata')
@@ -40,3 +84,12 @@ def test_ofplatdata(u_boot_console):
     cons.restart_uboot_with_flags(['--show_of_platdata'])
     output = cons.get_spawn_output().replace('\r', '')
     assert OF_PLATDATA_OUTPUT in output
+
+ at pytest.mark.buildconfigspec('of_embed')
+ at pytest.mark.buildconfigspec('spl_of_libfdt')
+def test_ofembed(u_boot_console):
+    """Test that device-tree can be generated and used in sandbox spl"""
+    cons = u_boot_console
+    cons.restart_uboot_with_flags(['--show_of_embedded'])
+    output = cons.get_spawn_output().replace('\r', '')
+    assert OF_EMBEDDED_OUTPUT in output
diff --git a/test/run b/test/run
index 5aceed7..4702c4d 100755
--- a/test/run
+++ b/test/run
@@ -26,6 +26,11 @@ run_test "sandbox_spl" ./test/py/test.py --bd sandbox_spl --build \
 	--device-tree test \
 	-k 'test_000_version or test_ofplatdata or test_handoff'
 
+# Run tests which require sandbox_spl_dtb , with test.dtb device tree
+run_test "sandbox_spl_dtb" ./test/py/test.py --bd sandbox_spl_dtb --build \
+	--device-tree test \
+	-k 'test_000_version or test_ofplatdata'
+
 # Run tests for the flat-device-tree version of sandbox. This is a special
 # build which does not enable CONFIG_OF_LIVE for the live device tree, so we can
 # check that functionality is the same. The standard sandbox build (above) uses
-- 
2.7.4



More information about the U-Boot mailing list