1
0
mirror of https://review.coreboot.org/flashrom.git synced 2025-08-15 19:40:19 +02:00

tests: Add unit test for initialisation with NULL programmer param

Programmer param can be NULL and this is a valid case which can
be covered by unit test.

`run_lifecycle` needs an adjustment to handle NULL as programmer
param, which is also included in the patch.

Change-Id: I409f1c9ac832943e54107f7cf8652d1f46ac67df
Signed-off-by: Anastasia Klimchuk <aklm@chromium.org>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/67642
Reviewed-by: Edward O'Callaghan <quasisec@chromium.org>
Reviewed-by: Felix Singer <felixsinger@posteo.net>
Reviewed-by: Thomas Heijligen <src@posteo.de>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
Anastasia Klimchuk
2022-09-14 08:51:54 +10:00
committed by Edward O'Callaghan
parent 5d05a2811e
commit 5363f35fa0
4 changed files with 18 additions and 1 deletions

View File

@@ -110,6 +110,19 @@ void dummy_init_success_unhandled_param_test_success(void **state)
"bus=spi,emulate=W25Q128FV,voltage=3.5V", ERROR_FATAL);
}
void dummy_null_prog_param_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, NULL);
}
#else
SKIP_TEST(dummy_basic_lifecycle_test_success)
SKIP_TEST(dummy_probe_lifecycle_test_success)
@@ -117,4 +130,5 @@ void dummy_init_success_unhandled_param_test_success(void **state)
SKIP_TEST(dummy_init_fails_unhandled_param_test_success)
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)
#endif /* CONFIG_DUMMY */