diff options
author | Anastasia Klimchuk <aklm@chromium.org> | 2022-08-08 10:42:39 +1000 |
---|---|---|
committer | Anastasia Klimchuk <aklm@chromium.org> | 2022-08-10 23:53:11 +0000 |
commit | e18a528c6b399d4a330e77657ba64a72b09fcf23 (patch) | |
tree | 5fe3e770ffa91e663108a439dcf3b016d7a307ed /tests/realtek_mst_i2c_spi.c | |
parent | 4adfd99d782ab825042f9225df05d360476f8e19 (diff) | |
download | flashrom-e18a528c6b399d4a330e77657ba64a72b09fcf23.tar.gz flashrom-e18a528c6b399d4a330e77657ba64a72b09fcf23.tar.bz2 flashrom-e18a528c6b399d4a330e77657ba64a72b09fcf23.zip |
tests: Test allow_brick is required for i2c programmers init
Add tests for i2c programmers that assert that initialisation fails
when allow_brick parameter is not provided.
Example of logs from test run:
[ RUN ] parade_lspcon_no_allow_brick_test_success
Testing init error path for programmer=parade_lspcon with params: bus=254 ...
... init failed with error code -1 as expected
[ OK ] parade_lspcon_no_allow_brick_test_success
BUG=b:181803212
TEST=ninja test
Change-Id: I382f563016502f3342131d5f9c0de41dc665b03a
Signed-off-by: Anastasia Klimchuk <aklm@chromium.org>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/66508
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Felix Singer <felixsinger@posteo.net>
Reviewed-by: Thomas Heijligen <src@posteo.de>
Diffstat (limited to 'tests/realtek_mst_i2c_spi.c')
-rw-r--r-- | tests/realtek_mst_i2c_spi.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/realtek_mst_i2c_spi.c b/tests/realtek_mst_i2c_spi.c index 85ebc13c..50512abb 100644 --- a/tests/realtek_mst_i2c_spi.c +++ b/tests/realtek_mst_i2c_spi.c @@ -58,6 +58,22 @@ void realtek_mst_basic_lifecycle_test_success(void **state) run_basic_lifecycle(state, &realtek_mst_io, &programmer_realtek_mst_i2c_spi, "bus=254,enter_isp=0,allow_brick=yes"); } + +void realtek_mst_no_allow_brick_test_success(void **state) +{ + struct io_mock_fallback_open_state realtek_mst_fallback_open_state = { + .noc = 0, + .paths = { "/dev/i2c-254", NULL }, + .flags = { O_RDWR }, + }; + const struct io_mock realtek_mst_io = { + .fallback_open_state = &realtek_mst_fallback_open_state, + }; + + run_init_error_path(state, &realtek_mst_io, &programmer_realtek_mst_i2c_spi, + "bus=254,enter_isp=0", SPI_GENERIC_ERROR); +} #else SKIP_TEST(realtek_mst_basic_lifecycle_test_success) + SKIP_TEST(realtek_mst_no_allow_brick_test_success) #endif /* CONFIG_REALTEK_I2C_SPI */ |