summaryrefslogtreecommitdiff
path: root/tools/binman/ftest.py
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2022-01-09 20:14:11 -0700
committerSimon Glass <sjg@chromium.org>2022-01-25 12:36:11 -0700
commitbc570646f6de07278b866eb73381d7d8d5e2c355 (patch)
tree0d7fced04fa974be33eaa80d39e83a56c68c4fdb /tools/binman/ftest.py
parenta00d9713e4c01de7e7753c9394a95dca27e47e21 (diff)
binman: Add a command to generate bintool docs
Each bintool has some documentation which can be useful for the user. Add a new command that collects this and writes it into a .rst file. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'tools/binman/ftest.py')
-rw-r--r--tools/binman/ftest.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py
index a3454ddb104..ca200ae9f8f 100644
--- a/tools/binman/ftest.py
+++ b/tools/binman/ftest.py
@@ -5085,6 +5085,21 @@ fdt fdtmap Extract the devicetree blob from the fdtmap
comp_util.decompress(b'1234', 'invalid')
self.assertIn("Unknown algorithm 'invalid'", str(e.exception))
+ def testBintoolDocs(self):
+ """Test for creation of bintool documentation"""
+ with test_util.capture_sys_output() as (stdout, stderr):
+ control.write_bintool_docs(control.bintool.Bintool.get_tool_list())
+ self.assertTrue(len(stdout.getvalue()) > 0)
+
+ def testBintoolDocsMissing(self):
+ """Test handling of missing bintool documentation"""
+ with self.assertRaises(ValueError) as e:
+ with test_util.capture_sys_output() as (stdout, stderr):
+ control.write_bintool_docs(
+ control.bintool.Bintool.get_tool_list(), 'mkimage')
+ self.assertIn('Documentation is missing for modules: mkimage',
+ str(e.exception))
+
if __name__ == "__main__":
unittest.main()