test: drivers: flash: common: Copied size can't exceed page.size
flash_copy() is performed on a page.size span but following flash_read() verification step is performed on EXPECTED_SIZE length (512). This doesn't work on devices where page.size is lower than EXPECTED_SIZE, such as STM32L1 where page size is 256. To fix this, perform verification on the smalest value between page.size and EXPECTED_SIZE. Signed-off-by: Erwan Gouriou <erwan.gouriou@st.com>
This commit is contained in:
parent
3583492890
commit
201a0b6ba9
1 changed files with 4 additions and 2 deletions
|
@ -397,8 +397,10 @@ static void test_flash_copy_inner(const struct device *src_dev, off_t src_offset
|
|||
|
||||
if ((expected_result == 0) && (size != 0) && (src_offset != dst_offset)) {
|
||||
/* verify a successful copy */
|
||||
zassert_ok(flash_read(flash_dev, TEST_AREA_OFFSET, expected, EXPECTED_SIZE));
|
||||
for (int i = 0; i < EXPECTED_SIZE; i++) {
|
||||
off_t copy_size = MIN(size, EXPECTED_SIZE);
|
||||
|
||||
zassert_ok(flash_read(flash_dev, TEST_AREA_OFFSET, expected, copy_size));
|
||||
for (int i = 0; i < copy_size; i++) {
|
||||
zassert_equal(buf[i], 0xaa, "incorrect data (%02x) at %d", buf[i], i);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue