From b25ff5cbaaaa7f144eb6e087b4bdd7362c58029d Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Sun, 25 Oct 2020 20:38:28 -0600 Subject: 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 --- arch/sandbox/include/asm/state.h | 1 + 1 file changed, 1 insertion(+) (limited to 'arch/sandbox/include/asm/state.h') diff --git a/arch/sandbox/include/asm/state.h b/arch/sandbox/include/asm/state.h index 1bfad305f1a..f828d9d2447 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] -- cgit v1.2.3 From 22b29cc8fb15f611e8e2af6fde8627a32abea76d Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Sun, 25 Oct 2020 20:38:33 -0600 Subject: sandbox: Allow selection of SPL unit tests Now that we have more than one test, add a way to select the test to run. Signed-off-by: Simon Glass --- arch/sandbox/include/asm/state.h | 1 + 1 file changed, 1 insertion(+) (limited to 'arch/sandbox/include/asm/state.h') diff --git a/arch/sandbox/include/asm/state.h b/arch/sandbox/include/asm/state.h index f828d9d2447..7547602dd1c 100644 --- a/arch/sandbox/include/asm/state.h +++ b/arch/sandbox/include/asm/state.h @@ -93,6 +93,7 @@ struct sandbox_state { 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 */ + const char *select_unittests; /* Unit test to run */ /* Pointer to information for each SPI bus/cs */ struct sandbox_spi_info spi[CONFIG_SANDBOX_SPI_MAX_BUS] -- cgit v1.2.3 From a8b1fbc14d064d7b14bf887730300f4dbf856473 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Sun, 25 Oct 2020 20:38:35 -0600 Subject: dm: test: Drop of-platdata pytest Now that we have a C version of this test, drop the Python implementation. Signed-off-by: Simon Glass --- arch/sandbox/include/asm/state.h | 1 - 1 file changed, 1 deletion(-) (limited to 'arch/sandbox/include/asm/state.h') diff --git a/arch/sandbox/include/asm/state.h b/arch/sandbox/include/asm/state.h index 7547602dd1c..bca13069824 100644 --- a/arch/sandbox/include/asm/state.h +++ b/arch/sandbox/include/asm/state.h @@ -90,7 +90,6 @@ struct sandbox_state { bool skip_delays; /* Ignore any time delays (for test) */ bool show_test_output; /* Don't suppress stdout in tests */ 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 */ const char *select_unittests; /* Unit test to run */ -- cgit v1.2.3