Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mtd/*: drop .write() if .write_page() is implemented #15380

Merged
merged 11 commits into from
Dec 13, 2023
Prev Previous commit
Next Next commit
unittests/tests-mtd: expect mtd_write() to always succeed
The MTD layer now takes care of splitting up writes, so it
should always work (as long as the destination address is
within the memory region)
  • Loading branch information
benpicco committed Dec 13, 2023
commit d525807598971823a8a3626b1ae5505e4fbb2910
6 changes: 3 additions & 3 deletions tests/unittests/tests-mtd/tests-mtd.c
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ static void test_mtd_write_read(void)
uint8_t buf_page[page_size + 1];
memset(buf_page, 1, sizeof(buf_page));
ret = mtd_write(dev, buf_page, 0, sizeof(buf_page));
TEST_ASSERT_EQUAL_INT(-EOVERFLOW, ret);
TEST_ASSERT_EQUAL_INT(0, ret);

/* Read more than one page */
ret = mtd_erase(dev, 0, dev->page_size * dev->pages_per_sector);
Expand All @@ -163,9 +163,9 @@ static void test_mtd_write_read(void)

/* pages overlap write */
ret = mtd_write(dev, buf, dev->page_size - (sizeof(buf) / 2), sizeof(buf));
TEST_ASSERT_EQUAL_INT(-EOVERFLOW, ret);
TEST_ASSERT_EQUAL_INT(0, ret);
ret = mtd_write(dev, buf_page, 1, sizeof(buf_page) - 1);
TEST_ASSERT_EQUAL_INT(-EOVERFLOW, ret);
TEST_ASSERT_EQUAL_INT(0, ret);
}

#ifdef MTD_0
Expand Down