diff options
author | Alexander Goncharov <chat@joursoir.net> | 2023-02-02 13:12:36 +0400 |
---|---|---|
committer | Anastasia Klimchuk <aklm@chromium.org> | 2023-02-09 07:10:51 +0000 |
commit | a30841dfe652ad2647d454ce7d738b790aad7a5c (patch) | |
tree | 9192359634869ec67cc06ccbb53b64c709ba9497 /tests | |
parent | 5735529d6209388079340a6fbd55e222a1c4c1b9 (diff) | |
download | flashrom-a30841dfe652ad2647d454ce7d738b790aad7a5c.tar.gz flashrom-a30841dfe652ad2647d454ce7d738b790aad7a5c.tar.bz2 flashrom-a30841dfe652ad2647d454ce7d738b790aad7a5c.zip |
tests: add bus coverage test for dummy
Dummy programmer has a shared data between *_masters. To make sure the
dummy has no memory leakage, we need a test that will covers
initialization and shutdown of the programmer with different bus
types, i.e. programmer specific, non-SPI and SPI.
TEST=ninja test
Change-Id: Iafe715feb5f5c0b5efd6827cdb2c3a314f542319
Signed-off-by: Alexander Goncharov <chat@joursoir.net>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/72665
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Anastasia Klimchuk <aklm@chromium.org>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/dummyflasher.c | 19 | ||||
-rw-r--r-- | tests/tests.c | 1 | ||||
-rw-r--r-- | tests/tests.h | 1 |
3 files changed, 21 insertions, 0 deletions
diff --git a/tests/dummyflasher.c b/tests/dummyflasher.c index c41f9dff..052938be 100644 --- a/tests/dummyflasher.c +++ b/tests/dummyflasher.c @@ -123,6 +123,24 @@ void dummy_null_prog_param_test_success(void **state) run_basic_lifecycle(state, &dummy_io, &programmer_dummy, NULL); } +void dummy_all_buses_test_success(void **state) +{ + struct io_mock_fallback_open_state dummy_fallback_open_state = { + .noc = 0, + .paths = { NULL }, + }; + const struct io_mock dummy_io = { + .fallback_open_state = &dummy_fallback_open_state, + }; + + run_basic_lifecycle(state, &dummy_io, &programmer_dummy, "bus=lpc+fwh"); + run_basic_lifecycle(state, &dummy_io, &programmer_dummy, "bus=spi"); + run_basic_lifecycle(state, &dummy_io, &programmer_dummy, "bus=prog"); + run_basic_lifecycle(state, &dummy_io, &programmer_dummy, "bus=parallel+fwh+prog"); + run_basic_lifecycle(state, &dummy_io, &programmer_dummy, "bus=spi+prog"); + run_basic_lifecycle(state, &dummy_io, &programmer_dummy, "bus=parallel+lpc+spi"); +} + #else SKIP_TEST(dummy_basic_lifecycle_test_success) SKIP_TEST(dummy_probe_lifecycle_test_success) @@ -131,4 +149,5 @@ void dummy_null_prog_param_test_success(void **state) SKIP_TEST(dummy_init_success_invalid_param_test_success) SKIP_TEST(dummy_init_success_unhandled_param_test_success) SKIP_TEST(dummy_null_prog_param_test_success) + SKIP_TEST(dummy_all_buses_test_success) #endif /* CONFIG_DUMMY */ diff --git a/tests/tests.c b/tests/tests.c index 0912f353..0de01686 100644 --- a/tests/tests.c +++ b/tests/tests.c @@ -447,6 +447,7 @@ int main(int argc, char *argv[]) cmocka_unit_test(dummy_init_success_invalid_param_test_success), cmocka_unit_test(dummy_init_success_unhandled_param_test_success), cmocka_unit_test(dummy_null_prog_param_test_success), + cmocka_unit_test(dummy_all_buses_test_success), cmocka_unit_test(nicrealtek_basic_lifecycle_test_success), cmocka_unit_test(raiden_debug_basic_lifecycle_test_success), cmocka_unit_test(dediprog_basic_lifecycle_test_success), diff --git a/tests/tests.h b/tests/tests.h index bdcfdae9..8f63f91b 100644 --- a/tests/tests.h +++ b/tests/tests.h @@ -51,6 +51,7 @@ void dummy_init_fails_unhandled_param_test_success(void **state); void dummy_init_success_invalid_param_test_success(void **state); void dummy_init_success_unhandled_param_test_success(void **state); void dummy_null_prog_param_test_success(void **state); +void dummy_all_buses_test_success(void **state); void nicrealtek_basic_lifecycle_test_success(void **state); void raiden_debug_basic_lifecycle_test_success(void **state); void dediprog_basic_lifecycle_test_success(void **state); |