[Concept,09/15] dtoc: Add a test for the fdt_util.EnsureCompiled with indir
Commit Message
From: Simon Glass <sjg@chromium.org>
Provide a test which covers this feature of the EnsureCompiled()
function.
Signed-off-by: Simon Glass <sjg@chromium.org>
---
tools/dtoc/test/dtoc_test_inc.dts | 14 ++++++++++++++
tools/dtoc/test/test-include.dtsi | 5 +++++
tools/dtoc/test_fdt.py | 10 ++++++++++
3 files changed, 29 insertions(+)
create mode 100644 tools/dtoc/test/dtoc_test_inc.dts
create mode 100644 tools/dtoc/test/test-include.dtsi
new file mode 100644
@@ -0,0 +1,14 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Test device tree file for dtoc
+ *
+ * Copyright 2017 Google, Inc
+ */
+
+/dts-v1/;
+
+/ {
+};
+
+/include/ "test-include.dtsi"
+#include "test-include.dtsi"
new file mode 100644
@@ -0,0 +1,5 @@
+// SPDX-License-Identifier: GPL-2.0+
+/ {
+ #address-cells = <1>;
+ #size-cells = <1>;
+};
@@ -932,6 +932,16 @@ class TestFdtUtil(unittest.TestCase):
finally:
tools.outdir = old_outdir
+ def test_ensure_compiled_indir(self):
+ """Test compiling with input directories specified"""
+ tmpdir = tempfile.mkdtemp(prefix='test_fdt.')
+ dest = os.path.join(tmpdir, 'try.dts')
+ shutil.copy(find_dtb_file('dtoc_test_inc.dts'), dest)
+
+ dtb = fdt_util.EnsureCompiled(dest, indir=['tools/dtoc/test'])
+ self.assertEqual(dtb, fdt_util.EnsureCompiled(dtb))
+ shutil.rmtree(tmpdir)
+
def test_get_phandle_name_offset(self):
val = fdt_util.GetPhandleNameOffset(self.node, 'missing')
self.assertIsNone(val)