summaryrefslogtreecommitdiff
path: root/tools/binman/entry_test.py
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2016-11-26 06:15:52 +0300
committerSimon Glass <sjg@chromium.org>2016-12-19 22:09:55 +0300
commit4f44304b0bd881f79252c7b7d2fb796e31ca3b0a (patch)
tree50c4140da8f12dd9a145707b3b186d8a39a471e8 /tools/binman/entry_test.py
parentbf7fd50b3ba56b53dc13a681d19c845be903c3e0 (diff)
downloadu-boot-4f44304b0bd881f79252c7b7d2fb796e31ca3b0a.tar.xz
binman: Add basic entry types for U-Boot
Add entries to support some standard U-Boot binaries, such as u-boot.bin, u-boot.dtb, etc. Also add some tests for these. Signed-off-by: Simon Glass <sjg@chromium.org> Tested-by: Bin Meng <bmeng.cn@gmail.com>
Diffstat (limited to 'tools/binman/entry_test.py')
-rw-r--r--tools/binman/entry_test.py27
1 files changed, 27 insertions, 0 deletions
diff --git a/tools/binman/entry_test.py b/tools/binman/entry_test.py
new file mode 100644
index 0000000000..8a9ae017f0
--- /dev/null
+++ b/tools/binman/entry_test.py
@@ -0,0 +1,27 @@
+#
+# Copyright (c) 2016 Google, Inc
+# Written by Simon Glass <sjg@chromium.org>
+#
+# SPDX-License-Identifier: GPL-2.0+
+#
+# Test for the Entry class
+
+import collections
+import unittest
+
+import entry
+
+class TestEntry(unittest.TestCase):
+ def testEntryContents(self):
+ """Test the Entry bass class"""
+ base_entry = entry.Entry(None, None, None, read_node=False)
+ self.assertEqual(True, base_entry.ObtainContents())
+
+ def testUnknownEntry(self):
+ """Test that unknown entry types are detected"""
+ Node = collections.namedtuple('Node', ['name', 'path'])
+ node = Node('invalid-name', 'invalid-path')
+ with self.assertRaises(ValueError) as e:
+ entry.Entry.Create(None, node, node.name)
+ self.assertIn("Unknown entry type 'invalid-name' in node "
+ "'invalid-path'", str(e.exception))