diff options
author | Simon Glass <sjg@chromium.org> | 2020-10-25 20:38:28 -0600 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2020-10-29 14:42:18 -0600 |
commit | b25ff5cbaaaa7f144eb6e087b4bdd7362c58029d (patch) | |
tree | 1e66e58ac5f5c7e454c4267b9433de71e01fa7be /arch/sandbox/include/asm/state.h | |
parent | 5b448ce687c0f34b0b55ffe5785b14d762b2296d (diff) |
dm: test: Add a way to run SPL tests
Add a -u flag for U-Boot SPL which requests that unit tests be run. To
make this work, export dm_test_main() and update it to skip test features
that are not used with of-platdata.
To run the tests:
$ spl/u-boot-spl -u
U-Boot SPL 2020.10-rc5 (Oct 01 2020 - 07:35:39 -0600)
Running 0 driver model tests
Failures: 0
At present there are no SPL unit tests.
Note that there is one wrinkle with these tests. SPL has limited memory
available for allocation. Also malloc_simple does not free memory
(free() is a nop) and running tests repeatedly causes driver-model to
reinit multiple times and allocate memory. Therefore it is not possible
to run more than a few tests at a time. One solution is to increase the
amount of malloc space in sandbox_spl. This is not a problem for pytest,
since it runs each test individually, so for now this is left as is.
Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'arch/sandbox/include/asm/state.h')
-rw-r--r-- | arch/sandbox/include/asm/state.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/arch/sandbox/include/asm/state.h b/arch/sandbox/include/asm/state.h index 1bfad305f1..f828d9d244 100644 --- a/arch/sandbox/include/asm/state.h +++ b/arch/sandbox/include/asm/state.h @@ -92,6 +92,7 @@ struct sandbox_state { 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] |