summaryrefslogtreecommitdiff
path: root/tools/binman/ftest.py
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2023-02-22 12:14:49 -0700
committerSimon Glass <sjg@chromium.org>2023-03-08 11:40:49 -0800
commitfe7e9245c53e254526d3bbd6296d658596f41b48 (patch)
tree3cb3fbeec2d4b0a0e0735a9ccd5e35725df9a006 /tools/binman/ftest.py
parent932e40d0b52242454be9a7773bd2323e12358b92 (diff)
binman: Make the tooldir configurable
Add a command-line argument for setting the tooldir, so that the default can be overridden. Add this directory to the toolpath automatically. Create the directory if it does not already exist. Put the default in the argument parser instead of the class, so that it is more obvious. Update a few tests that expect the utility name to be provided without any path (e.g. 'futility'), so they can accept a path, e.g. /path/to/futility Update the documentation and add a few tests. Improve the help for --toolpath while we are here. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'tools/binman/ftest.py')
-rw-r--r--tools/binman/ftest.py21
1 files changed, 19 insertions, 2 deletions
diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py
index df916ed602a..0b3bca90c8c 100644
--- a/tools/binman/ftest.py
+++ b/tools/binman/ftest.py
@@ -1750,7 +1750,7 @@ class TestFunctional(unittest.TestCase):
def _HandleGbbCommand(self, pipe_list):
"""Fake calls to the futility utility"""
- if pipe_list[0][0] == 'futility':
+ if 'futility' in pipe_list[0][0]:
fname = pipe_list[0][-1]
# Append our GBB data to the file, which will happen every time the
# futility command is called.
@@ -1812,7 +1812,7 @@ class TestFunctional(unittest.TestCase):
self._hash_data is False, it writes VBLOCK_DATA, else it writes a hash
of the input data (here, 'input.vblock').
"""
- if pipe_list[0][0] == 'futility':
+ if 'futility' in pipe_list[0][0]:
fname = pipe_list[0][3]
with open(fname, 'wb') as fd:
if self._hash_data:
@@ -6386,6 +6386,23 @@ fdt fdtmap Extract the devicetree blob from the fdtmap
self.assertEqual(['u-boot', 'atf-2'],
fdt_util.GetStringList(node, 'loadables'))
+ def testTooldir(self):
+ """Test that we can specify the tooldir"""
+ with test_util.capture_sys_output() as (stdout, stderr):
+ self.assertEqual(0, self._DoBinman('--tooldir', 'fred',
+ 'tool', '-l'))
+ self.assertEqual('fred', bintool.Bintool.tooldir)
+
+ # Check that the toolpath is updated correctly
+ self.assertEqual(['fred'], tools.tool_search_paths)
+
+ # Try with a few toolpaths; the tooldir should be at the end
+ with test_util.capture_sys_output() as (stdout, stderr):
+ self.assertEqual(0, self._DoBinman(
+ '--toolpath', 'mary', '--toolpath', 'anna', '--tooldir', 'fred',
+ 'tool', '-l'))
+ self.assertEqual(['mary', 'anna', 'fred'], tools.tool_search_paths)
+
if __name__ == "__main__":
unittest.main()