[PATCH] binman: Correct the error message for a bad hash algorithm

Simon Glass sjg at chromium.org
Tue Feb 8 18:59:44 CET 2022


This shows an internal type at present, rather than the algorithm name.
Fix it and update the test to catch this.

Signed-off-by: Simon Glass <sjg at chromium.org>
---

 tools/binman/ftest.py | 2 +-
 tools/binman/state.py | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py
index 5400f76c67..3e15de63d5 100644
--- a/tools/binman/ftest.py
+++ b/tools/binman/ftest.py
@@ -2073,7 +2073,7 @@ class TestFunctional(unittest.TestCase):
     def testHashBadAlgo(self):
         with self.assertRaises(ValueError) as e:
             self._DoReadFileDtb('092_hash_bad_algo.dts', update_dtb=True)
-        self.assertIn("Node '/binman/u-boot': Unknown hash algorithm",
+        self.assertIn("Node '/binman/u-boot': Unknown hash algorithm 'invalid'",
                       str(e.exception))
 
     def testHashSection(self):
diff --git a/tools/binman/state.py b/tools/binman/state.py
index af0a65e841..843aefd28d 100644
--- a/tools/binman/state.py
+++ b/tools/binman/state.py
@@ -397,7 +397,7 @@ def CheckAddHashProp(node):
         if algo.value == 'sha256':
             size = 32
         else:
-            return "Unknown hash algorithm '%s'" % algo
+            return "Unknown hash algorithm '%s'" % algo.value
         for n in GetUpdateNodes(hash_node):
             n.AddEmptyProp('value', size)
 
-- 
2.35.0.263.gb82422642f-goog



More information about the U-Boot mailing list