[PATCH v3 3/7] test: Tidy up test building with SPL

Simon Glass sjg at chromium.org
Mon Jul 12 04:19:15 CEST 2021


We can in principle add tests to any SPL build, e.g. TPL or VPL. Update
the build rules to handle this.

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

(no changes since v1)

 Makefile             | 2 +-
 scripts/Makefile.spl | 2 +-
 test/test-main.c     | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/Makefile b/Makefile
index 0d3192cebad..f7f62979ae2 100644
--- a/Makefile
+++ b/Makefile
@@ -841,7 +841,7 @@ libs-$(CONFIG_API) += api/
 ifdef CONFIG_POST
 libs-y += post/
 endif
-libs-$(CONFIG_UNIT_TEST) += test/
+libs-$(CONFIG_$(SPL_TPL_)UNIT_TEST) += test/
 libs-$(CONFIG_UT_ENV) += test/env/
 libs-$(CONFIG_UT_OPTEE) += test/optee/
 libs-$(CONFIG_UT_OVERLAY) += test/overlay/
diff --git a/scripts/Makefile.spl b/scripts/Makefile.spl
index 5be1a9ba1b1..ffe919dafab 100644
--- a/scripts/Makefile.spl
+++ b/scripts/Makefile.spl
@@ -109,7 +109,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/
+libs-$(CONFIG_$(SPL_TPL_)UNIT_TEST) += test/
 
 head-y		:= $(addprefix $(obj)/,$(head-y))
 libs-y		:= $(addprefix $(obj)/,$(libs-y))
diff --git a/test/test-main.c b/test/test-main.c
index 7afe8741cf9..3cdf6849c57 100644
--- a/test/test-main.c
+++ b/test/test-main.c
@@ -45,7 +45,7 @@ static int dm_test_pre_run(struct unit_test_state *uts)
 	uts->force_fail_alloc = false;
 	uts->skip_post_probe = false;
 	gd->dm_root = NULL;
-	if (IS_ENABLED(CONFIG_UT_DM) && !CONFIG_IS_ENABLED(OF_PLATDATA))
+	if (CONFIG_IS_ENABLED(UT_DM) && !CONFIG_IS_ENABLED(OF_PLATDATA))
 		memset(dm_testdrv_op_count, '\0', sizeof(dm_testdrv_op_count));
 	arch_reset_for_test();
 
-- 
2.32.0.93.g670b81a890-goog



More information about the U-Boot mailing list