Alexander Goncharov has uploaded this change for review. ( https://review.coreboot.org/c/flashrom/+/72665 )
Change subject: tests: add bus coverage test for dummy ......................................................................
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 --- M tests/dummyflasher.c M tests/tests.c M tests/tests.h 3 files changed, 38 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/65/72665/1
diff --git a/tests/dummyflasher.c b/tests/dummyflasher.c index c41f9df..5a85cf3 100644 --- a/tests/dummyflasher.c +++ b/tests/dummyflasher.c @@ -123,6 +123,24 @@ run_basic_lifecycle(state, &dummy_io, &programmer_dummy, NULL); }
+void dummy_cover_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 @@ 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_cover_buses_test_success) #endif /* CONFIG_DUMMY */ diff --git a/tests/tests.c b/tests/tests.c index 0912f35..35abb51 100644 --- a/tests/tests.c +++ b/tests/tests.c @@ -447,6 +447,7 @@ 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_cover_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 bdcfdae..59a00f3 100644 --- a/tests/tests.h +++ b/tests/tests.h @@ -51,6 +51,7 @@ 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_cover_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);