diff options
author | Tom Rini <trini@konsulko.com> | 2020-09-25 09:04:01 -0400 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2020-09-25 09:04:01 -0400 |
commit | 0ac83d080a0044cd0d8f782ba12f02cf969d3004 (patch) | |
tree | ca5c2351113ba9b56d59e241a8857c7e6e8f5604 /tools/binman/ftest.py | |
parent | 67ece26d8b5d4bfa4fda8c456261c465d0815d7d (diff) | |
parent | 8c180d669a0f4a8eb70bde8c74c73cef45993f67 (diff) |
Merge branch 'next' of https://gitlab.denx.de/u-boot/custodians/u-boot-x86 into next
- Enhance the 'zboot' command to be more like 'bootm' with sub-commands
- The last series of ACPI core changes for programmatic generation of
ACPI tables
- Add all required ACPI tables for ApolloLake and enable ACPIGEN on
Chromebook Coral
- A feature minor enhancements to the 'hob' command
- Intel edison: Support for writing an xFSTK image via binman
Diffstat (limited to 'tools/binman/ftest.py')
-rw-r--r-- | tools/binman/ftest.py | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py index 95b17d0b749..b771b9d5df7 100644 --- a/tools/binman/ftest.py +++ b/tools/binman/ftest.py @@ -77,6 +77,7 @@ FSP_T_DATA = b'fsp_t' ATF_BL31_DATA = b'bl31' TEST_FDT1_DATA = b'fdt1' TEST_FDT2_DATA = b'test-fdt2' +ENV_DATA = b'var1=1\nvar2="2"' # Subdirectory of the input dir to use to put test FDTs TEST_FDT_SUBDIR = 'fdts' @@ -181,6 +182,8 @@ class TestFunctional(unittest.TestCase): TestFunctional._MakeInputFile('%s/test-fdt2.dtb' % TEST_FDT_SUBDIR, TEST_FDT2_DATA) + TestFunctional._MakeInputFile('env.txt', ENV_DATA) + # Travis-CI may have an old lz4 cls.have_lz4 = True try: @@ -3708,5 +3711,40 @@ class TestFunctional(unittest.TestCase): self.assertIn('Wibble test', err) self.assertIn('Another test', err) + def testMissingBlob(self): + """Test handling of a blob containing a missing file""" + with self.assertRaises(ValueError) as e: + self._DoTestFile('173_missing_blob.dts', allow_missing=True) + self.assertIn("Filename 'missing' not found in input path", + str(e.exception)) + + def testEnvironment(self): + """Test adding a U-Boot environment""" + data = self._DoReadFile('174_env.dts') + self.assertEqual(U_BOOT_DATA, data[:len(U_BOOT_DATA)]) + self.assertEqual(U_BOOT_NODTB_DATA, data[-len(U_BOOT_NODTB_DATA):]) + env = data[len(U_BOOT_DATA):-len(U_BOOT_NODTB_DATA)] + self.assertEqual(b'\x1b\x97\x22\x7c\x01var1=1\0var2="2"\0\0\xff\xff', + env) + + def testEnvironmentNoSize(self): + """Test that a missing 'size' property is detected""" + with self.assertRaises(ValueError) as e: + data = self._DoTestFile('175_env_no_size.dts') + self.assertIn("'u-boot-env' entry must have a size property", + str(e.exception)) + + def testEnvironmentTooSmall(self): + """Test handling of an environment that does not fit""" + with self.assertRaises(ValueError) as e: + data = self._DoTestFile('176_env_too_small.dts') + + # checksum, start byte, environment with \0 terminator, final \0 + need = 4 + 1 + len(ENV_DATA) + 1 + 1 + short = need - 0x8 + self.assertIn("too small to hold data (need %#x more bytes)" % short, + str(e.exception)) + + if __name__ == "__main__": unittest.main() |