diff options
author | Edward O'Callaghan <quasisec@google.com> | 2022-10-17 15:00:57 +1100 |
---|---|---|
committer | Felix Singer <felixsinger@posteo.net> | 2022-11-10 17:23:07 +0000 |
commit | 00635b0da2c223717c353e7a5cf73d7f900896cd (patch) | |
tree | 28409c64a4b48b8e63c47beaeaef038c742b0fb5 /tests/spi25.c | |
parent | 664c58f32af45b2acf7520c05bb40ef2c2f0891e (diff) | |
download | flashrom-00635b0da2c223717c353e7a5cf73d7f900896cd.tar.gz flashrom-00635b0da2c223717c353e7a5cf73d7f900896cd.tar.bz2 flashrom-00635b0da2c223717c353e7a5cf73d7f900896cd.zip |
Revert "libflashrom: Return progress state to the library user"
This reverts commit 40892b0c08fbc8029921e91511dd3f91fc956f90.
The feature of returning progress for libflashrom users was
introduced in original commit, however later a bug was found and
reported as https://ticket.coreboot.org/issues/390.
Reverting in a release branch to unblock release candidate, since
it is unknown how much time needed to fix the bug. Meanwhile the
feature remains in a master branch and will be fixed under
ticket 390.
TEST=scenarios below run successfully
1) flashrom -h does not show --progress
2) flashrom -p dummy:emulate=W25Q128FV -r /tmp/dump.bin
3) flashrom -p dummy:emulate=W25Q128FV -v /tmp/dump.bin
4) flashrom -p dummy:emulate=W25Q128FV -E
5) head -c 16777216 </dev/urandom >/tmp/image.bin
flashrom -p dummy:image=/tmp/image.bin,emulate=W25Q128FV \
-w /tmp/dump.bin
Change-Id: Id3d7ffcaf266a60a44eb453fd09b7c63c05349c2
Signed-off-by: Edward O'Callaghan <quasisec@google.com>
Signed-off-by: Anastasia Klimchuk <aklm@chromium.org>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/69283
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Felix Singer <felixsinger@posteo.net>
Diffstat (limited to 'tests/spi25.c')
-rw-r--r-- | tests/spi25.c | 59 |
1 files changed, 0 insertions, 59 deletions
diff --git a/tests/spi25.c b/tests/spi25.c index 872959341..8768d09ef 100644 --- a/tests/spi25.c +++ b/tests/spi25.c @@ -67,65 +67,6 @@ int __wrap_spi_send_command(const struct flashctx *flash, return 0; } -static void spi_read_progress_cb(struct flashrom_flashctx *flashctx) -{ - struct flashrom_progress *progress_state = flashctx->progress_state; - uint32_t *cnt = (uint32_t *) progress_state->user_data; - assert_int_equal(0x300, progress_state->total); - switch (*cnt) { - case 0: - assert_int_equal(0x100, progress_state->current); - break; - case 1: - assert_int_equal(0x200, progress_state->current); - break; - case 2: - assert_int_equal(0x300, progress_state->current); - break; - case 3: - assert_int_equal(0x300, progress_state->current); - break; - case 4: - assert_int_equal(0x300, progress_state->current); - break; - default: - fail(); - } - (*cnt)++; -} - -void spi_read_chunked_test_success(void **state) -{ - (void) state; /* unused */ - uint8_t buf[0x400] = { 0x0 }; - uint32_t cnt = 0; - const unsigned int max_data_read = 0x100; - const unsigned int offset = 0x100; - struct registered_master mst = { - .spi.read = default_spi_read, - .spi.max_data_read = max_data_read - }; - - /* setup initial test state */ - struct flashctx flashctx = { - .chip = &mock_chip, - .mst = &mst - }; - struct flashrom_progress progress_state = { - .user_data = (void *) &cnt, - }; - flashrom_set_progress_callback(&flashctx, spi_read_progress_cb, &progress_state); - for (int i = 0; i < 4; i++) { - expect_memory(__wrap_spi_send_command, flash, - &flashctx, sizeof(flashctx)); - will_return(__wrap_spi_send_command, JEDEC_WRDI); - will_return(__wrap_spi_send_command, JEDEC_READ); - will_return(__wrap_spi_send_command, max_data_read); - } - assert_int_equal(0, spi_chip_read(&flashctx, buf, offset, sizeof(buf))); - assert_int_equal(5, cnt); -} - void spi_write_enable_test_success(void **state) { (void) state; /* unused */ |