diff mbox series

[U-Boot,06/13] binman: Adjust size of test SPL binary

Message ID 20171114015506.25673-7-sjg@chromium.org
State Accepted
Commit f689890d8ec52c8b9d005fbf7f6df00dcf9895db
Delegated to: Simon Glass
Headers show
Series binman: Support run-time access to binman image positions | expand

Commit Message

Simon Glass Nov. 14, 2017, 1:54 a.m. UTC
This is only 3 bytes long which is not enough to hold two symbol values,
needed to test the binman symbols feature. Increase it to 15 bytes.

Using very small regions is useful since we can easily compare them in
tests and errors are fairly easy to diagnose.

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

 tools/binman/ftest.py                     | 12 ++++++------
 tools/binman/test/21_image_pad.dts        |  2 +-
 tools/binman/test/24_sorted.dts           |  4 ++--
 tools/binman/test/28_pack_4gb_outside.dts |  4 ++--
 tools/binman/test/29_x86-rom.dts          |  6 +++---
 5 files changed, 14 insertions(+), 14 deletions(-)

Comments

Simon Glass Dec. 8, 2017, 5:12 p.m. UTC | #1
This is only 3 bytes long which is not enough to hold two symbol values,
needed to test the binman symbols feature. Increase it to 15 bytes.

Using very small regions is useful since we can easily compare them in
tests and errors are fairly easy to diagnose.

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

 tools/binman/ftest.py                     | 12 ++++++------
 tools/binman/test/21_image_pad.dts        |  2 +-
 tools/binman/test/24_sorted.dts           |  4 ++--
 tools/binman/test/28_pack_4gb_outside.dts |  4 ++--
 tools/binman/test/29_x86-rom.dts          |  6 +++---
 5 files changed, 14 insertions(+), 14 deletions(-)

Applied to u-boot-dm thanks!
diff mbox series

Patch

diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py
index 590299da8bc..372b61fbb3b 100644
--- a/tools/binman/ftest.py
+++ b/tools/binman/ftest.py
@@ -28,7 +28,7 @@  import tout
 # Contents of test files, corresponding to different entry types
 U_BOOT_DATA           = '1234'
 U_BOOT_IMG_DATA       = 'img'
-U_BOOT_SPL_DATA       = '567'
+U_BOOT_SPL_DATA       = '56780123456789abcde'
 BLOB_DATA             = '89'
 ME_DATA               = '0abcd'
 VGA_DATA              = 'vga'
@@ -565,7 +565,7 @@  class TestFunctional(unittest.TestCase):
     def testImagePadByte(self):
         """Test that the image pad byte can be specified"""
         data = self._DoReadFile('21_image_pad.dts')
-        self.assertEqual(U_BOOT_SPL_DATA + (chr(0xff) * 9) + U_BOOT_DATA, data)
+        self.assertEqual(U_BOOT_SPL_DATA + (chr(0xff) * 1) + U_BOOT_DATA, data)
 
     def testImageName(self):
         """Test that image files can be named"""
@@ -587,7 +587,7 @@  class TestFunctional(unittest.TestCase):
     def testPackSorted(self):
         """Test that entries can be sorted"""
         data = self._DoReadFile('24_sorted.dts')
-        self.assertEqual(chr(0) * 5 + U_BOOT_SPL_DATA + chr(0) * 2 +
+        self.assertEqual(chr(0) * 1 + U_BOOT_SPL_DATA + chr(0) * 2 +
                          U_BOOT_DATA, data)
 
     def testPackZeroPosition(self):
@@ -615,14 +615,14 @@  class TestFunctional(unittest.TestCase):
         with self.assertRaises(ValueError) as e:
             self._DoTestFile('28_pack_4gb_outside.dts')
         self.assertIn("Node '/binman/u-boot': Position 0x0 (0) is outside "
-                      "the image starting at 0xfffffff0 (4294967280)",
+                      "the image starting at 0xffffffe0 (4294967264)",
                       str(e.exception))
 
     def testPackX86Rom(self):
         """Test that a basic x86 ROM can be created"""
         data = self._DoReadFile('29_x86-rom.dts')
-        self.assertEqual(U_BOOT_DATA + chr(0) * 3 + U_BOOT_SPL_DATA +
-                         chr(0) * 6, data)
+        self.assertEqual(U_BOOT_DATA + chr(0) * 7 + U_BOOT_SPL_DATA +
+                         chr(0) * 2, data)
 
     def testPackX86RomMeNoDesc(self):
         """Test that an invalid Intel descriptor entry is detected"""
diff --git a/tools/binman/test/21_image_pad.dts b/tools/binman/test/21_image_pad.dts
index daf8385f6d5..bf39dc1b6f7 100644
--- a/tools/binman/test/21_image_pad.dts
+++ b/tools/binman/test/21_image_pad.dts
@@ -10,7 +10,7 @@ 
 		};
 
 		u-boot {
-			pos = <12>;
+			pos = <20>;
 		};
 	};
 };
diff --git a/tools/binman/test/24_sorted.dts b/tools/binman/test/24_sorted.dts
index 9f4151c932b..43a7831341c 100644
--- a/tools/binman/test/24_sorted.dts
+++ b/tools/binman/test/24_sorted.dts
@@ -7,11 +7,11 @@ 
 	binman {
 		sort-by-pos;
 		u-boot {
-			pos = <10>;
+			pos = <22>;
 		};
 
 		u-boot-spl {
-			pos = <5>;
+			pos = <1>;
 		};
 	};
 };
diff --git a/tools/binman/test/28_pack_4gb_outside.dts b/tools/binman/test/28_pack_4gb_outside.dts
index ff468c7d41d..18d6bb5b8af 100644
--- a/tools/binman/test/28_pack_4gb_outside.dts
+++ b/tools/binman/test/28_pack_4gb_outside.dts
@@ -7,13 +7,13 @@ 
 	binman {
 		sort-by-pos;
 		end-at-4gb;
-		size = <16>;
+		size = <32>;
 		u-boot {
 			pos = <0>;
 		};
 
 		u-boot-spl {
-			pos = <0xfffffff7>;
+			pos = <0xffffffeb>;
 		};
 	};
 };
diff --git a/tools/binman/test/29_x86-rom.dts b/tools/binman/test/29_x86-rom.dts
index 075ede36ab3..d49078e19e2 100644
--- a/tools/binman/test/29_x86-rom.dts
+++ b/tools/binman/test/29_x86-rom.dts
@@ -7,13 +7,13 @@ 
 	binman {
 		sort-by-pos;
 		end-at-4gb;
-		size = <16>;
+		size = <32>;
 		u-boot {
-			pos = <0xfffffff0>;
+			pos = <0xffffffe0>;
 		};
 
 		u-boot-spl {
-			pos = <0xfffffff7>;
+			pos = <0xffffffeb>;
 		};
 	};
 };