From bf7fd50b3ba56b53dc13a681d19c845be903c3e0 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Fri, 25 Nov 2016 20:15:51 -0700 Subject: 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 Tested-by: Bin Meng --- tools/binman/fdt_test.py | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 tools/binman/fdt_test.py (limited to 'tools/binman/fdt_test.py') diff --git a/tools/binman/fdt_test.py b/tools/binman/fdt_test.py new file mode 100644 index 0000000000..1d9494e52f --- /dev/null +++ b/tools/binman/fdt_test.py @@ -0,0 +1,48 @@ +# +# Copyright (c) 2016 Google, Inc +# Written by Simon Glass +# +# 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) -- cgit