[U-Boot] [PATCH v2 4/8] test: py: add option to select device tree used during compilation

Patrick Delaunay patrick.delaunay at st.com
Mon May 20 13:00:03 UTC 2019


Only used for spl compilation which include the device tree
(with platdata or embedded device tree).
For U-boot, test use config.dtb, by default :
   "build_dir + '/arch/sandbox/dts/test.dtb'"

Signed-off-by: Patrick Delaunay <patrick.delaunay at st.com>
---
I need to force o_dt = 'all' to avoid make error:

make: *** empty string invalid as file name.  Stop.

But, I don't sure that it is the better solution for pytest.


Changes in v2:
- add a new test option: device tree used for compilation

 test/py/conftest.py | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/test/py/conftest.py b/test/py/conftest.py
index 00d8ef8..c1fe2a8 100644
--- a/test/py/conftest.py
+++ b/test/py/conftest.py
@@ -74,6 +74,8 @@ def pytest_addoption(parser):
         help='U-Boot board identity/instance')
     parser.addoption('--build', default=False, action='store_true',
         help='Compile U-Boot before running tests')
+    parser.addoption('--device-tree', default=None,
+        help='Device tree used to compile U-Boot')
     parser.addoption('--gdbserver', default=None,
         help='Run sandbox under gdbserver. The argument is the channel '+
         'over which gdbserver should communicate, e.g. localhost:1234')
@@ -101,6 +103,8 @@ def pytest_configure(config):
     board_identity = config.getoption('board_identity')
     board_identity_filename = board_identity.replace('-', '_')
 
+    device_tree = config.getoption('device_tree')
+
     build_dir = config.getoption('build_dir')
     if not build_dir:
         build_dir = source_dir + '/build-' + board_type
@@ -128,9 +132,15 @@ def pytest_configure(config):
             o_opt = 'O=%s' % build_dir
         else:
             o_opt = ''
+
+        if device_tree:
+            o_dt = 'DEVICE_TREE=%s' % device_tree
+        else:
+            o_dt = 'all'
+
         cmds = (
             ['make', o_opt, '-s', board_type + '_defconfig'],
-            ['make', o_opt, '-s', '-j8'],
+            ['make', o_opt, o_dt, '-s', '-j8'],
         )
         with log.section('make'):
             runner = log.get_runner('make', sys.stdout)
-- 
2.7.4



More information about the U-Boot mailing list