[PATCH v2 01/60] sandbox: Provide an option to skip flattree tests
Simon Glass
sjg at chromium.org
Fri May 2 16:45:59 CEST 2025
When OF_LIVE is enabled, sandbox runs tests with that and with flattree.
When debugging tests, this is often just a distraction.
Provide a -F option to skip the flattree tests in this case.
Signed-off-by: Simon Glass <sjg at chromium.org>
---
(no changes since v1)
arch/sandbox/cpu/start.c | 9 +++++++++
arch/sandbox/include/asm/state.h | 1 +
include/test/test.h | 11 +++++++++++
test/test-main.c | 4 +++-
4 files changed, 24 insertions(+), 1 deletion(-)
diff --git a/arch/sandbox/cpu/start.c b/arch/sandbox/cpu/start.c
index 2940768cd1c..d3bb8ff429e 100644
--- a/arch/sandbox/cpu/start.c
+++ b/arch/sandbox/cpu/start.c
@@ -459,6 +459,15 @@ static int sandbox_cmdline_cb_native(struct sandbox_state *state,
SANDBOX_CMDLINE_OPT_SHORT(native, 'N', 0,
"Use native mode (host-based EFI boot filename)");
+static int sandbox_cmdline_cb_noflat(struct sandbox_state *state,
+ const char *arg)
+{
+ state->no_flattree_tests = true;
+
+ return 0;
+}
+SANDBOX_CMDLINE_OPT_SHORT(noflat, 'F', 0, "Don't run second set of DM tests");
+
void state_show(struct sandbox_state *state)
{
char **p;
diff --git a/arch/sandbox/include/asm/state.h b/arch/sandbox/include/asm/state.h
index dc21a623106..b0dfc87f1f9 100644
--- a/arch/sandbox/include/asm/state.h
+++ b/arch/sandbox/include/asm/state.h
@@ -102,6 +102,7 @@ struct sandbox_state {
bool disable_sf_bootdevs; /* Don't bind SPI flash bootdevs */
bool upl; /* Enable Universal Payload (UPL) */
bool native; /* Adjust to reflect host arch */
+ bool no_flattree_tests; /* Don't run second set of DM tests */
/* Pointer to information for each SPI bus/cs */
struct sandbox_spi_info spi[CONFIG_SANDBOX_SPI_MAX_BUS]
diff --git a/include/test/test.h b/include/test/test.h
index 0f2b68a5dee..cadf39a0c9d 100644
--- a/include/test/test.h
+++ b/include/test/test.h
@@ -288,4 +288,15 @@ static inline void test_sf_set_enable_bootdevs(bool enable)
#endif
}
+static inline bool test_flattree_test_enabled(void)
+{
+#ifdef CONFIG_SANDBOX
+ struct sandbox_state *state = state_get_current();
+
+ return !state->no_flattree_tests;
+#else
+ return true;
+#endif
+}
+
#endif /* __TEST_TEST_H */
diff --git a/test/test-main.c b/test/test-main.c
index cabc736a524..aa3eb5a3d8e 100644
--- a/test/test-main.c
+++ b/test/test-main.c
@@ -550,6 +550,7 @@ static int ut_run_test_live_flat(struct unit_test_state *uts,
* - the FDT is still valid and has not been updated by an earlier test
* (for sandbox we handle this by copying the tree, but not for other
* boards)
+ * - the -F option is not enabled (on sandbox)
*/
if ((!CONFIG_IS_ENABLED(OF_LIVE) ||
(test->flags & UTF_SCAN_FDT)) &&
@@ -557,7 +558,8 @@ static int ut_run_test_live_flat(struct unit_test_state *uts,
(CONFIG_IS_ENABLED(OFNODE_MULTI_TREE) ||
!(test->flags & UTF_OTHER_FDT)) &&
(!runs || ut_test_run_on_flattree(test)) &&
- !(gd->flags & GD_FLG_FDT_CHANGED)) {
+ !(gd->flags & GD_FLG_FDT_CHANGED) &&
+ test_flattree_test_enabled()) {
uts->of_live = false;
ret = ut_run_test(uts, test, leaf ?: test->name);
if (ret != -EAGAIN) {
--
2.43.0
More information about the U-Boot
mailing list