summaryrefslogtreecommitdiff
path: root/tools/binman/ftest.py
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2017-11-13 18:55:00 -0700
committerSimon Glass <sjg@chromium.org>2017-12-12 19:53:45 -0700
commit7fe9173be78f32047bc38f2d68ac86e871dbfcae (patch)
tree052690b3852f6cac6759de653cecb6659d268127 /tools/binman/ftest.py
parentf689890d8ec52c8b9d005fbf7f6df00dcf9895db (diff)
binman: Support enabling debug in tests
The elf module can provide some debugging information to assist with figuring out what is going wrong. This is also useful in tests. Update the -D option so that it is passed through to tests as well. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'tools/binman/ftest.py')
-rw-r--r--tools/binman/ftest.py17
1 files changed, 13 insertions, 4 deletions
diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py
index 372b61fbb3..2bee6a168f 100644
--- a/tools/binman/ftest.py
+++ b/tools/binman/ftest.py
@@ -136,7 +136,10 @@ class TestFunctional(unittest.TestCase):
Returns:
Return value (0 for success)
"""
- (options, args) = cmdline.ParseArgs(list(args))
+ args = list(args)
+ if '-D' in sys.argv:
+ args = args + ['-D']
+ (options, args) = cmdline.ParseArgs(args)
options.pager = 'binman-invalid-pager'
options.build_dir = self._indir
@@ -144,14 +147,16 @@ class TestFunctional(unittest.TestCase):
# options.verbosity = tout.DEBUG
return control.Binman(options, args)
- def _DoTestFile(self, fname):
+ def _DoTestFile(self, fname, debug=False):
"""Run binman with a given test file
Args:
fname: Device tree source filename to use (e.g. 05_simple.dts)
"""
- return self._DoBinman('-p', '-I', self._indir,
- '-d', self.TestFile(fname))
+ args = ['-p', '-I', self._indir, '-d', self.TestFile(fname)]
+ if debug:
+ args.append('-D')
+ return self._DoBinman(*args)
def _SetupDtb(self, fname, outfile='u-boot.dtb'):
"""Set up a new test device-tree file
@@ -363,6 +368,10 @@ class TestFunctional(unittest.TestCase):
data = self._DoReadFile('05_simple.dts')
self.assertEqual(U_BOOT_DATA, data)
+ def testSimpleDebug(self):
+ """Test a simple binman run with debugging enabled"""
+ data = self._DoTestFile('05_simple.dts', debug=True)
+
def testDual(self):
"""Test that we can handle creating two images