Skip to contentSkip to conversation

test: Include Python tools in test coverage

PATCH Superseded Simon Glass 2 participants 48 messages Nov 13, 2017 – Nov 24, 2017 Kbuild

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover test: Include Python tools in test coverage

At present there are a number of tools in U-Boot which have tests which are not widely used:

patman - prepare, check and send patches
buildman - multi-threaded multi-commit builder
dtoc - convert device tree file to C
binman - produce firmware images

In fact many tests are broken and this has not been noticed.

This series fixes up the tests and updates 'make tests' to run them. This should help ensure that the tests stay current.

Note: This series is available at u-boot-dm/binman-working. It requires Masahiro's pylibfdt series.

Simon Glass (26):
binman: Add better Makefile debugging
binman: Add docs explaining how to enable binman for a board
binman: Add a Makefile for test-program compilation
binman: Rename tests to ftest
binman: Disable the no-unit_address_vs_reg warnings test/run: Report and return failure
test: Run binman tests
patman: Fix up tests to pass with newest checkpatch
test: Run patman tests
buildman: Allow skipping of tests which use the network
buildman: Fix up tests
test: Run buildman tests
dtoc: Fix up tests
test: Run dtoc tests
binman: Append to PYTHONPATH when running test coverage
binman: Set up 'entry' to permit full test coverage
binman: Add tests for importlib availability
binman: Add a main program to the tests
binman: Increase test coverage back to 100%
binman: Check for files missing from test coverage
binman: Add test for u-boot-spl-bss-pad
binman: Add a test for x86-start16-spl
binman: Add add test for SPL with a microcode pointer
binman: Add add test for using an Intel MRC binary
binman: Return non-zero exit code on test failure
RFC: binman: Run code coverage tests

 scripts/Makefile.lib                            |  18 +++-
 test/run                                        |  31 ++++++-
 tools/binman/README                             |  24 +++++-
 tools/binman/binman.py                          |  42 +++++++--
 tools/binman/entry_test.py                      |  36 +++++++-
 tools/binman/etype/u_boot_spl_with_ucode_ptr.py |   2 +-
 tools/binman/etype/u_boot_ucode.py              |  11 +--
 tools/binman/{func_test.py => ftest.py}         | 108 ++++++++++++++++++------
 tools/binman/image.py                           |   7 +-
 tools/binman/test/47_spl_bss_pad.dts            |  17 ++++
 tools/binman/test/48_x86-start16-spl.dts        |  13 +++
 tools/binman/test/49_x86_ucode_spl.dts          |  29 +++++++
 tools/binman/test/50_intel_mrc.dts              |  13 +++
 tools/binman/test/Makefile                      |  39 +++++++++
 tools/binman/test/bss_data                      | Bin 0 -> 5020 bytes
 tools/binman/test/bss_data.c                    |  18 ++++
 tools/binman/test/bss_data.lds                  |  16 ++++
 tools/binman/test/u_boot_no_ucode_ptr.c         |   4 -
 tools/binman/test/u_boot_ucode_ptr.c            |   4 -
 tools/buildman/buildman.py                      |   6 +-
 tools/buildman/cmdline.py                       |   2 +
 tools/buildman/test.py                          |  38 ++++++---
 tools/dtoc/fdt_util.py                          |   3 +-
 tools/dtoc/test_dtoc.py                         |  82 ++++++++----------
 tools/patman/test.py                            |  41 +++++----
 25 files changed, 466 insertions(+), 138 deletions(-)
 rename tools/binman/{func_test.py => ftest.py} (91%)
 create mode 100644 tools/binman/test/47_spl_bss_pad.dts
 create mode 100644 tools/binman/test/48_x86-start16-spl.dts
 create mode 100644 tools/binman/test/49_x86_ucode_spl.dts
 create mode 100644 tools/binman/test/50_intel_mrc.dts
 create mode 100644 tools/binman/test/Makefile
 create mode 100755 tools/binman/test/bss_data
 create mode 100644 tools/binman/test/bss_data.c
 create mode 100644 tools/binman/test/bss_data.lds
Signature · 1 line
2.15.0.448.gf294e3d99a-goog
#1 lore raw

PATCH 1/26 binman: Add better Makefile debugging

There is a debugging option in the Makefile to allow people to figure out which u-boot.dtsi files are used in the build. But is it not easy to use since it only shows files it finds, not those it is looking for. Update it and update the mention of it to the docs.

---

 scripts/Makefile.lib | 18 ++++++++++++++----
 tools/binman/README  |  3 ++-
 2 files changed, 16 insertions(+), 5 deletions(-)
scripts/Makefile.lib +14 -4
index 0d5c5291a1b..8f19b2db56d 100644
@@ -165,17 +165,27 @@ cpp_flags      = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(UBOOTINCLUDE)     \
 ld_flags       = $(LDFLAGS) $(ldflags-y)
 
 # Try these files in order to find the U-Boot-specific .dtsi include file
