diff options
author | Simon Glass <sjg@chromium.org> | 2020-09-01 05:13:54 -0600 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2020-09-22 12:50:43 -0600 |
commit | 3decfa3a8761538d791d006edbf01135a453a2ac (patch) | |
tree | 32e562dacc7e77d3cddb330f303e4f00b0bca850 /tools/binman/ftest.py | |
parent | dc447b6b3fef1b145014519f607bb9722455bc16 (diff) |
binman: Allow entry args to be required
If an entry argument is needed by an entry but the entry argument is not
present, then a strange error can occur when trying to read the file.
Fix this by allowing arguments to be required. Select this option for the
cros-ec-rw entry. If a filename is provided in the node, allow that to be
used.
Also tidy up a few related tests to make the error string easier to find,
and fully ignore unused return values.
Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'tools/binman/ftest.py')
-rw-r--r-- | tools/binman/ftest.py | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py index e672967dbaa..f000a794325 100644 --- a/tools/binman/ftest.py +++ b/tools/binman/ftest.py @@ -1382,8 +1382,9 @@ class TestFunctional(unittest.TestCase): } with self.assertRaises(ValueError) as e: self._DoReadFileDtb('064_entry_args_required.dts') - self.assertIn("Node '/binman/_testing': Missing required " - 'properties/entry args: test-str-arg, test-int-fdt, test-int-arg', + self.assertIn("Node '/binman/_testing': " + 'Missing required properties/entry args: test-str-arg, ' + 'test-int-fdt, test-int-arg', str(e.exception)) def testEntryArgsInvalidFormat(self): @@ -1487,8 +1488,7 @@ class TestFunctional(unittest.TestCase): entry_args = { 'cros-ec-rw-path': 'ecrw.bin', } - data, _, _, _ = self._DoReadFileDtb('068_blob_named_by_arg.dts', - entry_args=entry_args) + self._DoReadFileDtb('068_blob_named_by_arg.dts', entry_args=entry_args) def testFill(self): """Test for an fill entry type""" @@ -3523,5 +3523,12 @@ class TestFunctional(unittest.TestCase): err = stderr.getvalue() self.assertRegex(err, "Image 'main-section'.*missing.*: blob-ext") + def testBlobNamedByArgMissing(self): + """Test handling of a missing entry arg""" + with self.assertRaises(ValueError) as e: + self._DoReadFile('068_blob_named_by_arg.dts') + self.assertIn("Missing required properties/entry args: cros-ec-rw-path", + str(e.exception)) + if __name__ == "__main__": unittest.main() |