[U-Boot,22/26] binman: Add a test for x86-start16-spl

Message ID 20171113045231.15911-23-sjg@chromium.org
State New
Delegated to: Simon Glass
Headers show
Series
  • test: Include Python tools in test coverage
Related show

Commit Message

Simon Glass Nov. 13, 2017, 4:52 a.m.
This allows us to put the 16-bit x86 start-up code in SPL. Add a test for
it.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 tools/binman/ftest.py                    | 10 +++++++++-
 tools/binman/test/48_x86-start16-spl.dts | 13 +++++++++++++
 2 files changed, 22 insertions(+), 1 deletion(-)
 create mode 100644 tools/binman/test/48_x86-start16-spl.dts

Patch

diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py
index 4e6aaad9d6b..c381a700311 100644
--- a/tools/binman/ftest.py
+++ b/tools/binman/ftest.py
@@ -34,6 +34,7 @@  ME_DATA             = '0abcd'
 VGA_DATA            = 'vga'
 U_BOOT_DTB_DATA     = 'udtb'
 X86_START16_DATA    = 'start16'
+X86_START16_SPL_DATA = 'start16spl'
 U_BOOT_NODTB_DATA   = 'nodtb with microcode pointer somewhere in here'
 FSP_DATA            = 'fsp'
 CMC_DATA            = 'cmc'
@@ -74,6 +75,8 @@  class TestFunctional(unittest.TestCase):
         TestFunctional._MakeInputFile('vga.bin', VGA_DATA)
         TestFunctional._MakeInputFile('u-boot.dtb', U_BOOT_DTB_DATA)
         TestFunctional._MakeInputFile('u-boot-x86-16bit.bin', X86_START16_DATA)
+        TestFunctional._MakeInputFile('spl/u-boot-x86-16bit-spl.bin',
+                                      X86_START16_SPL_DATA)
         TestFunctional._MakeInputFile('u-boot-nodtb.bin', U_BOOT_NODTB_DATA)
         TestFunctional._MakeInputFile('fsp.bin', FSP_DATA)
         TestFunctional._MakeInputFile('cmc.bin', CMC_DATA)
@@ -677,7 +680,7 @@  class TestFunctional(unittest.TestCase):
 
         # Check that the microcode appears immediately after the Fdt
         # This matches the concatenation of the data properties in
-        # the /microcode/update@xxx nodes in x86_ucode.dts.
+        # the /microcode/update@xxx nodes in 34_x86_ucode.dts.
         ucode_data = struct.pack('>4L', 0x12345678, 0x12345679, 0xabcd0000,
                                  0x78235609)
         self.assertEqual(ucode_data, third[:len(ucode_data)])
@@ -823,6 +826,11 @@  class TestFunctional(unittest.TestCase):
         data = self._DoReadFile('47_spl_bss_pad.dts')
         self.assertEqual(U_BOOT_SPL_DATA + (chr(0) * 10) + U_BOOT_DATA, data)
 
+    def testPackStart16Spl(self):
+        """Test that an image with an x86 start16 region can be created"""
+        data = self._DoReadFile('48_x86-start16-spl.dts')
+        self.assertEqual(X86_START16_SPL_DATA, data[:len(X86_START16_SPL_DATA)])
+
 
 if __name__ == "__main__":
     unittest.main()
diff --git a/tools/binman/test/48_x86-start16-spl.dts b/tools/binman/test/48_x86-start16-spl.dts
new file mode 100644
index 00000000000..e2009f15f05
--- /dev/null
+++ b/tools/binman/test/48_x86-start16-spl.dts
@@ -0,0 +1,13 @@ 
+/dts-v1/;
+
+/ {
+	#address-cells = <1>;
+	#size-cells = <1>;
+
+	binman {
+		size = <16>;
+
+		x86-start16-spl {
+		};
+	};
+};