-u_boot_dtsi_options = $(wildcard $(dir $<)$(basename $(notdir $<))-u-boot.dtsi) \
+u_boot_dtsi_options = $(strip $(wildcard $(dir $<)$(basename $(notdir $<))-u-boot.dtsi) \
 	$(wildcard $(dir $<)$(subst $\",,$(CONFIG_SYS_SOC))-u-boot.dtsi) \
 	$(wildcard $(dir $<)$(subst $\",,$(CONFIG_SYS_CPU))-u-boot.dtsi) \
 	$(wildcard $(dir $<)$(subst $\",,$(CONFIG_SYS_VENDOR))-u-boot.dtsi) \
-	$(wildcard $(dir $<)u-boot.dtsi)
+	$(wildcard $(dir $<)u-boot.dtsi))
+
+u_boot_dtsi_options_raw = $(warning Automatic .dtsi inclusion: options: \
+	$(dir $<)$(basename $(notdir $<))-u-boot.dtsi \
+	$(dir $<)$(subst $\",,$(CONFIG_SYS_SOC))-u-boot.dtsi \
+	$(dir $<)$(subst $\",,$(CONFIG_SYS_CPU))-u-boot.dtsi \
+	$(dir $<)$(subst $\",,$(CONFIG_SYS_VENDOR))-u-boot.dtsi \
+	$(dir $<)u-boot.dtsi ... \
+	found: $(if $(u_boot_dtsi_options),"$(u_boot_dtsi_options)",nothing!))
 
 # Uncomment for debugging
-# $(warning u_boot_dtsi_options: $(u_boot_dtsi_options))
+# This shows all the files that were considered and the one that we chose.
+# u_boot_dtsi_options_debug = $(u_boot_dtsi_options_raw)
 
 # We use the first match
-u_boot_dtsi = $(notdir $(firstword $(u_boot_dtsi_options)))
+u_boot_dtsi = $(strip $(u_boot_dtsi_options_debug) \
+	$(notdir $(firstword $(u_boot_dtsi_options))))
 
 # Modified for U-Boot
 dtc_cpp_flags  = -Wp,-MD,$(depfile).pre.tmp -nostdinc                    \
tools/binman/README +2 -1
index cb47e73599a..63f97226429 100644
@@ -446,7 +446,8 @@ If you are having trouble figuring out what is going on, you can uncomment
 the 'warning' line in scripts/Makefile.lib to see what it has found:
 
    # Uncomment for debugging
-   # $(warning binman_dtsi_options: $(binman_dtsi_options))
+   # This shows all the files that were considered and the one that we chose.
+   # u_boot_dtsi_options_debug = $(u_boot_dtsi_options_raw)
 
 
 Code coverage
Signature · 1 line
2.15.0.448.gf294e3d99a-goog
#3 lore raw

PATCH 2/26 binman: Add docs explaining how to enable binman for a board

In reply to Simon Glass

The process is not obvious. Add a little section to explain how to move a board to use binman.

---

 tools/binman/README | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)
tools/binman/README +21 -0
index 63f97226429..4ef76c8f089 100644
@@ -206,6 +206,27 @@ for its instructions in the 'binman' node.
 Binman has a few other options which you can see by running 'binman -h'.
 
 
+Enabling binman for a board
+---------------------------
+
+At present binman is invoked from a rule in the main Makefile. Typically you
+will have a rule like:
+
+ifneq ($(CONFIG_ARCH_<something>),)
+u-boot-<your_suffix>.bin: <input_file_1> <input_file_2> checkbinman FORCE
+	$(call if_changed,binman)
+endif
+
+This assumes that u-boot-<your_suffix>.bin is a target, and is the final file
+that you need to produce. You can make it a target by adding it to ALL-y
+either in the main Makefile or in a config.mk file in your arch subdirectory.
+
+Once binman is executed it will pick up its instructions from a device-tree
+file, typically <soc>-u-boot.dtsi, where <soc> is your CONFIG_SYS_SOC value.
+You can use other, more specific CONFIG options - see 'Automatic .dtsi
+inclusion' below.
+
+
 Image description format
 ------------------------
 
Signature · 1 line
2.15.0.448.gf294e3d99a-goog
#5 lore raw

PATCH 3/26 binman: Add a Makefile for test-program compilation

In reply to Simon Glass

These test programs are includedd as binary files in U-Boot to avoid having to build them (and associated toolchain differences). Instructions on building are in the files themselves, but it seems better to provide a Makefile which can be manually run when desired.

Add a Makefile, separate from the normal build system, to handle this.

---

 tools/binman/test/Makefile              | 36 +++++++++++++++++++++++++++++++++
 tools/binman/test/u_boot_no_ucode_ptr.c |  4 ----
 tools/binman/test/u_boot_ucode_ptr.c    |  4 ----
 3 files changed, 36 insertions(+), 8 deletions(-)
 create mode 100644 tools/binman/test/Makefile
tools/binman/test/Makefile new file +36 -0
new file mode 100644
index 00000000000..786d1b05778
@@ -0,0 +1,36 @@
+#
+# Builds test programs
+#
+# Copyright (C) 2017 Google, Inc
+# Written by Simon Glass <[email protected]>
+#
+# SPDX-License-Identifier:      GPL-2.0+
+#
+
+CFLAGS := -march=i386 -m32 -nostdlib -I ../../../include
+
+LDS_UCODE := -T u_boot_ucode_ptr.lds
+
+TARGETS = u_boot_ucode_ptr u_boot_no_ucode_ptr
+
+all: $(TARGETS)
+
+u_boot_no_ucode_ptr: CFLAGS += $(LDS_UCODE)
+u_boot_no_ucode_ptr: u_boot_no_ucode_ptr.c
+
+u_boot_ucode_ptr: CFLAGS += $(LDS_UCODE)
+u_boot_ucode_ptr: u_boot_ucode_ptr.c
+
+clean:
+	rm -f $(TARGETS)
+
+help:
+	@echo "Makefile for binman test programs"
+	@echo
+	@echo "Intended for use on x86 hosts"
+	@echo
+	@echo "Targets:"
+	@echo
+	@echo -e "\thelp	- Print help (this is it!)"
+	@echo -e "\tall	- Builds test programs (default targget)"
+	@echo -e "\tclean	- Delete output files"
tools/binman/test/u_boot_no_ucode_ptr.c +0 -4
index a17bb4c6c20..c4a2b85fc95 100644
@@ -5,10 +5,6 @@
  *
  * Simple program to create a bad _dt_ucode_base_size symbol to create an
  * error when it is used. This is used by binman tests.
- *
- * Build with:
- * cc -march=i386 -m32 -o u_boot_no_ucode_ptr -T u_boot_ucode_ptr.lds \
-	-nostdlib u_boot_no_ucode_ptr.c
  */
 
 static unsigned long not__dt_ucode_base_size[2]
tools/binman/test/u_boot_ucode_ptr.c +0 -4
index 434c9f44003..24f349fb9e4 100644
@@ -5,10 +5,6 @@
  *
  * Simple program to create a _dt_ucode_base_size symbol which can be read
  * by 'nm'. This is used by binman tests.
- *
- * Build with:
- * cc -march=i386 -m32 -o u_boot_ucode_ptr -T u_boot_ucode_ptr.lds -nostdlib \
-	u_boot_ucode_ptr.c
  */
 
 static unsigned long _dt_ucode_base_size[2]
Signature · 1 line
2.15.0.448.gf294e3d99a-goog
#7 lore raw

PATCH 4/26 binman: Rename tests to ftest

In reply to Simon Glass

At present these tests use the same filename as patman. This adds confusion when running all tests, since error messages look very similar. In fact binman tries to run the wrong tests at present.

Rename the tests.

---

 tools/binman/binman.py                  | 4 ++--
 tools/binman/{func_test.py => ftest.py} | 0
 2 files changed, 2 insertions(+), 2 deletions(-)
 rename tools/binman/{func_test.py => ftest.py} (100%)
tools/binman/binman.py +2 -2
index e75a59d9517..d264bcdfa8c 100755
@@ -34,7 +34,7 @@ def RunTests():
     """Run the functional tests and any embedded doctests"""
     import entry_test
     import fdt_test
-    import func_test
+    import ftest
     import test
     import doctest
 
@@ -44,7 +44,7 @@ def RunTests():
         suite.run(result)
 
     sys.argv = [sys.argv[0]]
-    for module in (func_test.TestFunctional, fdt_test.TestFdt,
+    for module in (ftest.TestFunctional, fdt_test.TestFdt,
                    entry_test.TestEntry):
         suite = unittest.TestLoader().loadTestsFromTestCase(module)
         suite.run(result)
tools/binman/ftest.py renamed from tools/binman/func_test.py +0 -0
similarity index 100%
rename from tools/binman/func_test.py
rename to tools/binman/ftest.py
Signature · 1 line
2.15.0.448.gf294e3d99a-goog
#9 lore raw

PATCH 5/26 binman: Disable the no-unit_address_vs_reg warnings

In reply to Simon Glass

These warnings are not useful for binman tests. Disable them.

---

 tools/dtoc/fdt_util.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
tools/dtoc/fdt_util.py +2 -1
index 338d47a5e14..ba0b6cc3815 100644
@@ -75,7 +75,8 @@ def EnsureCompiled(fname):
     search_list = []
     for path in search_paths:
         search_list.extend(['-i', path])
-    args = ['-I', 'dts', '-o', dtb_output, '-O', 'dtb']
+    args = ['-I', 'dts', '-o', dtb_output, '-O', 'dtb',
+            '-W', 'no-unit_address_vs_reg']
     args.extend(search_list)
     args.append(dts_input)
     command.Run('dtc', *args)
Signature · 1 line
2.15.0.448.gf294e3d99a-goog
#11 lore raw

PATCH 6/26 test/run: Report and return failure

In reply to Simon Glass

This script runs the tests but does not report failure. Also it always returns an exit code of 0 even on failure.

Fix these problems by checking the result of each test.

---

 test/run | 20 +++++++++++++++++---
 1 file changed, 17 insertions(+), 3 deletions(-)
test/run +17 -3
index b1649ee1015..caee4f83f2c 100755
@@ -1,10 +1,24 @@
-#!/bin/sh
+#!/bin/bash
+
+run_test() {
+	$@
+	[ $? -ne 0 ] && result=$((result+1))
+	echo "result $result"
+}
 
 # Run all tests that the standard sandbox build can support
-./test/py/test.py --bd sandbox --build
+run_test ./test/py/test.py --bd sandbox --build
 
 # Run tests which require sandbox_spl
-./test/py/test.py --bd sandbox_spl --build -k test/py/tests/test_ofplatdata.py
+run_test ./test/py/test.py --bd sandbox_spl --build -k \
+		test/py/tests/test_ofplatdata.py
 
 # Run tests for the flat DT version of sandbox
 ./test/py/test.py --bd sandbox_flattree --build
+
+if [ $result == 0 ]; then
+	echo "Tests passed!"
+else
+	echo "Tests FAILED"
+	exit 1
+fi
Signature · 1 line
2.15.0.448.gf294e3d99a-goog
#13 lore raw

PATCH 7/26 test: Run binman tests

In reply to Simon Glass

Update the test script to run the binman tests also.

---

 test/run | 2 ++
 1 file changed, 2 insertions(+)
test/run +2 -0
index caee4f83f2c..b9ed3edb3e4 100755
@@ -16,6 +16,8 @@ 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/tools run_test ./tools/binman/binman -t
+
 if [ $result == 0 ]; then
 	echo "Tests passed!"
 else
Signature · 1 line
2.15.0.448.gf294e3d99a-goog
#14 lore raw

PATCH 8/26 patman: Fix up tests to pass with newest checkpatch

In reply to Simon Glass

The checkpatch tool was updated but the patman tests were not. Fix this.

---

 tools/patman/test.py | 41 ++++++++++++++++++++++++++---------------
 1 file changed, 26 insertions(+), 15 deletions(-)
tools/patman/test.py +26 -15
index 20dc9c1e0df..51145e83905 100644
@@ -88,8 +88,7 @@ Signed-off-by: Simon Glass <[email protected]>
         os.remove(expname)
 
     def GetData(self, data_type):
-        data='''
-From 4924887af52713cabea78420eff03badea8f0035 Mon Sep 17 00:00:00 2001
+        data='''From 4924887af52713cabea78420eff03badea8f0035 Mon Sep 17 00:00:00 2001
 From: Simon Glass <[email protected]>
 Date: Thu, 7 Apr 2011 10:14:41 -0700
 Subject: [PATCH 1/4] Add microsecond boot time measurement
@@ -101,6 +100,7 @@ an available microsecond counter.
 %s
 ---
  README              |   11 ++++++++
+ MAINTAINERS         |    3 ++
  common/bootstage.c  |   50 ++++++++++++++++++++++++++++++++++++
  include/bootstage.h |   71 +++++++++++++++++++++++++++++++++++++++++++++++++++
  include/common.h    |    8 ++++++
@@ -130,19 +130,31 @@ index 6f3748d..f9e4e65 100644
  - Standalone program support:
  		CONFIG_STANDALONE_LOAD_ADDR
 
+diff --git a/MAINTAINERS b/MAINTAINERS
+index b167b028ec..beb7dc634f 100644
+--- a/MAINTAINERS
++++ b/MAINTAINERS
+@@ -474,3 +474,8 @@ S:	Maintained
+ T:	git git://git.denx.de/u-boot.git
+ F:	*
+ F:	*/
++
++BOOTSTAGE
++M:	Simon Glass <[email protected]>
++L:	u-boot at lists.denx.de
++F:	common/bootstage.c
 diff --git a/common/bootstage.c b/common/bootstage.c
 new file mode 100644
 index 0000000..2234c87
 --- /dev/null
 +++ b/common/bootstage.c
-@@ -0,0 +1,39 @@
+@@ -0,0 +1,37 @@
 +/*
 + * Copyright (c) 2011, Google Inc. All rights reserved.
 + *
 + * SPDX-License-Identifier:	GPL-2.0+
 + */
 +
-+
 +/*
 + * This module records the progress of boot and arbitrary commands, and
 + * permits accurate timestamping of each. The records can optionally be
@@ -151,26 +163,25 @@ index 0000000..2234c87
 +
 +#include <common.h>
 +
-+
 +struct bootstage_record {
-+	uint32_t time_us;
++	u32 time_us;
 +	const char *name;
 +};
 +
 +static struct bootstage_record record[BOOTSTAGE_COUNT];
 +
-+uint32_t bootstage_mark(enum bootstage_id id, const char *name)
++u32 bootstage_mark(enum bootstage_id id, const char *name)
 +{
 +	struct bootstage_record *rec = &record[id];
 +
 +	/* Only record the first event for each */
 +%sif (!rec->name) {
-+		rec->time_us = (uint32_t)timer_get_us();
++		rec->time_us = (u32)timer_get_us();
 +		rec->name = name;
 +	}
 +	if (!rec->name &&
 +	%ssomething_else) {
-+		rec->time_us = (uint32_t)timer_get_us();
++		rec->time_us = (u32)timer_get_us();
 +		rec->name = name;
 +	}
 +%sreturn rec->time_us;
@@ -210,7 +221,7 @@ index 0000000..2234c87
         self.assertEqual(result.errors, 0)
         self.assertEqual(result.warnings, 0)
         self.assertEqual(result.checks, 0)
-        self.assertEqual(result.lines, 56)
+        self.assertEqual(result.lines, 62)
         os.remove(inf)
 
     def testNoSignoff(self):
@@ -221,18 +232,18 @@ index 0000000..2234c87
         self.assertEqual(result.errors, 1)
         self.assertEqual(result.warnings, 0)
         self.assertEqual(result.checks, 0)
-        self.assertEqual(result.lines, 56)
+        self.assertEqual(result.lines, 62)
         os.remove(inf)
 
     def testSpaces(self):
         inf = self.SetupData('spaces')
         result = checkpatch.CheckPatch(inf)
         self.assertEqual(result.ok, False)
-        self.assertEqual(len(result.problems), 2)
+        self.assertEqual(len(result.problems), 3)
         self.assertEqual(result.errors, 0)
-        self.assertEqual(result.warnings, 2)
+        self.assertEqual(result.warnings, 3)
         self.assertEqual(result.checks, 0)
-        self.assertEqual(result.lines, 56)
+        self.assertEqual(result.lines, 62)
         os.remove(inf)
 
     def testIndent(self):
@@ -243,7 +254,7 @@ index 0000000..2234c87
         self.assertEqual(result.errors, 0)
         self.assertEqual(result.warnings, 0)
         self.assertEqual(result.checks, 1)
-        self.assertEqual(result.lines, 56)
+        self.assertEqual(result.lines, 62)
         os.remove(inf)
 
 
Signature · 1 line
2.15.0.448.gf294e3d99a-goog
#16 lore raw

PATCH 9/26 test: Run patman tests

In reply to Simon Glass

Update the test script to run the patman tests also.

---

 test/run | 1 +
 1 file changed, 1 insertion(+)
test/run +1 -0
index b9ed3edb3e4..f18e36e05e2 100755
@@ -17,6 +17,7 @@ run_test ./test/py/test.py --bd sandbox_spl --build -k \
 ./test/py/test.py --bd sandbox_flattree --build
 
 PYTHONPATH=build-sandbox_spl/tools run_test ./tools/binman/binman -t
+run_test ./tools/patman/patman --test
 
 if [ $result == 0 ]; then
 	echo "Tests passed!"
Signature · 1 line
2.15.0.448.gf294e3d99a-goog
#17 lore raw

PATCH 10/26 buildman: Allow skipping of tests which use the network

In reply to Simon Glass

Accessing the network slows down the test and limits the environment in which it can be run. Add an option to disable network tests.

---

 tools/buildman/buildman.py | 6 ++++--
 tools/buildman/cmdline.py  | 2 ++
 tools/buildman/test.py     | 7 +++++--
 3 files changed, 11 insertions(+), 4 deletions(-)
tools/buildman/buildman.py +4 -2
index 607429df7bc..11a4f162c5f 100755
@@ -30,7 +30,7 @@ import patchstream
 import terminal
 import toolchain
 
-def RunTests():
+def RunTests(skip_net_tests):
     import func_test
     import test
     import doctest
@@ -41,6 +41,8 @@ def RunTests():
         suite.run(result)
 
     sys.argv = [sys.argv[0]]
+    if skip_net_tests:
+        test.use_network = False
     for module in (test.TestBuild, func_test.TestFunctional):
         suite = unittest.TestLoader().loadTestsFromTestCase(module)
         suite.run(result)
@@ -56,7 +58,7 @@ options, args = cmdline.ParseArgs()
 
 # Run our meagre tests
 if options.test:
-    RunTests()
+    RunTests(options.skip_net_tests)
 
 # Build selected commits for selected boards
 else:
tools/buildman/cmdline.py +2 -0
index 0060e0317c7..74247f0aff1 100644
@@ -82,6 +82,8 @@ def ParseArgs():
           default=False, help='Show a build summary')
     parser.add_option('-S', '--show-sizes', action='store_true',
           default=False, help='Show image size variation in summary')
+    parser.add_option('--skip-net-tests', action='store_true', default=False,
+                      help='Skip tests which need the network')
     parser.add_option('--step', type='int',
           default=1, help='Only build every n commits (0=just first and last)')
     parser.add_option('-t', '--test', action='store_true', dest='test',
tools/buildman/test.py +5 -2
index 53ebc3756c9..e81400f3725 100644
@@ -24,6 +24,8 @@ import commit
 import terminal
 import toolchain
 
+use_network = True
+
 settings_data = '''
 # Buildman settings file
 
@@ -410,8 +412,9 @@ class TestBuild(unittest.TestCase):
 
     def testToolchainDownload(self):
         """Test that we can download toolchains"""
-        self.assertEqual('https://www.kernel.org/pub/tools/crosstool/files/bin/x86_64/4.9.0/x86_64-gcc-4.9.0-nolibc_arm-unknown-linux-gnueabi.tar.xz',
-            self.toolchains.LocateArchUrl('arm'))
+        if use_network:
+            self.assertEqual('https://www.kernel.org/pub/tools/crosstool/files/bin/x86_64/4.9.0/x86_64-gcc-4.9.0-nolibc_arm-unknown-linux-gnueabi.tar.xz',
+                self.toolchains.LocateArchUrl('arm'))
 
 
 if __name__ == "__main__":
Signature · 1 line
2.15.0.448.gf294e3d99a-goog
#19 lore raw

PATCH 11/26 buildman: Fix up tests

In reply to Simon Glass

The tests were broken by two separate commits which adjusted the output when boards are listed. Fix this by adding back a PowerPC board and putting the name of each board in the test.

Fixes b9f7d881 (powerpc, 5xx: remove some "5xx" remains)
Fixes 8d7523c5 (buildman: Allow showing the list of boards with -n)

---

 tools/buildman/test.py | 31 +++++++++++++++++++++----------
 1 file changed, 21 insertions(+), 10 deletions(-)
tools/buildman/test.py +21 -10
index e81400f3725..e564a8a142f 100644
@@ -91,6 +91,7 @@ boards = [
     ['Active', 'arm', 'armv7', '', 'Tester', 'ARM Board 1', 'board0',  ''],
     ['Active', 'arm', 'armv7', '', 'Tester', 'ARM Board 2', 'board1', ''],
     ['Active', 'powerpc', 'powerpc', '', 'Tester', 'PowerPC board 1', 'board2', ''],
+    ['Active', 'powerpc', 'mpc83xx', '', 'Tester', 'PowerPC board 2', 'board3', ''],
     ['Active', 'sandbox', 'sandbox', '', 'Tester', 'Sandbox board', 'board4', ''],
 ]
 
@@ -313,50 +314,60 @@ class TestBuild(unittest.TestCase):
     def testBoardSingle(self):
         """Test single board selection"""
         self.assertEqual(self.boards.SelectBoards(['sandbox']),
-                         {'all': 1, 'sandbox': 1})
+                         {'all': ['board4'], 'sandbox': ['board4']})
 
     def testBoardArch(self):
         """Test single board selection"""
         self.assertEqual(self.boards.SelectBoards(['arm']),
-                         {'all': 2, 'arm': 2})
+                         {'all': ['board0', 'board1'],
+                          'arm': ['board0', 'board1']})
 
     def testBoardArchSingle(self):
         """Test single board selection"""
         self.assertEqual(self.boards.SelectBoards(['arm sandbox']),
-                         {'all': 3, 'arm': 2, 'sandbox' : 1})
+                         {'sandbox': ['board4'],
+                          'all': ['board0', 'board1', 'board4'],
+                          'arm': ['board0', 'board1']})
+
 
     def testBoardArchSingleMultiWord(self):
         """Test single board selection"""
         self.assertEqual(self.boards.SelectBoards(['arm', 'sandbox']),
-                         {'all': 3, 'arm': 2, 'sandbox' : 1})
+                         {'sandbox': ['board4'], 'all': ['board0', 'board1', 'board4'], 'arm': ['board0', 'board1']})
 
     def testBoardSingleAnd(self):
         """Test single board selection"""
         self.assertEqual(self.boards.SelectBoards(['Tester & arm']),
-                         {'all': 2, 'Tester&arm': 2})
+                         {'Tester&arm': ['board0', 'board1'], 'all': ['board0', 'board1']})
 
     def testBoardTwoAnd(self):
         """Test single board selection"""
         self.assertEqual(self.boards.SelectBoards(['Tester', '&', 'arm',
                                                    'Tester' '&', 'powerpc',
                                                    'sandbox']),
-                         {'all': 5, 'Tester&powerpc': 2, 'Tester&arm': 2,
-                          'sandbox' : 1})
+                         {'sandbox': ['board4'],
+                          'all': ['board0', 'board1', 'board2', 'board3',
+                                  'board4'],
+                          'Tester&powerpc': ['board2', 'board3'],
+                          'Tester&arm': ['board0', 'board1']})
 
     def testBoardAll(self):
         """Test single board selection"""
-        self.assertEqual(self.boards.SelectBoards([]), {'all': 5})
+        self.assertEqual(self.boards.SelectBoards([]),
+                         {'all': ['board0', 'board1', 'board2', 'board3',
+                                  'board4']})
 
     def testBoardRegularExpression(self):
         """Test single board selection"""
         self.assertEqual(self.boards.SelectBoards(['T.*r&^Po']),
-                         {'T.*r&^Po': 2, 'all': 2})
+                         {'all': ['board2', 'board3'],
+                          'T.*r&^Po': ['board2', 'board3']})
 
     def testBoardDuplicate(self):
         """Test single board selection"""
         self.assertEqual(self.boards.SelectBoards(['sandbox sandbox',
                                                    'sandbox']),
-                         {'all': 1, 'sandbox': 1})
+                         {'all': ['board4'], 'sandbox': ['board4']})
     def CheckDirs(self, build, dirname):
         self.assertEqual('base%s' % dirname, build._GetOutputDir(1))
         self.assertEqual('base%s/fred' % dirname,
Signature · 1 line
2.15.0.448.gf294e3d99a-goog
#21 lore raw

PATCH 12/26 test: Run buildman tests

In reply to Simon Glass

Update the test script to run the buildman tests also.

---

 test/run | 1 +
 1 file changed, 1 insertion(+)
test/run +1 -0
index f18e36e05e2..f695f2ecc5d 100755
@@ -18,6 +18,7 @@ run_test ./test/py/test.py --bd sandbox_spl --build -k \
 
 PYTHONPATH=build-sandbox_spl/tools run_test ./tools/binman/binman -t
 run_test ./tools/patman/patman --test
+run_test ./tools/buildman/buildman -t
 
 if [ $result == 0 ]; then
 	echo "Tests passed!"
Signature · 1 line
2.15.0.448.gf294e3d99a-goog
#22 lore raw

PATCH 13/26 dtoc: Fix up tests

In reply to Simon Glass

The tool has changed slightly since it was originally written. Update the tests to suit.

---

 tools/dtoc/test_dtoc.py | 82 ++++++++++++++++++++++---------------------------
 1 file changed, 37 insertions(+), 45 deletions(-)
tools/dtoc/test_dtoc.py +37 -45
index cc009b2a256..41ed80e6dad 100644
@@ -26,6 +26,27 @@ import tools
 our_path = os.path.dirname(os.path.realpath(__file__))
 
 
+HEADER = '''/*
+ * DO NOT MODIFY
+ *
+ * This file was generated by dtoc from a .dtb (device tree binary) file.
+ */
+
+#include <stdbool.h>
+#include <libfdt.h>'''
+
+C_HEADER = '''/*
+ * DO NOT MODIFY
+ *
+ * This file was generated by dtoc from a .dtb (device tree binary) file.
+ */
+
+#include <common.h>
+#include <dm.h>
+#include <dt-structs.h>
+'''
+
+
 def get_dtb_file(dts_fname):
     """Compile a .dts file to a .dtb
 
@@ -104,13 +125,12 @@ class TestDtoc(unittest.TestCase):
         dtb_platdata.run_steps(['struct'], dtb_file, False, output)
         with open(output) as infile:
             lines = infile.read().splitlines()
-        self.assertEqual(['#include <stdbool.h>', '#include <libfdt.h>'], lines)
+        self.assertEqual(HEADER.splitlines(), lines)
 
         dtb_platdata.run_steps(['platdata'], dtb_file, False, output)
         with open(output) as infile:
             lines = infile.read().splitlines()
-        self.assertEqual(['#include <common.h>', '#include <dm.h>',
-                          '#include <dt-structs.h>', ''], lines)
+        self.assertEqual(C_HEADER.splitlines() + [''], lines)
 
     def test_simple(self):
         """Test output from some simple nodes with various types of data"""
@@ -119,8 +139,7 @@ class TestDtoc(unittest.TestCase):
         dtb_platdata.run_steps(['struct'], dtb_file, False, output)
         with open(output) as infile:
             data = infile.read()
-        self.assertEqual('''#include <stdbool.h>
-#include <libfdt.h>
+        self.assertEqual(HEADER + '''
 struct dtd_sandbox_i2c_test {
 };
 struct dtd_sandbox_pmic_test {
@@ -144,10 +163,7 @@ struct dtd_sandbox_spl_test_2 {
         dtb_platdata.run_steps(['platdata'], dtb_file, False, output)
         with open(output) as infile:
             data = infile.read()
-        self.assertEqual('''#include <common.h>
-#include <dm.h>
-#include <dt-structs.h>
-
+        self.assertEqual(C_HEADER + '''
 static struct dtd_sandbox_spl_test dtv_spl_test = {
 \t.bytearray\t\t= {0x6, 0x0, 0x0},
 \t.byteval\t\t= 0x5,
@@ -225,8 +241,7 @@ U_BOOT_DEVICE(pmic_at_9) = {
         dtb_platdata.run_steps(['struct'], dtb_file, False, output)
         with open(output) as infile:
             data = infile.read()
-        self.assertEqual('''#include <stdbool.h>
-#include <libfdt.h>
+        self.assertEqual(HEADER + '''
 struct dtd_source {
 \tstruct phandle_2_arg clocks[4];
 };
@@ -238,10 +253,7 @@ struct dtd_target {
         dtb_platdata.run_steps(['platdata'], dtb_file, False, output)
         with open(output) as infile:
             data = infile.read()
-        self.assertEqual('''#include <common.h>
-#include <dm.h>
-#include <dt-structs.h>
-
+        self.assertEqual(C_HEADER + '''
 static struct dtd_target dtv_phandle_target = {
 \t.intval\t\t\t= 0x0,
 };
@@ -291,8 +303,7 @@ U_BOOT_DEVICE(phandle_source) = {
         dtb_platdata.run_steps(['struct'], dtb_file, False, output)
         with open(output) as infile:
             data = infile.read()
-        self.assertEqual('''#include <stdbool.h>
-#include <libfdt.h>
+        self.assertEqual(HEADER + '''
 struct dtd_compat1 {
 \tfdt32_t\t\tintval;
 };
@@ -303,10 +314,7 @@ struct dtd_compat1 {
         dtb_platdata.run_steps(['platdata'], dtb_file, False, output)
         with open(output) as infile:
             data = infile.read()
-        self.assertEqual('''#include <common.h>
-#include <dm.h>
-#include <dt-structs.h>
-
+        self.assertEqual(C_HEADER + '''
 static struct dtd_compat1 dtv_spl_test = {
 \t.intval\t\t\t= 0x1,
 };
@@ -325,8 +333,7 @@ U_BOOT_DEVICE(spl_test) = {
         dtb_platdata.run_steps(['struct'], dtb_file, False, output)
         with open(output) as infile:
             data = infile.read()
-        self.assertEqual('''#include <stdbool.h>
-#include <libfdt.h>
+        self.assertEqual(HEADER + '''
 struct dtd_test1 {
 \tfdt64_t\t\treg[2];
 };
@@ -341,10 +348,7 @@ struct dtd_test3 {
         dtb_platdata.run_steps(['platdata'], dtb_file, False, output)
         with open(output) as infile:
             data = infile.read()
-        self.assertEqual('''#include <common.h>
-#include <dm.h>
-#include <dt-structs.h>
-
+        self.assertEqual(C_HEADER + '''
 static struct dtd_test1 dtv_test1 = {
 \t.reg\t\t\t= {0x1234, 0x5678},
 };
@@ -381,8 +385,7 @@ U_BOOT_DEVICE(test3) = {
         dtb_platdata.run_steps(['struct'], dtb_file, False, output)
         with open(output) as infile:
             data = infile.read()
-        self.assertEqual('''#include <stdbool.h>
-#include <libfdt.h>
+        self.assertEqual(HEADER + '''
 struct dtd_test1 {
 \tfdt32_t\t\treg[2];
 };
@@ -394,10 +397,7 @@ struct dtd_test2 {
         dtb_platdata.run_steps(['platdata'], dtb_file, False, output)
         with open(output) as infile:
             data = infile.read()
-        self.assertEqual('''#include <common.h>
-#include <dm.h>
-#include <dt-structs.h>
-
+        self.assertEqual(C_HEADER + '''
 static struct dtd_test1 dtv_test1 = {
 \t.reg\t\t\t= {0x1234, 0x5678},
 };
@@ -425,8 +425,7 @@ U_BOOT_DEVICE(test2) = {
         dtb_platdata.run_steps(['struct'], dtb_file, False, output)
         with open(output) as infile:
             data = infile.read()
-        self.assertEqual('''#include <stdbool.h>
-#include <libfdt.h>
+        self.assertEqual(HEADER + '''
 struct dtd_test1 {
 \tfdt64_t\t\treg[2];
 };
@@ -441,10 +440,7 @@ struct dtd_test3 {
         dtb_platdata.run_steps(['platdata'], dtb_file, False, output)
         with open(output) as infile:
             data = infile.read()
-        self.assertEqual('''#include <common.h>
-#include <dm.h>
-#include <dt-structs.h>
-
+        self.assertEqual(C_HEADER + '''
 static struct dtd_test1 dtv_test1 = {
 \t.reg\t\t\t= {0x123400000000, 0x5678},
 };
@@ -481,8 +477,7 @@ U_BOOT_DEVICE(test3) = {
         dtb_platdata.run_steps(['struct'], dtb_file, False, output)
         with open(output) as infile:
             data = infile.read()
-        self.assertEqual('''#include <stdbool.h>
-#include <libfdt.h>
+        self.assertEqual(HEADER + '''
 struct dtd_test1 {
 \tfdt64_t\t\treg[2];
 };
@@ -497,10 +492,7 @@ struct dtd_test3 {
         dtb_platdata.run_steps(['platdata'], dtb_file, False, output)
         with open(output) as infile:
             data = infile.read()
-        self.assertEqual('''#include <common.h>
-#include <dm.h>
-#include <dt-structs.h>
-
+        self.assertEqual(C_HEADER + '''
 static struct dtd_test1 dtv_test1 = {
 \t.reg\t\t\t= {0x1234, 0x567800000000},
 };
Signature · 1 line
2.15.0.448.gf294e3d99a-goog
#24 lore raw

PATCH 14/26 test: Run dtoc tests

In reply to Simon Glass

Update the test script to run the dtoc tests also.

---

 test/run | 1 +
 1 file changed, 1 insertion(+)
test/run +1 -0
index f695f2ecc5d..d40a5cdc807 100755
@@ -19,6 +19,7 @@ run_test ./test/py/test.py --bd sandbox_spl --build -k \
 PYTHONPATH=build-sandbox_spl/tools run_test ./tools/binman/binman -t
 run_test ./tools/patman/patman --test
 run_test ./tools/buildman/buildman -t
+PYTHONPATH=build-sandbox_spl/tools run_test ./tools/dtoc/dtoc -t
 
 if [ $result == 0 ]; then
 	echo "Tests passed!"
Signature · 1 line
2.15.0.448.gf294e3d99a-goog
#25 lore raw

PATCH 15/26 binman: Append to PYTHONPATH when running test coverage

In reply to Simon Glass

Rather that overwrite this, append to it, in case the caller has already set up the path correctly.

---

 tools/binman/binman.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/binman/binman.py +1 -1
index d264bcdfa8c..963d43a3761 100755
@@ -58,7 +58,7 @@ def RunTests():
 def RunTestCoverage():
     """Run the tests and check that we get 100% coverage"""
     # This uses the build output from sandbox_spl to get _libfdt.so
-    cmd = ('PYTHONPATH=%s/sandbox_spl/tools coverage run '
+    cmd = ('PYTHONPATH=$PYTHONPATH:%s/sandbox_spl/tools coverage run '
             '--include "tools/binman/*.py" --omit "*test*,*binman.py" '
             'tools/binman/binman.py -t' % options.build_dir)
     os.system(cmd)
Signature · 1 line
2.15.0.448.gf294e3d99a-goog
#27 lore raw

PATCH 16/26 binman: Set up 'entry' to permit full test coverage

In reply to Simon Glass

There is a little check at the top of entry.py which decides if importlib is available. At present this has no test coverage. To add this we will need to import the module twice, once with importlib and once without. In preparation for allowing a test to control the importing of this module, remove all global imports of the 'entry' module.

---

 tools/binman/entry_test.py | 4 ++--
 tools/binman/ftest.py      | 4 +++-
 tools/binman/image.py      | 7 +++++--
 3 files changed, 10 insertions(+), 5 deletions(-)
tools/binman/entry_test.py +2 -2
index 8a9ae017f03..85c4196892f 100644
@@ -9,16 +9,16 @@
 import collections
 import unittest
 
-import entry
-
 class TestEntry(unittest.TestCase):
     def testEntryContents(self):
         """Test the Entry bass class"""
+        import entry
         base_entry = entry.Entry(None, None, None, read_node=False)
         self.assertEqual(True, base_entry.ObtainContents())
 
     def testUnknownEntry(self):
         """Test that unknown entry types are detected"""
+        import entry
         Node = collections.namedtuple('Node', ['name', 'path'])
         node = Node('invalid-name', 'invalid-path')
         with self.assertRaises(ValueError) as e:
tools/binman/ftest.py +3 -1
index c4207ce5d29..eae1ab1c4b1 100644
@@ -20,7 +20,6 @@ import binman
 import cmdline
 import command
 import control
-import entry
 import fdt
 import fdt_util
 import tools
@@ -56,6 +55,9 @@ class TestFunctional(unittest.TestCase):
     """
     @classmethod
     def setUpClass(self):
+        global entry
+        import entry
+
         # Handle the case where argv[0] is 'python'
         self._binman_dir = os.path.dirname(os.path.realpath(sys.argv[0]))
         self._binman_pathname = os.path.join(self._binman_dir, 'binman')
tools/binman/image.py +5 -2
index 07fc9306659..24c4f6f578a 100644
@@ -9,8 +9,6 @@
 from collections import OrderedDict
 from operator import attrgetter
 
-import entry
-from entry import Entry
 import fdt_util
 import tools
 
@@ -48,6 +46,11 @@ class Image:
         _entries: OrderedDict() of entries
     """
     def __init__(self, name, node):
+        global entry
+        global Entry
+        import entry
+        from entry import Entry
+
         self._node = node
         self._name = name
         self._size = None
Signature · 1 line
2.15.0.448.gf294e3d99a-goog
#29 lore raw

PATCH 17/26 binman: Add tests for importlib availability

In reply to Simon Glass

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.

---

 tools/binman/binman.py     |  8 ++++++--
 tools/binman/entry_test.py | 30 ++++++++++++++++++++++++++++++
 2 files changed, 36 insertions(+), 2 deletions(-)
tools/binman/binman.py +6 -2
index 963d43a3761..cf83edfd044 100755
@@ -44,8 +44,12 @@ def RunTests():
         suite.run(result)
 
     sys.argv = [sys.argv[0]]
-    for module in (ftest.TestFunctional, fdt_test.TestFdt,
-                   entry_test.TestEntry):
+
+    # Run the entry tests first ,since these need to be the first to import the
+    # 'entry' module.
+    suite = unittest.TestLoader().loadTestsFromTestCase(entry_test.TestEntry)
+    suite.run(result)
+    for module in (ftest.TestFunctional, fdt_test.TestFdt):
         suite = unittest.TestLoader().loadTestsFromTestCase(module)
         suite.run(result)
 
tools/binman/entry_test.py +30 -0
index 85c4196892f..789b26fd9f5 100644
@@ -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
Signature · 1 line
2.15.0.448.gf294e3d99a-goog
#31 lore raw

PATCH 18/26 binman: Add a main program to the tests

In reply to Simon Glass

Add a main program so that the tests can be executed directly, without going through the main binman program.

---

 tools/binman/entry_test.py | 4 ++++
 tools/binman/ftest.py      | 4 ++++
 2 files changed, 8 insertions(+)
tools/binman/entry_test.py +4 -0
index 789b26fd9f5..caa523ebf89 100644
@@ -55,3 +55,7 @@ class TestEntry(unittest.TestCase):
             entry.Entry.Create(None, node, node.name)
         self.assertIn("Unknown entry type 'invalid-name' in node "
                       "'invalid-path'", str(e.exception))
+
+
+if __name__ == "__main__":
+    unittest.main()
tools/binman/ftest.py +4 -0
index eae1ab1c4b1..539ebc57f57 100644
@@ -813,3 +813,7 @@ class TestFunctional(unittest.TestCase):
         """Test that an image with a VBT binary can be created"""
         data = self._DoReadFile('46_intel-vbt.dts')
         self.assertEqual(VBT_DATA, data[:len(VBT_DATA)])
+
+
+if __name__ == "__main__":
+    unittest.main()
Signature · 1 line
2.15.0.448.gf294e3d99a-goog
#33 lore raw

PATCH 19/26 binman: Increase test coverage back to 100%

In reply to Simon Glass

Make a minor tweak to fix test coverage.

---

 tools/binman/etype/u_boot_ucode.py | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)
tools/binman/etype/u_boot_ucode.py +4 -7
index 8e51e99a119..f9f434d2cc2 100644
@@ -58,13 +58,10 @@ class Entry_u_boot_ucode(Entry_blob):
     def ObtainContents(self):
         # If the image does not need microcode, there is nothing to do
         ucode_dest_entry = self.image.FindEntryType('u-boot-with-ucode-ptr')
-        if ucode_dest_entry and not ucode_dest_entry.target_pos:
-            self.data = ''
-            return True
-
-        # Handle microcode in SPL image as well
-        ucode_dest_entry = self.image.FindEntryType('u-boot-spl-with-ucode-ptr')
-        if ucode_dest_entry and not ucode_dest_entry.target_pos:
+        ucode_dest_entry_spl = self.image.FindEntryType(
+            'u-boot-spl-with-ucode-ptr')
+        if ((not ucode_dest_entry or not ucode_dest_entry.target_pos) and
+            (not ucode_dest_entry_spl or not ucode_dest_entry_spl.target_pos)):
             self.data = ''
             return True
 
Signature · 1 line
2.15.0.448.gf294e3d99a-goog
#35 lore raw

PATCH 20/26 binman: Check for files missing from test coverage

In reply to Simon Glass

Files that are never imported are not shown in the test-coverage report. Detect these and show an error.

---

 tools/binman/binman.py | 22 +++++++++++++++++++---
 1 file changed, 19 insertions(+), 3 deletions(-)
tools/binman/binman.py +19 -3
index cf83edfd044..7ad4d3030b9 100755
@@ -10,6 +10,7 @@
 
 """See README for more information"""
 
+import glob
 import os
 import sys
 import traceback
@@ -67,12 +68,27 @@ def RunTestCoverage():
             'tools/binman/binman.py -t' % options.build_dir)
     os.system(cmd)
     stdout = command.Output('coverage', 'report')
-    coverage = stdout.splitlines()[-1].split(' ')[-1]
+    lines = stdout.splitlines()
+
+    test_set= set([os.path.basename(line.split()[0])
+                     for line in lines if '/etype/' in line])
+    glob_list = glob.glob(os.path.join(our_path, 'etype/*.py'))
+    all_set = set([os.path.basename(item) for item in glob_list])
+    missing_list = all_set
+    missing_list.difference_update(test_set)
+    missing_list.remove('_testing.py')
+    coverage = lines[-1].split(' ')[-1]
+    ok = True
+    if missing_list:
+        print 'Missing tests for %s' % (', '.join(missing_list))
+        ok = False
     if coverage != '100%':
         print stdout
         print "Type 'coverage html' to get a report in htmlcov/index.html"
-        raise ValueError('Coverage error: %s, but should be 100%%' % coverage)
-
+        print 'Coverage error: %s, but should be 100%%' % coverage
+        ok = False
+    if not ok:
+      raise ValueError('Test coverage failure')
 
 def RunBinman(options, args):
     """Main entry point to binman once arguments are parsed
Signature · 1 line
2.15.0.448.gf294e3d99a-goog
#37 lore raw

PATCH 21/26 binman: Add test for u-boot-spl-bss-pad

In reply to Simon Glass

Add a test that we can pad the BSS with zero bytes.

---

 tools/binman/ftest.py                |   9 +++++++++
 tools/binman/test/47_spl_bss_pad.dts |  17 +++++++++++++++++
 tools/binman/test/Makefile           |   5 ++++-
 tools/binman/test/bss_data           | Bin 0 -> 5020 bytes
 tools/binman/test/bss_data.c         |  18 ++++++++++++++++++
 tools/binman/test/bss_data.lds       |  16 ++++++++++++++++
 6 files changed, 64 insertions(+), 1 deletion(-)
 create mode 100644 tools/binman/test/47_spl_bss_pad.dts
 create mode 100755 tools/binman/test/bss_data
 create mode 100644 tools/binman/test/bss_data.c
 create mode 100644 tools/binman/test/bss_data.lds
tools/binman/ftest.py +9 -0
index 539ebc57f57..4e6aaad9d6b 100644
@@ -88,6 +88,10 @@ class TestFunctional(unittest.TestCase):
         with open(self.TestFile('descriptor.bin')) as fd:
             TestFunctional._MakeInputFile('descriptor.bin', fd.read())
 
+        # ELF file with a '__bss_size' symbol
+        with open(self.TestFile('bss_data')) as fd:
+            TestFunctional._MakeInputFile('spl/u-boot-spl', fd.read())
+
     @classmethod
     def tearDownClass(self):
         """Remove the temporary input directory and its contents"""
@@ -814,6 +818,11 @@ class TestFunctional(unittest.TestCase):
         data = self._DoReadFile('46_intel-vbt.dts')
         self.assertEqual(VBT_DATA, data[:len(VBT_DATA)])
 
+    def testSplBssPad(self):
+        """Test that we can pad SPL's BSS with zeros"""
+        data = self._DoReadFile('47_spl_bss_pad.dts')
+        self.assertEqual(U_BOOT_SPL_DATA + (chr(0) * 10) + U_BOOT_DATA, data)
+
 
 if __name__ == "__main__":
     unittest.main()
tools/binman/test/47_spl_bss_pad.dts new file +17 -0
new file mode 100644
index 00000000000..6bd88b83f98
@@ -0,0 +1,17 @@
+/dts-v1/;
+
+/ {
+	#address-cells = <1>;
+	#size-cells = <1>;
+
+	binman {
+		u-boot-spl {
+		};
+
+		u-boot-spl-bss-pad {
+		};
+
+		u-boot {
+		};
+	};
+};
tools/binman/test/Makefile +4 -1
index 786d1b05778..217d13c666f 100644
@@ -11,7 +11,7 @@ CFLAGS := -march=i386 -m32 -nostdlib -I ../../../include
 
 LDS_UCODE := -T u_boot_ucode_ptr.lds
 
-TARGETS = u_boot_ucode_ptr u_boot_no_ucode_ptr
+TARGETS = u_boot_ucode_ptr u_boot_no_ucode_ptr bss_data
 
 all: $(TARGETS)
 
@@ -21,6 +21,9 @@ u_boot_no_ucode_ptr: u_boot_no_ucode_ptr.c
 u_boot_ucode_ptr: CFLAGS += $(LDS_UCODE)
 u_boot_ucode_ptr: u_boot_ucode_ptr.c
 
+bss_data: CFLAGS += bss_data.lds
+bss_data: bss_data.c
+
 clean:
 	rm -f $(TARGETS)
 
tools/binman/test/bss_data new file binary +0 -0
new file mode 100755
index 0000000000000000000000000000000000000000..afa28282aa157f6717c1ba244ecbfc6e1b081734
GIT binary patch

z1rlm016r?sner~AE2ip9R*N at 0-1AWbnc8lqu#)$M-R39(#6N?0tS?>89s-Vl5+C zVfN$CU=YG at j+l{90?A29j!9mR>*@<XFTe^W5IGjX=Xp3hjGA1SOyLOtTX>YU at kF< zm|&e)-boq-EK+#s=ZTZ35qA7G#*zMGT%X&LM}8Jqyj7L$-{T)<zJ0y(_Vh>Z{jc>) zoA)Lv)i*nzb0r)u1JV{C_dj{X>=n-EM(bagY)oQhvscm#Cw|eiUr?)4Z<nZh%N9m z=h}(<tIYiI-10UUoZ-wV;1qBQI0c*nP64NYQ@|<U6mSYS1)Ks0M}ZQKvbeBtIVe@@ z{Z7&kLN%wtsf&G%{-e4)pV$4&zic3>OE;EwK{y#HNI)1&RP<yN1eW^_gjw}Q>})m zBwkNM#m(qpx7LoMW}~~GiE7l6ny7lOCu()A-HtoS|Lal&^)SHCcil&Tp9HMgPjH0- zzvtN-*hQ~l7v6r;Bi!p{glWw6bl(A!hIw|q5|6_-b4W29BS4qZwUqN%N~U8gQR^A zrZmf|AkG8i1!zb3;PIVU3)0{&JlC5}bMnrmF&)Q<Q9$nrPrCr#109(ka%l8?R%_)k z^iEJbiUPs&VX7PfhSyse7rBm_HM^e8hdtj5bJI~WkUPBOr1?cA%anPt}1QCfA)M zt&hodCyAl9EN;T^Iehs!uw(Sh3-I>2Mv+e-r{#_QQVFIo;@!(Jhvxj;Qe&}5sc3w z=l$WG7=v<r=lkP1xr)3z#1~xah!<R~N)$2awKn3tszkk{)=lh?j@z|XN1|B&E26m5 FkiP*om$v_

literal 0
HcmV?d00001

tools/binman/test/bss_data.c new file +18 -0
new file mode 100644
index 00000000000..f865a9d9f67
@@ -0,0 +1,18 @@
+/*
+ * Copyright (c) 2016 Google, Inc
+ *
+ * SPDX-License-Identifier:     GPL-2.0+
+ *
+ * Simple program to create a _dt_ucode_base_size symbol which can be read
+ * by 'nm'. This is used by binman tests.
+ */
+
+int bss_data[10];
+int __bss_size = sizeof(bss_data);
+
+int main()
+{
+	bss_data[2] = 2;
+
+	return 0;
+}
tools/binman/test/bss_data.lds new file +16 -0
new file mode 100644
index 00000000000..6b2fe09d351
@@ -0,0 +1,16 @@
+/*
+ * Copyright (c) 2016 Google, Inc
+ *
+ * SPDX-License-Identifier:      GPL-2.0+
+ */
+
+OUTPUT_FORMAT("elf32-i386", "elf32-i386", "elf32-i386")
+OUTPUT_ARCH(i386)
+ENTRY(_start)
+
+SECTIONS
+{
+	. = 0xfffffdf0;
+	_start = .;
+	__bss_size = 10;
+}
Signature · 1 line
2.15.0.448.gf294e3d99a-goog
#39 lore raw

PATCH 22/26 binman: Add a test for x86-start16-spl

In reply to Simon Glass

This allows us to put the 16-bit x86 start-up code in SPL. Add a test for it.

---

 tools/binman/ftest.py                    | 10 +++++++++-
 tools/binman/test/48_x86-start16-spl.dts | 13 +++++++++++++
 2 files changed, 22 insertions(+), 1 deletion(-)
 create mode 100644 tools/binman/test/48_x86-start16-spl.dts
tools/binman/ftest.py +9 -1
index 4e6aaad9d6b..c381a700311 100644
@@ -34,6 +34,7 @@ ME_DATA             = '0abcd'
 VGA_DATA            = 'vga'
 U_BOOT_DTB_DATA     = 'udtb'
 X86_START16_DATA    = 'start16'
+X86_START16_SPL_DATA = 'start16spl'
 U_BOOT_NODTB_DATA   = 'nodtb with microcode pointer somewhere in here'
 FSP_DATA            = 'fsp'
 CMC_DATA            = 'cmc'
@@ -74,6 +75,8 @@ class TestFunctional(unittest.TestCase):
         TestFunctional._MakeInputFile('vga.bin', VGA_DATA)
         TestFunctional._MakeInputFile('u-boot.dtb', U_BOOT_DTB_DATA)
         TestFunctional._MakeInputFile('u-boot-x86-16bit.bin', X86_START16_DATA)
+        TestFunctional._MakeInputFile('spl/u-boot-x86-16bit-spl.bin',
+                                      X86_START16_SPL_DATA)
         TestFunctional._MakeInputFile('u-boot-nodtb.bin', U_BOOT_NODTB_DATA)
         TestFunctional._MakeInputFile('fsp.bin', FSP_DATA)
         TestFunctional._MakeInputFile('cmc.bin', CMC_DATA)
@@ -677,7 +680,7 @@ class TestFunctional(unittest.TestCase):
 
         # Check that the microcode appears immediately after the Fdt
         # This matches the concatenation of the data properties in
-        # the /microcode/update at xxx nodes in x86_ucode.dts.
+        # the /microcode/update at xxx nodes in 34_x86_ucode.dts.
         ucode_data = struct.pack('>4L', 0x12345678, 0x12345679, 0xabcd0000,
                                  0x78235609)
         self.assertEqual(ucode_data, third[:len(ucode_data)])
@@ -823,6 +826,11 @@ class TestFunctional(unittest.TestCase):
         data = self._DoReadFile('47_spl_bss_pad.dts')
         self.assertEqual(U_BOOT_SPL_DATA + (chr(0) * 10) + U_BOOT_DATA, data)
 
+    def testPackStart16Spl(self):
+        """Test that an image with an x86 start16 region can be created"""
+        data = self._DoReadFile('48_x86-start16-spl.dts')
+        self.assertEqual(X86_START16_SPL_DATA, data[:len(X86_START16_SPL_DATA)])
+
 
 if __name__ == "__main__":
     unittest.main()
tools/binman/test/48_x86-start16-spl.dts new file +13 -0
new file mode 100644
index 00000000000..e2009f15f05
@@ -0,0 +1,13 @@
+/dts-v1/;
+
+/ {
+	#address-cells = <1>;
+	#size-cells = <1>;
+
+	binman {
+		size = <16>;
+
+		x86-start16-spl {
+		};
+	};
+};
Signature · 1 line
2.15.0.448.gf294e3d99a-goog
#41 lore raw

PATCH 23/26 binman: Add add test for SPL with a microcode pointer

In reply to Simon Glass

Add a test for this feature. It allows SPL to hold a pointer to the microcode block. This is used for 64-bit U-Boot on x86.

---

 tools/binman/etype/u_boot_spl_with_ucode_ptr.py |  2 +-
 tools/binman/ftest.py                           | 84 ++++++++++++++++---------
 tools/binman/test/49_x86_ucode_spl.dts          | 29 +++++++++
 3 files changed, 84 insertions(+), 31 deletions(-)
 create mode 100644 tools/binman/test/49_x86_ucode_spl.dts
tools/binman/etype/u_boot_spl_with_ucode_ptr.py +1 -1
index 1c6706df6db..7b25ccb0488 100644
@@ -25,4 +25,4 @@ class Entry_u_boot_spl_with_ucode_ptr(Entry_u_boot_with_ucode_ptr):
         self.elf_fname = 'spl/u-boot-spl'
 
     def GetDefaultFilename(self):
-        return 'spl/u-boot-spl.bin'
+        return 'spl/u-boot-spl-nodtb.bin'
tools/binman/ftest.py +54 -30

133 lines not on this page · raw message

tools/binman/test/49_x86_ucode_spl.dts new file +29 -0
new file mode 100644
index 00000000000..67db93ad502
@@ -0,0 +1,29 @@
+/dts-v1/;
+
+/ {
+	#address-cells = <1>;
+	#size-cells = <1>;
+
+	binman {
+		sort-by-pos;
+		end-at-4gb;
+		size = <0x200>;
+		u-boot-spl-with-ucode-ptr {
+		};
+
+		u-boot-dtb-with-ucode {
+		};
+
+		u-boot-ucode {
+		};
+	};
+
+	microcode {
+		update at 0 {
+			data = <0x12345678 0x12345679>;
+		};
+		update at 1 {
+			data = <0xabcd0000 0x78235609>;
+		};
+	};
+};
Signature · 1 line
2.15.0.448.gf294e3d99a-goog
#43 lore raw

PATCH 24/26 binman: Add add test for using an Intel MRC binary

In reply to Simon Glass

MRC (Memory Reference Code) is a binary blob used to set up the SDRAM controller on some Intel boards. Add a test for this feature.

With this test coverage on binman is back up to 100%.

---

 tools/binman/ftest.py              |  7 +++++++
 tools/binman/test/50_intel_mrc.dts | 13 +++++++++++++
 2 files changed, 20 insertions(+)
 create mode 100644 tools/binman/test/50_intel_mrc.dts
tools/binman/ftest.py +7 -0
index dff7448f08f..9083143894f 100644
@@ -40,6 +40,7 @@ U_BOOT_SPL_NODTB_DATA = 'splnodtb with microcode pointer somewhere in here'
 FSP_DATA              = 'fsp'
 CMC_DATA              = 'cmc'
 VBT_DATA              = 'vbt'
+MRC_DATA              = 'mrc'
 
 class TestFunctional(unittest.TestCase):
     """Functional tests for binman
@@ -84,6 +85,7 @@ class TestFunctional(unittest.TestCase):
         TestFunctional._MakeInputFile('fsp.bin', FSP_DATA)
         TestFunctional._MakeInputFile('cmc.bin', CMC_DATA)
         TestFunctional._MakeInputFile('vbt.bin', VBT_DATA)
+        TestFunctional._MakeInputFile('mrc.bin', MRC_DATA)
         self._output_setup = False
 
         # ELF file with a '_dt_ucode_base_size' symbol
@@ -855,6 +857,11 @@ class TestFunctional(unittest.TestCase):
         self.assertEqual('splnodtb with microc' + pos_and_size +
                          'ter somewhere in here', first)
 
+    def testPackMrc(self):
+        """Test that an image with an MRC binary can be created"""
+        data = self._DoReadFile('50_intel_mrc.dts')
+        self.assertEqual(MRC_DATA, data[:len(MRC_DATA)])
+
 
 if __name__ == "__main__":
     unittest.main()
tools/binman/test/50_intel_mrc.dts new file +13 -0
new file mode 100644
index 00000000000..54cd52a2b71
@@ -0,0 +1,13 @@
+/dts-v1/;
+
+/ {
+	#address-cells = <1>;
+	#size-cells = <1>;
+
+	binman {
+		size = <16>;
+
+		intel-mrc {
+		};
+	};
+};
Signature · 1 line
2.15.0.448.gf294e3d99a-goog
#45 lore raw

PATCH 25/26 binman: Return non-zero exit code on test failure

In reply to Simon Glass

Return exit code 1 when test fail so that callers can detect this.

---

 tools/binman/binman.py | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
tools/binman/binman.py +6 -2
index 7ad4d3030b9..3ccf25f1f88 100755
@@ -58,7 +58,11 @@ def RunTests():
     for test, err in result.errors:
         print test.id(), err
     for test, err in result.failures:
-        print err
+        print err, result.failures
+    if result.errors or result.failures:
+      print 'binman tests FAILED'
+      return 1
+    return 0
 
 def RunTestCoverage():
     """Run the tests and check that we get 100% coverage"""
@@ -106,7 +110,7 @@ def RunBinman(options, args):
         sys.tracebacklimit = 0
 
     if options.test:
-        RunTests()
+        ret_code = RunTests()
 
     elif options.test_coverage:
         RunTestCoverage()
Signature · 1 line
2.15.0.448.gf294e3d99a-goog
#47 lore raw

PATCH 26/26 RFC: binman: Run code coverage tests

In reply to Simon Glass

Binman has 100% test coverage for the code as it is at present. To encourage it to stay that way, run the code-coverage test as part of the normal U-Boot tests.

This is RFC because it requires the Python code coverage tools to be available.

---

 test/run | 6 ++++++
 1 file changed, 6 insertions(+)
test/run +6 -0
index d40a5cdc807..507c61a9e9c 100755
@@ -21,6 +21,12 @@ run_test ./tools/patman/patman --test
 run_test ./tools/buildman/buildman -t
 PYTHONPATH=build-sandbox_spl/tools 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/tools run_test ./tools/binman/binman -T
+
 if [ $result == 0 ]; then
 	echo "Tests passed!"
 else
Signature · 1 line
2.15.0.448.gf294e3d99a-goog
#42 lore raw

PATCH 23/26 binman: Add add test for SPL with a microcode pointer

In reply to Simon Glass

Add a test for this feature. It allows SPL to hold a pointer to the microcode block. This is used for 64-bit U-Boot on x86.

---

 tools/binman/etype/u_boot_spl_with_ucode_ptr.py |  2 +-
 tools/binman/ftest.py                           | 84 ++++++++++++++++---------
 tools/binman/test/49_x86_ucode_spl.dts          | 29 +++++++++
 3 files changed, 84 insertions(+), 31 deletions(-)
 create mode 100644 tools/binman/test/49_x86_ucode_spl.dts

Applied to u-boot-dm thanks!

#44 lore raw

PATCH 24/26 binman: Add add test for using an Intel MRC binary

In reply to Simon Glass

MRC (Memory Reference Code) is a binary blob used to set up the SDRAM controller on some Intel boards. Add a test for this feature.

With this test coverage on binman is back up to 100%.

---

 tools/binman/ftest.py              |  7 +++++++
 tools/binman/test/50_intel_mrc.dts | 13 +++++++++++++
 2 files changed, 20 insertions(+)
 create mode 100644 tools/binman/test/50_intel_mrc.dts

Applied to u-boot-dm thanks!

#40 lore raw

PATCH 22/26 binman: Add a test for x86-start16-spl

In reply to Simon Glass

This allows us to put the 16-bit x86 start-up code in SPL. Add a test for it.

---

 tools/binman/ftest.py                    | 10 +++++++++-
 tools/binman/test/48_x86-start16-spl.dts | 13 +++++++++++++
 2 files changed, 22 insertions(+), 1 deletion(-)
 create mode 100644 tools/binman/test/48_x86-start16-spl.dts

Applied to u-boot-dm thanks!

#36 lore raw

PATCH 20/26 binman: Check for files missing from test coverage

In reply to Simon Glass

Files that are never imported are not shown in the test-coverage report. Detect these and show an error.

---

 tools/binman/binman.py | 22 +++++++++++++++++++---
 1 file changed, 19 insertions(+), 3 deletions(-)

Applied to u-boot-dm thanks!

#38 lore raw

PATCH 21/26 binman: Add test for u-boot-spl-bss-pad

In reply to Simon Glass

Add a test that we can pad the BSS with zero bytes.

---

 tools/binman/ftest.py                |   9 +++++++++
 tools/binman/test/47_spl_bss_pad.dts |  17 +++++++++++++++++
 tools/binman/test/Makefile           |   5 ++++-
 tools/binman/test/bss_data           | Bin 0 -> 5020 bytes
 tools/binman/test/bss_data.c         |  18 ++++++++++++++++++
 tools/binman/test/bss_data.lds       |  16 ++++++++++++++++
 6 files changed, 64 insertions(+), 1 deletion(-)
 create mode 100644 tools/binman/test/47_spl_bss_pad.dts
 create mode 100755 tools/binman/test/bss_data
 create mode 100644 tools/binman/test/bss_data.c
 create mode 100644 tools/binman/test/bss_data.lds

Applied to u-boot-dm thanks!

#32 lore raw

PATCH 18/26 binman: Add a main program to the tests

In reply to Simon Glass

Add a main program so that the tests can be executed directly, without going through the main binman program.

---

 tools/binman/entry_test.py | 4 ++++
 tools/binman/ftest.py      | 4 ++++
 2 files changed, 8 insertions(+)

Applied to u-boot-dm thanks!

#30 lore raw

PATCH 17/26 binman: Add tests for importlib availability

In reply to Simon Glass

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.

---

 tools/binman/binman.py     |  8 ++++++--
 tools/binman/entry_test.py | 30 ++++++++++++++++++++++++++++++
 2 files changed, 36 insertions(+), 2 deletions(-)

Applied to u-boot-dm thanks!

#28 lore raw

PATCH 16/26 binman: Set up 'entry' to permit full test coverage

In reply to Simon Glass

There is a little check at the top of entry.py which decides if importlib is available. At present this has no test coverage. To add this we will need to import the module twice, once with importlib and once without. In preparation for allowing a test to control the importing of this module, remove all global imports of the 'entry' module.

---

 tools/binman/entry_test.py | 4 ++--
 tools/binman/ftest.py      | 4 +++-
 tools/binman/image.py      | 7 +++++--
 3 files changed, 10 insertions(+), 5 deletions(-)

Applied to u-boot-dm thanks!

#20 lore raw

PATCH 11/26 buildman: Fix up tests

In reply to Simon Glass

The tests were broken by two separate commits which adjusted the output when boards are listed. Fix this by adding back a PowerPC board and putting the name of each board in the test.

Fixes b9f7d881 (powerpc, 5xx: remove some "5xx" remains)
Fixes 8d7523c5 (buildman: Allow showing the list of boards with -n)

---

 tools/buildman/test.py | 31 +++++++++++++++++++++----------
 1 file changed, 21 insertions(+), 10 deletions(-)

Applied to u-boot-dm thanks!

#18 lore raw

PATCH 10/26 buildman: Allow skipping of tests which use the network

In reply to Simon Glass

Accessing the network slows down the test and limits the environment in which it can be run. Add an option to disable network tests.

---

 tools/buildman/buildman.py | 6 ++++--
 tools/buildman/cmdline.py  | 2 ++
 tools/buildman/test.py     | 7 +++++--
 3 files changed, 11 insertions(+), 4 deletions(-)

Applied to u-boot-dm thanks!

#12 lore raw

PATCH 6/26 test/run: Report and return failure

In reply to Simon Glass

This script runs the tests but does not report failure. Also it always returns an exit code of 0 even on failure.

Fix these problems by checking the result of each test.

---

 test/run | 20 +++++++++++++++++---
 1 file changed, 17 insertions(+), 3 deletions(-)

Applied to u-boot-dm thanks!

#8 lore raw

PATCH 4/26 binman: Rename tests to ftest

In reply to Simon Glass

At present these tests use the same filename as patman. This adds confusion when running all tests, since error messages look very similar. In fact binman tries to run the wrong tests at present.

Rename the tests.

---

 tools/binman/binman.py                  | 4 ++--
 tools/binman/{func_test.py => ftest.py} | 0
 2 files changed, 2 insertions(+), 2 deletions(-)
 rename tools/binman/{func_test.py => ftest.py} (100%)

Applied to u-boot-dm thanks!

#6 lore raw

PATCH 3/26 binman: Add a Makefile for test-program compilation

In reply to Simon Glass

These test programs are includedd as binary files in U-Boot to avoid having to build them (and associated toolchain differences). Instructions on building are in the files themselves, but it seems better to provide a Makefile which can be manually run when desired.

Add a Makefile, separate from the normal build system, to handle this.

---

 tools/binman/test/Makefile              | 36 +++++++++++++++++++++++++++++++++
 tools/binman/test/u_boot_no_ucode_ptr.c |  4 ----
 tools/binman/test/u_boot_ucode_ptr.c    |  4 ----
 3 files changed, 36 insertions(+), 8 deletions(-)
 create mode 100644 tools/binman/test/Makefile

Applied to u-boot-dm thanks!

#2 lore raw

PATCH 1/26 binman: Add better Makefile debugging

In reply to Simon Glass

There is a debugging option in the Makefile to allow people to figure out which u-boot.dtsi files are used in the build. But is it not easy to use since it only shows files it finds, not those it is looking for. Update it and update the mention of it to the docs.

---

 scripts/Makefile.lib | 18 ++++++++++++++----
 tools/binman/README  |  3 ++-
 2 files changed, 16 insertions(+), 5 deletions(-)

Applied to u-boot-dm thanks!