diff options
author | Simon Glass <sjg@chromium.org> | 2019-07-20 12:23:45 -0600 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2019-07-29 09:38:05 -0600 |
commit | c6bd6e235ac6d6a35e9ad8f3db49db7ba27f7650 (patch) | |
tree | 9b33ebb2abaac9fb99e6efa541f6555427dbd7fb /tools/binman/entry_test.py | |
parent | 1411ac8d162eaf97714b17848a2da7be1f01fa98 (diff) | |
download | u-boot-c6bd6e235ac6d6a35e9ad8f3db49db7ba27f7650.tar.gz |
binman: Adjust Entry to read the node in a separate call
At present the Entry constructor sets up the object and then immediately
reads its device-tree node to obtain its properties.
This breaks a convention that constructors should not do any processing.
A consequence is that we must pass all arguments to the constructor and
cannot have the node-reading proceed in a different way unless we pass
flags to that constructor. We already have a 'test' flag in a few cases,
and now need to control whether the 'orig_offset' and 'orig_size'
properties are set or not.
Adjust the code to require a separate call to ReadNode() after
construction. The Image class remains as it was.
Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'tools/binman/entry_test.py')
-rw-r--r-- | tools/binman/entry_test.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/tools/binman/entry_test.py b/tools/binman/entry_test.py index 460171ba89..ee729f3751 100644 --- a/tools/binman/entry_test.py +++ b/tools/binman/entry_test.py @@ -57,7 +57,7 @@ class TestEntry(unittest.TestCase): def testEntryContents(self): """Test the Entry bass class""" import entry - base_entry = entry.Entry(None, None, None, read_node=False) + base_entry = entry.Entry(None, None, None) self.assertEqual(True, base_entry.ObtainContents()) def testUnknownEntry(self): @@ -73,15 +73,15 @@ class TestEntry(unittest.TestCase): """Test Entry.GetUniqueName""" Node = collections.namedtuple('Node', ['name', 'parent']) base_node = Node('root', None) - base_entry = entry.Entry(None, None, base_node, read_node=False) + base_entry = entry.Entry(None, None, base_node) self.assertEqual('root', base_entry.GetUniqueName()) sub_node = Node('subnode', base_node) - sub_entry = entry.Entry(None, None, sub_node, read_node=False) + sub_entry = entry.Entry(None, None, sub_node) self.assertEqual('root.subnode', sub_entry.GetUniqueName()) def testGetDefaultFilename(self): """Trivial test for this base class function""" - base_entry = entry.Entry(None, None, None, read_node=False) + base_entry = entry.Entry(None, None, None) self.assertIsNone(base_entry.GetDefaultFilename()) def testBlobFdt(self): |