Skip to contentSkip to conversation

test: Fixes to allow tests to run on a machine with old dtc

PATCH New Simon Glass 1 participant 5 messages Dec 24, 2017 – Jan 18, 2018

lore
Share & tools
lore
#0 lore raw

cover test: Fixes to allow tests to run on a machine with old dtc

These two patches should fix the problem with u-boot-dm/master where the binman tests fail.

Simon Glass (2):
dtoc: Allow DTC environment variable to provide path to dtc
test: Set the DTC environment variable

 test/run               | 8 +++++---
 tools/binman/README    | 4 ++++
 tools/dtoc/fdt_util.py | 3 ++-
 3 files changed, 11 insertions(+), 4 deletions(-)
Signature · 1 line
2.15.1.620.gb9897f4670-goog
#1 lore raw

PATCH 1/2 dtoc: Allow DTC environment variable to provide path to dtc

The system device-tree compiler may not be new enough to run the tests we use in U-Boot (e.g. with binman). Allow use of a DTC environment variable to point to the correct dtc. If not defined, the dtc on the default PATH is used.

---

 tools/binman/README    | 4 ++++
 tools/dtoc/fdt_util.py | 3 ++-
 2 files changed, 6 insertions(+), 1 deletion(-)
tools/binman/README +4 -0
index 08c3e56bde..7f558ec6a9 100644
@@ -536,6 +536,10 @@ entry contents.
 Most of the time such essoteric behaviour is not needed, but it can be
 essential for complex images.
 
+If you need to specify a particular device-tree compiler to use, you can define
+the DTC environment variable. This can be useful when the system dtc is too
+old.
+
 
 History / Credits
 -----------------
tools/dtoc/fdt_util.py +2 -1
index ba0b6cc381..ad06245b42 100644
@@ -79,7 +79,8 @@ def EnsureCompiled(fname):
             '-W', 'no-unit_address_vs_reg']
     args.extend(search_list)
     args.append(dts_input)
-    command.Run('dtc', *args)
+    dtc = os.environ.get('DTC') or 'dtc'
+    command.Run(dtc, *args)
     return dtb_output
 
 def GetInt(node, propname, default=None):
Signature · 1 line
2.15.1.620.gb9897f4670-goog
#3 lore raw

PATCH 2/2 test: Set the DTC environment variable

In reply to Simon Glass

Set this to our own device-tree compiler since we know it is new enough to run the tests.

---

 test/run | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
test/run +5 -3
index d5631b802a..b2d24e3f8e 100755
@@ -17,17 +17,19 @@ run_test ./test/py/test.py --bd sandbox_spl --build -k \
 # Run tests for the flat DT version of sandbox
 ./test/py/test.py --bd sandbox_flattree --build
 
-PYTHONPATH=build-sandbox_spl/scripts/dtc/pylibfdt run_test \
+DTC_DIR=build-sandbox_spl/scripts/dtc
+
+PYTHONPATH=${DTC_DIR}/pylibfdt DTC=${DTC_DIR}/dtc run_test \
 	./tools/binman/binman -t
 run_test ./tools/patman/patman --test
 run_test ./tools/buildman/buildman -t
-PYTHONPATH=build-sandbox_spl/scripts/dtc/pylibfdt run_test ./tools/dtoc/dtoc -t
+PYTHONPATH=${DTC_DIR}/pylibfdt DTC=${DTC_DIR}/dtc run_test ./tools/dtoc/dtoc -t
 
 # This needs you to set up Python test coverage tools.
 # To enable Python test coverage on Debian-type distributions (e.g. Ubuntu):
 #   $ sudo apt-get install python-pip python-pytest
 #   $ sudo pip install coverage
-PYTHONPATH=build-sandbox_spl/scripts/dtc/pylibfdt run_test \
+PYTHONPATH=${DTC_DIR}/pylibfdt DTC=${DTC_DIR}/dtc run_test \
 	./tools/binman/binman -T
 
 if [ $result == 0 ]; then
Signature · 1 line
2.15.1.620.gb9897f4670-goog
#2 lore raw

PATCH 1/2 dtoc: Allow DTC environment variable to provide path to dtc

In reply to Simon Glass
Quoted 11 lines · Simon Glass

The system device-tree compiler may not be new enough to run the tests we use in U-Boot (e.g. with binman). Allow use of a DTC environment variable to point to the correct dtc. If not defined, the dtc on the default PATH is used.

---

 tools/binman/README    | 4 ++++
 tools/dtoc/fdt_util.py | 3 ++-
 2 files changed, 6 insertions(+), 1 deletion(-)

Applied to u-boot-dm (and now in mainline). Sorry for the delay.

#4 lore raw

PATCH 2/2 test: Set the DTC environment variable

In reply to Simon Glass
Quoted 9 lines · Simon Glass

Set this to our own device-tree compiler since we know it is new enough to run the tests.

---

 test/run | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

Applied to u-boot-dm (and now in mainline). Sorry for the delay.