summaryrefslogtreecommitdiffstats
path: root/tests/chip.c
diff options
context:
space:
mode:
authorAnastasia Klimchuk <aklm@chromium.org>2022-01-17 14:54:34 +1100
committerEdward O'Callaghan <quasisec@chromium.org>2022-01-19 22:56:48 +0000
commitdf9aada04e0e24e1f368861a90997f15ca2de2c4 (patch)
tree270a0fc3eac5b372b45d6a5c642c2d3630719596 /tests/chip.c
parent66f72d6ac900708ed02cf125714dbc4325783588 (diff)
downloadflashrom-df9aada04e0e24e1f368861a90997f15ca2de2c4.tar.gz
flashrom-df9aada04e0e24e1f368861a90997f15ca2de2c4.tar.bz2
flashrom-df9aada04e0e24e1f368861a90997f15ca2de2c4.zip
tests: Convert read chip tests to libflashrom API
As a part of effort to convert command line (and everything else) to be libflashrom users, chip tests need to be converted as well. TEST=ninja test Change-Id: I4493d4f269595783830c39a720b0a8963eab9daa Signed-off-by: Anastasia Klimchuk <aklm@chromium.org> Reviewed-on: https://review.coreboot.org/c/flashrom/+/61138 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Edward O'Callaghan <quasisec@chromium.org>
Diffstat (limited to 'tests/chip.c')
-rw-r--r--tests/chip.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/tests/chip.c b/tests/chip.c
index 0ea3a3541..962321ff6 100644
--- a/tests/chip.c
+++ b/tests/chip.c
@@ -225,12 +225,17 @@ void read_chip_test_success(void **state)
setup_chip(&flashctx, &layout, &mock_chip, param);
const char *const filename = "read_chip.test";
+ unsigned long size = mock_chip.total_size * 1024;
+ unsigned char *buf = calloc(size, sizeof(unsigned char));
printf("Read chip operation started.\n");
- assert_int_equal(0, do_read(&flashctx, filename));
+ assert_int_equal(0, flashrom_image_read(&flashctx, buf, size));
+ assert_int_equal(0, write_buf_to_file(buf, size, filename));
printf("Read chip operation done.\n");
teardown(&layout);
+
+ free(buf);
}
void read_chip_with_dummyflasher_test_success(void **state)
@@ -249,14 +254,18 @@ void read_chip_with_dummyflasher_test_success(void **state)
setup_chip(&flashctx, &layout, &mock_chip, param_dup);
const char *const filename = "read_chip.test";
+ unsigned long size = mock_chip.total_size * 1024;
+ unsigned char *buf = calloc(size, sizeof(unsigned char));
printf("Read chip operation started.\n");
- assert_int_equal(0, do_read(&flashctx, filename));
+ assert_int_equal(0, flashrom_image_read(&flashctx, buf, size));
+ assert_int_equal(0, write_buf_to_file(buf, size, filename));
printf("Read chip operation done.\n");
teardown(&layout);
free(param_dup);
+ free(buf);
}
void write_chip_test_success(void **state)