]> git.sur5r.net Git - u-boot/blobdiff - tools/binman/etype/_testing.py
binman: Make the operation of Entry__testing explicit
[u-boot] / tools / binman / etype / _testing.py
index c376dd5c9ca296d3b87618f36a0a4d589ddccd78..0b1eaefc3ce4aac83af884a40e956f5439f52bb9 100644 (file)
@@ -10,16 +10,22 @@ import fdt_util
 import tools
 
 class Entry__testing(Entry):
+    """A fake entry used for testing
+
+    Properties:
+        return_invalid_entry: Return an invalid entry from GetPositions()
+    """
     def __init__(self, section, etype, node):
         Entry.__init__(self, section, etype, node)
+        self.return_invalid_entry = fdt_util.GetBool(self._node,
+                                                     'return-invalid-entry')
 
     def ObtainContents(self):
         self.data = 'a'
         self.contents_size = len(self.data)
         return True
 
-    def ReadContents(self):
-        return True
-
     def GetPositions(self):
-        return {'invalid-entry': [1, 2]}
+        if self.return_invalid_entry :
+            return {'invalid-entry': [1, 2]}
+        return {}