From 3bba710d98b60eba7ebbae0869fd58f7dc987afd Mon Sep 17 00:00:00 2001 From: Edward O'Callaghan Date: Mon, 29 Aug 2022 10:36:21 +1000 Subject: tree/: Convert flashchip erase_block func ptr to enumerate This forges the way for flashchips.c to be pure declarative data and lookup functions for dispatch to be pure. This means that the flashchips data could be extracted out to be agnostic data of the flashrom code and algorithms. Change-Id: I02ae7e4c67c5bf34ec2fd7ffe4af8a2aba6fd5e5 Signed-off-by: Edward O'Callaghan Reviewed-on: https://review.coreboot.org/c/flashrom/+/69133 Reviewed-by: Angel Pons Reviewed-by: Anastasia Klimchuk Tested-by: build bot (Jenkins) --- tests/chip.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/chip.c b/tests/chip.c index 579643c78..1d9cdc9cf 100644 --- a/tests/chip.c +++ b/tests/chip.c @@ -148,6 +148,7 @@ static void teardown(struct flashrom_layout **layout) extern write_func_t *g_test_write_injector; extern read_func_t *g_test_read_injector; +extern erasefunc_t *g_test_erase_injector; static const struct flashchip chip_8MiB = { .vendor = "aklm", @@ -160,7 +161,7 @@ static const struct flashchip chip_8MiB = { {{ /* All blocks within total size of the chip. */ .eraseblocks = { {2 * MiB, 4} }, - .block_erase = block_erase_chip, + .block_erase = TEST_ERASE_INJECTOR, }}, }; @@ -208,6 +209,7 @@ void erase_chip_test_success(void **state) g_test_write_injector = write_chip; g_test_read_injector = read_chip; + g_test_erase_injector = block_erase_chip; struct flashrom_flashctx flashctx = { 0 }; struct flashrom_layout *layout; struct flashchip mock_chip = chip_8MiB; @@ -268,6 +270,7 @@ void read_chip_test_success(void **state) g_test_write_injector = write_chip; g_test_read_injector = read_chip; + g_test_erase_injector = block_erase_chip; struct flashrom_flashctx flashctx = { 0 }; struct flashrom_layout *layout; struct flashchip mock_chip = chip_8MiB; @@ -341,6 +344,7 @@ void write_chip_test_success(void **state) g_test_write_injector = write_chip; g_test_read_injector = read_chip; + g_test_erase_injector = block_erase_chip; struct flashrom_flashctx flashctx = { 0 }; struct flashrom_layout *layout; struct flashchip mock_chip = chip_8MiB; @@ -440,6 +444,7 @@ void verify_chip_test_success(void **state) g_test_write_injector = write_chip; g_test_read_injector = read_chip; + g_test_erase_injector = block_erase_chip; struct flashrom_flashctx flashctx = { 0 }; struct flashrom_layout *layout; struct flashchip mock_chip = chip_8MiB; -- cgit v1.2.3