diff options
author | Simon Glass <sjg@chromium.org> | 2016-11-25 20:15:51 -0700 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2016-12-20 08:09:55 +1300 |
commit | bf7fd50b3ba56b53dc13a681d19c845be903c3e0 (patch) | |
tree | b5f44c6c0ddc61fb68c243e5ed536064b168ec01 /tools/binman/fdt_test.py | |
parent | 0b4bc1b3ab1850fccbade3e6103f2036f6bdb364 (diff) | |
download | u-boot-bf7fd50b3ba56b53dc13a681d19c845be903c3e0.zip u-boot-bf7fd50b3ba56b53dc13a681d19c845be903c3e0.tar.gz u-boot-bf7fd50b3ba56b53dc13a681d19c845be903c3e0.tar.bz2 |
binman: Introduce binman, a tool for building binary images
This adds the basic code for binman, including command parsing, processing
of entries and generation of images.
So far no entry types are supported. These will be added in future commits
as examples of how to add new types.
See the README for documentation.
Signed-off-by: Simon Glass <sjg@chromium.org>
Tested-by: Bin Meng <bmeng.cn@gmail.com>
Diffstat (limited to 'tools/binman/fdt_test.py')
-rw-r--r-- | tools/binman/fdt_test.py | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/tools/binman/fdt_test.py b/tools/binman/fdt_test.py new file mode 100644 index 0000000..1d9494e --- /dev/null +++ b/tools/binman/fdt_test.py @@ -0,0 +1,48 @@ +# +# Copyright (c) 2016 Google, Inc +# Written by Simon Glass <sjg@chromium.org> +# +# SPDX-License-Identifier: GPL-2.0+ +# +# Test for the fdt modules + +import os +import sys +import tempfile +import unittest + +from fdt_select import FdtScan +import fdt_util +import tools + +class TestFdt(unittest.TestCase): + @classmethod + def setUpClass(self): + self._binman_dir = os.path.dirname(os.path.realpath(sys.argv[0])) + self._indir = tempfile.mkdtemp(prefix='binmant.') + tools.PrepareOutputDir(self._indir, True) + + def TestFile(self, fname): + return os.path.join(self._binman_dir, 'test', fname) + + def GetCompiled(self, fname): + return fdt_util.EnsureCompiled(self.TestFile(fname)) + + def _DeleteProp(self, fdt): + node = fdt.GetNode('/microcode/update@0') + node.DeleteProp('data') + + def testFdtNormal(self): + fname = self.GetCompiled('34_x86_ucode.dts') + fdt = FdtScan(fname) + self._DeleteProp(fdt) + + def testFdtFallback(self): + fname = self.GetCompiled('34_x86_ucode.dts') + fdt = FdtScan(fname, True) + fdt.GetProp('/microcode/update@0', 'data') + self.assertEqual('fred', + fdt.GetProp('/microcode/update@0', 'none', default='fred')) + self.assertEqual('12345678 12345679', + fdt.GetProp('/microcode/update@0', 'data', typespec='x')) + self._DeleteProp(fdt) |