1
0
mirror of https://review.coreboot.org/flashrom.git synced 2025-07-02 14:33:18 +02:00

tests: Add tests to erase a chip

Two tests cover the code which performs do_erase operation.

First one works with fake chip and dummy programmer. Fake chip has all
operations defined, and a buffer to emulate chip memory.

Second one uses the chip which is closer to the real one, because
read/write/unlock/erase operations are real. The tests takes the
advantage of dummyflasher's capability of emulating a W25Q128.V chip.

BUG=b:181803212
TEST=builds and ninja test

Change-Id: I6f74bfe4e02244d24d6c837cc3d551251e7b4898
Signed-off-by: Anastasia Klimchuk <aklm@chromium.org>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/56501
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Edward O'Callaghan <quasisec@chromium.org>
This commit is contained in:
Anastasia Klimchuk
2021-08-02 13:58:59 +10:00
committed by Edward O'Callaghan
parent cdf8cf4afe
commit ed43237cfa
4 changed files with 237 additions and 0 deletions

View File

@ -292,5 +292,11 @@ int main(void)
};
ret |= cmocka_run_group_tests_name("layout.c tests", layout_tests, NULL, NULL);
const struct CMUnitTest chip_tests[] = {
cmocka_unit_test(erase_chip_test_success),
cmocka_unit_test(erase_chip_with_dummyflasher_test_success),
};
ret |= cmocka_run_group_tests_name("chip.c tests", chip_tests, NULL, NULL);
return ret;
}