summaryrefslogtreecommitdiff
path: root/tools/binman/entry_test.py
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2017-11-13 07:52:21 +0300
committerSimon Glass <sjg@chromium.org>2017-11-23 04:05:38 +0300
commit934cdcfb1b1cac6a6c987f3f91e341c713770224 (patch)
treee289915f85d46fa0a6e870091abd5a1ed832ecea /tools/binman/entry_test.py
parent4d5994f91c5c781fb0c8b32b58abfc4d9d2ec878 (diff)
downloadu-boot-934cdcfb1b1cac6a6c987f3f91e341c713770224.tar.xz
binman: Add tests for importlib availability
Add a test that the 'entry' module works with or without importlib. The tests are numbered so that they are executed in the correct order. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'tools/binman/entry_test.py')
-rw-r--r--tools/binman/entry_test.py30
1 files changed, 30 insertions, 0 deletions
diff --git a/tools/binman/entry_test.py b/tools/binman/entry_test.py
index 85c4196892..789b26fd9f 100644
--- a/tools/binman/entry_test.py
+++ b/tools/binman/entry_test.py
@@ -7,9 +7,39 @@
# Test for the Entry class
import collections
+import os
+import sys
import unittest
+import fdt
+import fdt_util
+import tools
+
class TestEntry(unittest.TestCase):
+ def GetNode(self):
+ binman_dir = os.path.dirname(os.path.realpath(sys.argv[0]))
+ tools.PrepareOutputDir(None)
+ fname = fdt_util.EnsureCompiled(
+ os.path.join(binman_dir,('test/05_simple.dts')))
+ dtb = fdt.FdtScan(fname)
+ return dtb.GetNode('/binman/u-boot')
+
+ def test1EntryNoImportLib(self):
+ """Test that we can import Entry subclassess successfully"""
+
+ sys.modules['importlib'] = None
+ global entry
+ import entry
+ entry.Entry.Create(None, self.GetNode(), 'u-boot')
+
+ def test2EntryImportLib(self):
+ del sys.modules['importlib']
+ global entry
+ reload(entry)
+ entry.Entry.Create(None, self.GetNode(), 'u-boot-spl')
+ tools._RemoveOutputDir()
+ del entry
+
def testEntryContents(self):
"""Test the Entry bass class"""
import entry