dtoc: Add a test for the fdt_util.EnsureCompiled with indir
Provide a test which covers this feature of the EnsureCompiled() function. Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
14
tools/dtoc/test/dtoc_test_inc.dts
Normal file
14
tools/dtoc/test/dtoc_test_inc.dts
Normal file
@@ -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"
|
||||
5
tools/dtoc/test/test-include.dtsi
Normal file
5
tools/dtoc/test/test-include.dtsi
Normal file
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user