mirror of
https://xff.cz/git/u-boot/
synced 2025-09-03 09:42:22 +02:00
binman: Add a way to obtain the version
Add a -V option which shows the version number of binman. For now this just uses a local 'version' file. Once the tool is packaged in some way we can figure out an approach that suits. Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
@@ -4661,6 +4661,26 @@ class TestFunctional(unittest.TestCase):
|
||||
str(e.exception),
|
||||
"Not enough space in '.*u_boot_binman_embed_sm' for data length.*")
|
||||
|
||||
def testVersion(self):
|
||||
"""Test we can get the binman version"""
|
||||
version = '(unreleased)'
|
||||
self.assertEqual(version, state.GetVersion(self._indir))
|
||||
|
||||
with self.assertRaises(SystemExit):
|
||||
with test_util.capture_sys_output() as (_, stderr):
|
||||
self._DoBinman('-V')
|
||||
self.assertEqual('Binman %s\n' % version, stderr.getvalue())
|
||||
|
||||
# Try running the tool too, just to be safe
|
||||
result = self._RunBinman('-V')
|
||||
self.assertEqual('Binman %s\n' % version, result.stderr)
|
||||
|
||||
# Set up a version file to make sure that works
|
||||
version = 'v2025.01-rc2'
|
||||
tools.WriteFile(os.path.join(self._indir, 'version'), version,
|
||||
binary=False)
|
||||
self.assertEqual(version, state.GetVersion(self._indir))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
Reference in New Issue
Block a user