[PATCH 10/17] dm: test: Build tests for SPL

Simon Glass sjg at chromium.org
Sat Oct 3 17:25:27 CEST 2020


We want to run unit tests in SPL. Add a new Kconfig to control this and
enable it for sandbox_spl

Signed-off-by: Simon Glass <sjg at chromium.org>
---

 configs/sandbox_spl_defconfig |  2 +-
 scripts/Makefile.spl          |  1 +
 test/Kconfig                  | 10 ++++++++++
 3 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/configs/sandbox_spl_defconfig b/configs/sandbox_spl_defconfig
index 6d8e827aebc..49060cab7a3 100644
--- a/configs/sandbox_spl_defconfig
+++ b/configs/sandbox_spl_defconfig
@@ -22,7 +22,6 @@ CONFIG_BOOTSTAGE_STASH=y
 CONFIG_BOOTSTAGE_STASH_SIZE=0x4096
 CONFIG_CONSOLE_RECORD=y
 CONFIG_CONSOLE_RECORD_OUT_SIZE=0x1000
-CONFIG_SILENT_CONSOLE=y
 CONFIG_DISPLAY_BOARDINFO_LATE=y
 CONFIG_HANDOFF=y
 CONFIG_SPL_BOARD_INIT=y
@@ -220,5 +219,6 @@ CONFIG_TPM=y
 CONFIG_LZ4=y
 CONFIG_ERRNO_STR=y
 CONFIG_UNIT_TEST=y
+CONFIG_SPL_UNIT_TEST=y
 CONFIG_UT_TIME=y
 CONFIG_UT_DM=y
diff --git a/scripts/Makefile.spl b/scripts/Makefile.spl
index d528c994ff2..2e3a443035c 100644
--- a/scripts/Makefile.spl
+++ b/scripts/Makefile.spl
@@ -99,6 +99,7 @@ libs-y += dts/
 libs-y += fs/
 libs-$(CONFIG_SPL_POST_MEM_SUPPORT) += post/drivers/
 libs-$(CONFIG_SPL_NET_SUPPORT) += net/
+libs-$(CONFIG_SPL_UNIT_TEST) += test/
 
 head-y		:= $(addprefix $(obj)/,$(head-y))
 libs-y		:= $(addprefix $(obj)/,$(libs-y))
diff --git a/test/Kconfig b/test/Kconfig
index 28704a25b61..2646e7d825a 100644
--- a/test/Kconfig
+++ b/test/Kconfig
@@ -6,6 +6,16 @@ menuconfig UNIT_TEST
 	  This does not require sandbox to be included, but it is most
 	  often used there.
 
+config SPL_UNIT_TEST
+	bool "Unit tests in SPL"
+	# We need to be able to unbind devices for tests to work
+	select SPL_DM_DEVICE_REMOVE
+	help
+	  Select this to enable unit tests in SPL. Most test are designed for
+	  running in U-Boot proper, but some are intended for SPL, such as
+	  of-platdata and SPL handover. To run these tests with the sandbox_spl
+	  board, use the -u (unit test) option.
+
 config UT_LIB
 	bool "Unit tests for library functions"
 	depends on UNIT_TEST
-- 
2.28.0.806.g8561365e88-goog



More information about the U-Boot mailing list