Re: [U-Boot] [PATCH v2 02/29] binman: Make the operation of Entry__testing explicit

2018-07-09 Thread Simon Glass
On 6 July 2018 at 10:27, Simon Glass  wrote:
> This fake entry is used for testing. At present it only has one behaviour
> which is to return an invalid set of entry positions, to cause an error.
>
> The fake entry will need to be used for other things too. Allow the test
> .dts file to specify the behaviour of the fake entry, so we can control
> its behaviour easily.
>
> While we are here, drop the ReadContents() method, since this only applies
> to subclasses of Entry_blob, which Entry__testing is not.
>
> Signed-off-by: Simon Glass 
> ---
>
> Changes in v2: None
>
>  tools/binman/etype/_testing.py| 14 ++
>  tools/binman/test/41_unknown_pos_size.dts |  1 +
>  2 files changed, 11 insertions(+), 4 deletions(-)

Applied to u-boot-dm
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH v2 02/29] binman: Make the operation of Entry__testing explicit

2018-07-06 Thread Simon Glass
This fake entry is used for testing. At present it only has one behaviour
which is to return an invalid set of entry positions, to cause an error.

The fake entry will need to be used for other things too. Allow the test
.dts file to specify the behaviour of the fake entry, so we can control
its behaviour easily.

While we are here, drop the ReadContents() method, since this only applies
to subclasses of Entry_blob, which Entry__testing is not.

Signed-off-by: Simon Glass 
---

Changes in v2: None

 tools/binman/etype/_testing.py| 14 ++
 tools/binman/test/41_unknown_pos_size.dts |  1 +
 2 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/tools/binman/etype/_testing.py b/tools/binman/etype/_testing.py
index c376dd5c9c..0b1eaefc3c 100644
--- a/tools/binman/etype/_testing.py
+++ b/tools/binman/etype/_testing.py
@@ -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 {}
diff --git a/tools/binman/test/41_unknown_pos_size.dts 
b/tools/binman/test/41_unknown_pos_size.dts
index a8e7d8aa22..94fe821c47 100644
--- a/tools/binman/test/41_unknown_pos_size.dts
+++ b/tools/binman/test/41_unknown_pos_size.dts
@@ -6,6 +6,7 @@
 
binman {
_testing {
+   return-invalid-entry;
};
 };
 };
-- 
2.18.0.203.gfac676dfb9-goog

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot