]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
binman: Allow control of whether a fake DT is used
authorSimon Glass <sjg@chromium.org>
Fri, 14 Sep 2018 10:57:23 +0000 (04:57 -0600)
committerSimon Glass <sjg@chromium.org>
Fri, 28 Sep 2018 17:09:01 +0000 (11:09 -0600)
We use a fake device tree in tests most of the time since tests don't
normally care about the actual data. For example, for U-Boot proper we use
U_BOOT_DTB_DATA which is just a four-character string. This makes testing
the image output against an expected value very easy.

However in some cases, such as when the test wants to check that the DT
output containing particular nodes, we do actually need the real DT. Add
support for this, along with a command-line option to select 'test mode'.

Signed-off-by: Simon Glass <sjg@chromium.org>
tools/binman/cmdline.py
tools/binman/control.py
tools/binman/ftest.py
tools/binman/state.py

index 4ce8bc6ab4395c0ea4b437b71123bab231cd51ea..f8caa7d28419ebaf29d091b40bafc3a21e75d078 100644 (file)
@@ -30,6 +30,8 @@ def ParseArgs(argv):
             help='Enabling debugging (provides a full traceback on error)')
     parser.add_option('-E', '--entry-docs', action='store_true',
             help='Write out entry documentation (see README.entries)')
+    parser.add_option('--fake-dtb', action='store_true',
+            help='Use fake device tree contents (for testing only)')
     parser.add_option('-i', '--image', type='string', action='append',
             help='Image filename to build (if not specified, build all)')
     parser.add_option('-I', '--indir', action='append',
index 49d49a001c703e3c7d569c8dbb9b541c31bf72bf..34ec74ba1b30079d7a7a32c609a7104365075d07 100644 (file)
@@ -106,6 +106,7 @@ def Binman(options, args):
 
         tout.Init(options.verbosity)
         elf.debug = options.debug
+        state.use_fake_dtb = options.fake_dtb
         try:
             tools.SetInputDirs(options.indir)
             tools.PrepareOutputDir(options.outdir, options.preserve)
index 867179702d965781f18b81e8260d22d8682bc813..75e9a2143cad02139ade6474fea692c700ee1cbe 100644 (file)
@@ -172,7 +172,7 @@ class TestFunctional(unittest.TestCase):
         return control.Binman(options, args)
 
     def _DoTestFile(self, fname, debug=False, map=False, update_dtb=False,
-                    entry_args=None, images=None):
+                    entry_args=None, images=None, use_real_dtb=False):
         """Run binman with a given test file
 
         Args:
@@ -193,6 +193,8 @@ class TestFunctional(unittest.TestCase):
             args.append('-m')
         if update_dtb:
             args.append('-up')
+        if not use_real_dtb:
+            args.append('--fake-dtb')
         if entry_args:
             for arg, value in entry_args.iteritems():
                 args.append('-a%s=%s' % (arg, value))
index 600eb86cfe26eaf5f35a090543b20cd9c51bbe76..b27eb077a6124086eb25708ab5428d0416b3833b 100644 (file)
@@ -20,7 +20,7 @@ entry_args = {}
 
 # True to use fake device-tree files for testing (see U_BOOT_DTB_DATA in
 # ftest.py)
-use_fake_dtb = True
+use_fake_dtb = False
 
 # Set of all device tree files references by images
 fdt_set = Set()