Skip to content

Commit edd1003

Browse files
de-nordicrghaddab
authored andcommitted
[nrf fromtree] tests/fs: Replace flash_area_erase with flash_area_flatten
Test of file systems use flash_area_erase to erase device to have a clear start for tests; switching to flash_area_flatten allows them to do the same with devices that do not explicit call to erase procedure before write. Signed-off-by: Dominik Ermel <[email protected]> (cherry picked from commit 1ae352a)
1 parent 601d5ef commit edd1003

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

tests/subsys/fs/fat_fs_api/src/test_fat_mkfs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ static int wipe_partition(void)
4545
}
4646

4747
TC_PRINT("Erasing %zu (0x%zx) bytes\n", pfa->fa_size, pfa->fa_size);
48-
rc = flash_area_erase(pfa, 0, pfa->fa_size);
48+
rc = flash_area_flatten(pfa, 0, pfa->fa_size);
4949
(void)flash_area_close(pfa);
5050

5151
if (rc < 0) {

tests/subsys/fs/fcb/src/main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ void test_fcb_wipe(void)
5858
zassert_true(rc == 0, "flash area open call failure");
5959

6060
for (i = 0; i < ARRAY_SIZE(test_fcb_sector); i++) {
61-
rc = flash_area_erase(fap, test_fcb_sector[i].fs_off,
61+
rc = flash_area_flatten(fap, test_fcb_sector[i].fs_off,
6262
test_fcb_sector[i].fs_size);
6363
zassert_true(rc == 0, "erase call failure");
6464
}

tests/subsys/fs/littlefs/src/testfs_lfs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ int testfs_lfs_wipe_partition(const struct fs_mount_t *mp)
7373
}
7474

7575
TC_PRINT("Erasing %zu (0x%zx) bytes\n", pfa->fa_size, pfa->fa_size);
76-
rc = flash_area_erase(pfa, 0, pfa->fa_size);
76+
rc = flash_area_flatten(pfa, 0, pfa->fa_size);
7777
(void)flash_area_close(pfa);
7878

7979
if (rc < 0) {

tests/subsys/fs/multi-fs/src/test_utils.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,6 @@ void test_clear_flash(void)
3131
rc = flash_area_open(TEST_PARTITION_ID, &fap);
3232
zassert_equal(rc, 0, "Opening flash area for erase [%d]\n", rc);
3333

34-
rc = flash_area_erase(fap, 0, fap->fa_size);
34+
rc = flash_area_flatten(fap, 0, fap->fa_size);
3535
zassert_equal(rc, 0, "Erasing flash area [%d]\n", rc);
3636
}

0 commit comments

Comments
 (0)