diff options
author | Simon Glass <sjg@chromium.org> | 2019-08-24 07:22:53 -0600 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2019-10-15 08:40:02 -0600 |
commit | 53e22bf38c202d5ef3bc092d55095c672994a15b (patch) | |
tree | e147ce74f9452e82c14c1006f134f314f3f2d65f /tools/binman/ftest.py | |
parent | 180f556b090c2e3c84c904d3e6bc884acb423e1f (diff) |
binman: Use the Makefile to build ELF test files
At present the ELF test files are checked into the U-Boot tree. This is
covenient since the files never change and can be used on non-x86
platforms. However it is not good practice to check in binaries and in
this case it does not seem essential.
Update the binman test-file Makefile to support having source in a
different directory. Adjust binman to run it to build bss_data, as a
start. We can add other files as needed.
Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'tools/binman/ftest.py')
-rw-r--r-- | tools/binman/ftest.py | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py index bba07e72758..fad62bb04fc 100644 --- a/tools/binman/ftest.py +++ b/tools/binman/ftest.py @@ -23,6 +23,7 @@ import cmdline import command import control import elf +import elf_test import fdt from etype import fdtmap from etype import image_header @@ -147,6 +148,9 @@ class TestFunctional(unittest.TestCase): TestFunctional._MakeInputFile('bmpblk.bin', BMPBLK_DATA) TestFunctional._MakeInputFile('refcode.bin', REFCODE_DATA) + cls._elf_testdir = os.path.join(cls._indir, 'elftest') + elf_test.BuildElfTestFiles(cls._elf_testdir) + # ELF file with a '_dt_ucode_base_size' symbol with open(cls.TestFile('u_boot_ucode_ptr'), 'rb') as fd: TestFunctional._MakeInputFile('u-boot', fd.read()) @@ -484,13 +488,21 @@ class TestFunctional(unittest.TestCase): Args: Filename of ELF file to use as SPL """ - with open(cls.TestFile(src_fname), 'rb') as fd: - TestFunctional._MakeInputFile('spl/u-boot-spl', fd.read()) + # TODO(sjg@chromium.org): Drop this when all Elf files use ElfTestFile() + if src_fname in ['bss_data']: + fname = cls.ElfTestFile(src_fname) + else: + fname = cls.TestFile(src_fname) + TestFunctional._MakeInputFile('spl/u-boot-spl', tools.ReadFile(fname)) @classmethod def TestFile(cls, fname): return os.path.join(cls._binman_dir, 'test', fname) + @classmethod + def ElfTestFile(cls, fname): + return os.path.join(cls._elf_testdir, fname) + def AssertInList(self, grep_list, target): """Assert that at least one of a list of things is in a target @@ -1551,7 +1563,7 @@ class TestFunctional(unittest.TestCase): def testTpl(self): """Test that an image with TPL and ots device tree can be created""" # ELF file with a '__bss_size' symbol - with open(self.TestFile('bss_data'), 'rb') as fd: + with open(self.ElfTestFile('bss_data'), 'rb') as fd: TestFunctional._MakeInputFile('tpl/u-boot-tpl', fd.read()) data = self._DoReadFile('078_u_boot_tpl.dts') self.assertEqual(U_BOOT_TPL_DATA + U_BOOT_TPL_DTB_DATA, data) @@ -1861,16 +1873,16 @@ class TestFunctional(unittest.TestCase): def testElf(self): """Basic test of ELF entries""" self._SetupSplElf() - with open(self.TestFile('bss_data'), 'rb') as fd: + with open(self.ElfTestFile('bss_data'), 'rb') as fd: TestFunctional._MakeInputFile('tpl/u-boot-tpl', fd.read()) - with open(self.TestFile('bss_data'), 'rb') as fd: + with open(self.ElfTestFile('bss_data'), 'rb') as fd: TestFunctional._MakeInputFile('-boot', fd.read()) data = self._DoReadFile('096_elf.dts') def testElfStrip(self): """Basic test of ELF entries""" self._SetupSplElf() - with open(self.TestFile('bss_data'), 'rb') as fd: + with open(self.ElfTestFile('bss_data'), 'rb') as fd: TestFunctional._MakeInputFile('-boot', fd.read()) data = self._DoReadFile('097_elf_strip.dts') |