diff options
author | Simon Glass <sjg@chromium.org> | 2019-08-24 07:22:54 -0600 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2019-10-15 08:40:02 -0600 |
commit | f514d8f23de4aada7e6f9f4d9de731b43912a77a (patch) | |
tree | a50719170ba87a13a437d145ea08cae932ba1cd6 /tools/binman/elf_test.py | |
parent | 53e22bf38c202d5ef3bc092d55095c672994a15b (diff) | |
download | u-boot-f514d8f23de4aada7e6f9f4d9de731b43912a77a.tar.gz |
binman: Use the Makefile for u_boot_ucode_ptr
Remove this file from git and instead build it using the Makefile.
Update tools.GetInputFilename() to support reading files from an absolute
path, so that we can read the Elf test files easily. Also make sure that
the temp directory is report in ELF tests as this was commented out.
Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'tools/binman/elf_test.py')
-rw-r--r-- | tools/binman/elf_test.py | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/tools/binman/elf_test.py b/tools/binman/elf_test.py index 736b931fd5..403ca2b412 100644 --- a/tools/binman/elf_test.py +++ b/tools/binman/elf_test.py @@ -75,18 +75,29 @@ def BuildElfTestFiles(target_dir): class TestElf(unittest.TestCase): @classmethod - def setUpClass(self): + def setUpClass(cls): + cls._indir = tempfile.mkdtemp(prefix='elf.') tools.SetInputDirs(['.']) + BuildElfTestFiles(cls._indir) + + @classmethod + def tearDownClass(cls): + if cls._indir: + shutil.rmtree(cls._indir) + + @classmethod + def ElfTestFile(cls, fname): + return os.path.join(cls._indir, fname) def testAllSymbols(self): """Test that we can obtain a symbol from the ELF file""" - fname = os.path.join(binman_dir, 'test', 'u_boot_ucode_ptr') + fname = self.ElfTestFile('u_boot_ucode_ptr') syms = elf.GetSymbols(fname, []) self.assertIn('.ucode', syms) def testRegexSymbols(self): """Test that we can obtain from the ELF file by regular expression""" - fname = os.path.join(binman_dir, 'test', 'u_boot_ucode_ptr') + fname = self.ElfTestFile('u_boot_ucode_ptr') syms = elf.GetSymbols(fname, ['ucode']) self.assertIn('.ucode', syms) syms = elf.GetSymbols(fname, ['missing']) @@ -201,7 +212,7 @@ class TestElf(unittest.TestCase): self.assertEqual(elf.ElfInfo(b'\0\0' + expected[2:], load, entry, len(expected)), elf.DecodeElf(data, load + 2)) - #shutil.rmtree(outdir) + shutil.rmtree(outdir) if __name__ == '__main__': |