#include <spl.h>
#include <asm/spl.h>
#include <asm/state.h>
+#include <test/test.h>
DECLARE_GLOBAL_DATA_PTR;
uclass_next_device(&dev))
;
}
+
+ if (state->run_unittests) {
+ int ret;
+
+ ret = dm_test_main(NULL);
+ /* continue execution into U-Boot */
+ }
}
void __noreturn jump_to_image_no_args(struct spl_image_info *spl_image)
}
SANDBOX_CMDLINE_OPT(show_of_platdata, 0, "Show of-platdata in SPL");
+static int sandbox_cmdline_cb_unittests(struct sandbox_state *state,
+ const char *arg)
+{
+ state->run_unittests = true;
+
+ return 0;
+}
+SANDBOX_CMDLINE_OPT_SHORT(unittests, 'u', 0, "Run unit tests");
+
static void setup_ram_buf(struct sandbox_state *state)
{
/* Zero the RAM buffer if we didn't read it, to keep valgrind happy */
int default_log_level; /* Default log level for sandbox */
bool show_of_platdata; /* Show of-platdata in SPL */
bool ram_buf_read; /* true if we read the RAM buffer */
+ bool run_unittests; /* Run unit tests */
/* Pointer to information for each SPI bus/cs */
struct sandbox_spi_info spi[CONFIG_SANDBOX_SPI_MAX_BUS]
TEST_DEVRES_SIZE3 = 37,
};
+/**
+ * dm_test_main() - Run driver model tests
+ *
+ * Run all the available driver model tests, or a selection
+ *
+ * @test_name: Name of single test to run (e.g. "dm_test_fdt_pre_reloc" or just
+ * "fdt_pre_reloc"), or NULL to run all
+ * @return 0 if all tests passed, 1 if not
+ */
+int dm_test_main(const char *test_name);
+
#endif /* __TEST_TEST_H */
return !strstr(fname, "video") || strstr(test->name, "video_base");
}
-static int dm_test_main(const char *test_name)
+int dm_test_main(const char *test_name)
{
struct unit_test *tests = ll_entry_start(struct unit_test, dm_test);
const int n_ents = ll_entry_count(struct unit_test, dm_test);