mirror of
https://review.coreboot.org/flashrom.git
synced 2025-08-15 19:40:19 +02:00
tests/erase: record the opcode for each erase
This allows tests to verify that the correct opcode is used when erasing, which is required to unit-test the fix to issue #525 where in some situations an incorrect erase opcode will be used. BUG=https://ticket.coreboot.org/issues/525 Change-Id: I3983fe42c2e7f06668a1bd20d2db7fafa93b8043 Signed-off-by: Peter Marheine <pmarheine@chromium.org> Reviewed-on: https://review.coreboot.org/c/flashrom/+/82251 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Anastasia Klimchuk <aklm@chromium.org>
This commit is contained in:
14
tests/chip.c
14
tests/chip.c
@@ -118,10 +118,6 @@ static void teardown(struct flashrom_layout **layout)
|
||||
io_mock_register(NULL);
|
||||
}
|
||||
|
||||
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",
|
||||
.total_size = MOCK_CHIP_SIZE / KiB,
|
||||
@@ -132,7 +128,7 @@ static const struct flashchip chip_8MiB = {
|
||||
{{
|
||||
/* All blocks within total size of the chip. */
|
||||
.eraseblocks = { {2 * MiB, 4} },
|
||||
.block_erase = TEST_ERASE_INJECTOR,
|
||||
.block_erase = TEST_ERASE_INJECTOR_1,
|
||||
}},
|
||||
};
|
||||
|
||||
@@ -179,7 +175,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;
|
||||
g_test_erase_injector[0] = block_erase_chip;
|
||||
struct flashrom_flashctx flashctx = { 0 };
|
||||
struct flashrom_layout *layout;
|
||||
struct flashchip mock_chip = chip_8MiB;
|
||||
@@ -238,7 +234,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;
|
||||
g_test_erase_injector[0] = block_erase_chip;
|
||||
struct flashrom_flashctx flashctx = { 0 };
|
||||
struct flashrom_layout *layout;
|
||||
struct flashchip mock_chip = chip_8MiB;
|
||||
@@ -313,7 +309,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;
|
||||
g_test_erase_injector[0] = block_erase_chip;
|
||||
struct flashrom_flashctx flashctx = { 0 };
|
||||
struct flashrom_layout *layout;
|
||||
struct flashchip mock_chip = chip_8MiB;
|
||||
@@ -504,7 +500,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;
|
||||
g_test_erase_injector[0] = block_erase_chip;
|
||||
struct flashrom_flashctx flashctx = { 0 };
|
||||
struct flashrom_layout *layout;
|
||||
struct flashchip mock_chip = chip_8MiB;
|
||||
|
Reference in New Issue
Block a user