1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

tests: adapt to vfs_umount() API change

This commit is contained in:
Benjamin Valentin 2023-02-26 23:48:33 +01:00 committed by Benjamin Valentin
parent 3b587d9268
commit c19c25e078
11 changed files with 42 additions and 42 deletions

View File

@ -136,7 +136,7 @@ static void test_devfs_mount_open(void)
res = devfs_unregister(&_mock_devfs_node);
TEST_ASSERT_EQUAL_INT(0, res);
res = vfs_umount(&_test_devfs_mount);
res = vfs_umount(&_test_devfs_mount, false);
TEST_ASSERT_EQUAL_INT(0, res);
}

View File

@ -90,7 +90,7 @@ static void test_format(void)
static void test_mount(void)
{
print_test_result("test_mount__mount", vfs_mount(&_test_vfs_mount) == 0);
print_test_result("test_mount__umount", vfs_umount(&_test_vfs_mount) == 0);
print_test_result("test_mount__umount", vfs_umount(&_test_vfs_mount, false) == 0);
}
static void test_open(void)
@ -113,7 +113,7 @@ static void test_open(void)
print_test_result("test_open__open_rw", fd >= 0);
print_test_result("test_open__close_rw", vfs_close(fd) == 0);
print_test_result("test_open__umount", vfs_umount(&_test_vfs_mount) == 0);
print_test_result("test_open__umount", vfs_umount(&_test_vfs_mount, false) == 0);
}
static void test_rw(void)
@ -193,7 +193,7 @@ static void test_rw(void)
(strncmp(buf, test_txt3, sizeof(test_txt3)) == 0));
print_test_result("test_rw__close_rwc", vfs_close(fd) == 0);
print_test_result("test_rw__umount", vfs_umount(&_test_vfs_mount) == 0);
print_test_result("test_rw__umount", vfs_umount(&_test_vfs_mount, false) == 0);
}
static void test_dir(void)
@ -216,7 +216,7 @@ static void test_dir(void)
print_test_result("test_dir__readdir3", vfs_readdir(&dir, &entry2) == 0);
print_test_result("test_dir__closedir", vfs_closedir(&dir) == 0);
print_test_result("test_dir__umount", vfs_umount(&_test_vfs_mount) == 0);
print_test_result("test_dir__umount", vfs_umount(&_test_vfs_mount, false) == 0);
}
static void test_rename(void)
@ -243,7 +243,7 @@ static void test_rename(void)
print_test_result("test_rename__readdir3", vfs_readdir(&dir, &entry2) == 0);
print_test_result("test_rename__closedir", vfs_closedir(&dir) == 0);
print_test_result("test_rename__umount", vfs_umount(&_test_vfs_mount) == 0);
print_test_result("test_rename__umount", vfs_umount(&_test_vfs_mount, false) == 0);
}
static void test_unlink(void)
@ -257,7 +257,7 @@ static void test_unlink(void)
print_test_result("test_unlink__opendir", vfs_opendir(&dir, MNT_PATH) == 0);
print_test_result("test_unlink__readdir", vfs_readdir(&dir, &entry) == 0);
print_test_result("test_unlink__closedir", vfs_closedir(&dir) == 0);
print_test_result("test_unlink__umount", vfs_umount(&_test_vfs_mount) == 0);
print_test_result("test_unlink__umount", vfs_umount(&_test_vfs_mount, false) == 0);
}
static void test_mkrmdir(void)
@ -281,7 +281,7 @@ static void test_mkrmdir(void)
vfs_opendir(&dir, MNT_PATH"/"DIR_NAME) < 0);
print_test_result("test_mkrmdir__umount",
vfs_umount(&_test_vfs_mount) == 0);
vfs_umount(&_test_vfs_mount, false) == 0);
}
static void test_create(void)
@ -305,7 +305,7 @@ static void test_create(void)
print_test_result("test_create__write_wo2", nw == sizeof(test_txt));
print_test_result("test_create__close_wo2", vfs_close(fd) == 0);
print_test_result("test_create__umount", vfs_umount(&_test_vfs_mount) == 0);
print_test_result("test_create__umount", vfs_umount(&_test_vfs_mount, false) == 0);
}
static void test_fstat(void)
@ -328,7 +328,7 @@ static void test_fstat(void)
print_test_result("test_stat__stat", vfs_fstat(fd, &stat_buf) == 0);
print_test_result("test_stat__close", vfs_close(fd) == 0);
print_test_result("test_stat__size", stat_buf.st_size == sizeof(test_txt));
print_test_result("test_stat__umount", vfs_umount(&_test_vfs_mount) == 0);
print_test_result("test_stat__umount", vfs_umount(&_test_vfs_mount, false) == 0);
}
#if defined(MODULE_NEWLIB) || defined(MODULE_PICOLIBC)
@ -393,7 +393,7 @@ static void test_libc(void)
}
print_test_result("test_libc__remove", remove(FULL_FNAME2) == 0);
print_test_result("test_libc__umount", vfs_umount(&_test_vfs_mount) == 0);
print_test_result("test_libc__umount", vfs_umount(&_test_vfs_mount, false) == 0);
}
#endif

View File

@ -142,13 +142,13 @@ static void test_littlefs_teardown(void)
vfs_unlink("/test-littlefs/test1.txt");
vfs_unlink("/test-littlefs/a/test2.txt");
vfs_rmdir("/test-littlefs/a");
vfs_umount(&_test_littlefs_mount);
vfs_umount(&_test_littlefs_mount, false);
}
static void tests_littlefs_format(void)
{
int res;
vfs_umount(&_test_littlefs_mount);
vfs_umount(&_test_littlefs_mount, false);
res = mtd_erase(_dev, 0, _dev->page_size * _dev->pages_per_sector * _dev->sector_count);
TEST_ASSERT_EQUAL_INT(0, res);
@ -162,7 +162,7 @@ static void tests_littlefs_format(void)
res = vfs_mount(&_test_littlefs_mount);
TEST_ASSERT_EQUAL_INT(0, res);
res = vfs_umount(&_test_littlefs_mount);
res = vfs_umount(&_test_littlefs_mount, false);
TEST_ASSERT_EQUAL_INT(0, res);
/* 2. format a valid file system */
@ -173,7 +173,7 @@ static void tests_littlefs_format(void)
static void tests_littlefs_mount_umount(void)
{
int res;
res = vfs_umount(&_test_littlefs_mount);
res = vfs_umount(&_test_littlefs_mount, false);
TEST_ASSERT_EQUAL_INT(0, res);
res = vfs_mount(&_test_littlefs_mount);

View File

@ -142,13 +142,13 @@ static void test_littlefs_teardown(void)
vfs_unlink("/test-littlefs/test1.txt");
vfs_unlink("/test-littlefs/a/test2.txt");
vfs_rmdir("/test-littlefs/a");
vfs_umount(&_test_littlefs_mount);
vfs_umount(&_test_littlefs_mount, false);
}
static void tests_littlefs_format(void)
{
int res;
vfs_umount(&_test_littlefs_mount);
vfs_umount(&_test_littlefs_mount, false);
res = mtd_erase(_dev, 0, _dev->page_size * _dev->pages_per_sector * _dev->sector_count);
TEST_ASSERT_EQUAL_INT(0, res);
@ -162,7 +162,7 @@ static void tests_littlefs_format(void)
res = vfs_mount(&_test_littlefs_mount);
TEST_ASSERT_EQUAL_INT(0, res);
res = vfs_umount(&_test_littlefs_mount);
res = vfs_umount(&_test_littlefs_mount, false);
TEST_ASSERT_EQUAL_INT(0, res);
/* 2. format a valid file system */
@ -173,7 +173,7 @@ static void tests_littlefs_format(void)
static void tests_littlefs_mount_umount(void)
{
int res;
res = vfs_umount(&_test_littlefs_mount);
res = vfs_umount(&_test_littlefs_mount, false);
TEST_ASSERT_EQUAL_INT(0, res);
res = vfs_mount(&_test_littlefs_mount);

View File

@ -142,7 +142,7 @@ static void test_spiffs_teardown(void)
vfs_unlink("/test-spiffs/test0.txt");
vfs_unlink("/test-spiffs/test1.txt");
vfs_unlink("/test-spiffs/a/test2.txt");
vfs_umount(&_test_spiffs_mount);
vfs_umount(&_test_spiffs_mount, false);
spiffs_desc.base_addr = 0;
spiffs_desc.block_count = 0;
@ -151,7 +151,7 @@ static void test_spiffs_teardown(void)
static void tests_spiffs_format(void)
{
int res;
vfs_umount(&_test_spiffs_mount);
vfs_umount(&_test_spiffs_mount, false);
res = mtd_erase(_dev, 0, _dev->page_size * _dev->pages_per_sector * _dev->sector_count);
TEST_ASSERT_EQUAL_INT(0, res);
@ -165,7 +165,7 @@ static void tests_spiffs_format(void)
res = vfs_mount(&_test_spiffs_mount);
TEST_ASSERT_EQUAL_INT(0, res);
res = vfs_umount(&_test_spiffs_mount);
res = vfs_umount(&_test_spiffs_mount, false);
TEST_ASSERT_EQUAL_INT(0, res);
/* 2. format a valid file system */
@ -176,7 +176,7 @@ static void tests_spiffs_format(void)
static void tests_spiffs_mount_umount(void)
{
int res;
res = vfs_umount(&_test_spiffs_mount);
res = vfs_umount(&_test_spiffs_mount, false);
TEST_ASSERT_EQUAL_INT(0, res);
res = vfs_mount(&_test_spiffs_mount);
@ -387,7 +387,7 @@ static void tests_spiffs_statvfs(void)
static void tests_spiffs_partition(void)
{
vfs_umount(&_test_spiffs_mount);
vfs_umount(&_test_spiffs_mount, false);
spiffs_desc.base_addr = _dev->page_size * _dev->pages_per_sector;
spiffs_desc.block_count = 2;

View File

@ -116,7 +116,7 @@ static void test_tinyvcdiff_vfs(void)
TEST_ASSERT_EQUAL_INT(0, memcmp(target_bin, target_buf, sizeof(target_buf)));
vfs_close(target_fd);
vfs_umount(&mnt);
vfs_umount(&mnt, false);
}
Test *tests_tinyvcdiff(void)

View File

@ -81,7 +81,7 @@ static void teardown(void)
vfs_closedir(&_test_dir);
_test_vfs_dir_op_status = -1;
}
vfs_umount(&_test_vfs_mount_null);
vfs_umount(&_test_vfs_mount_null, false);
}
static void test_vfs_null_dir_ops_opendir(void)

View File

@ -80,7 +80,7 @@ static void teardown(void)
vfs_close(_test_vfs_file_op_my_fd);
_test_vfs_file_op_my_fd = -1;
}
vfs_umount(&_test_vfs_mount_null);
vfs_umount(&_test_vfs_mount_null, false);
}
static void test_vfs_null_file_ops_close(void)

View File

@ -71,7 +71,7 @@ static void setup(void)
static void teardown(void)
{
vfs_umount(&_test_vfs_mount_null);
vfs_umount(&_test_vfs_mount_null, false);
}
static void test_vfs_null_fs_ops_mount(void)
@ -85,9 +85,9 @@ static void test_vfs_null_fs_ops_mount(void)
static void test_vfs_null_fs_ops_umount(void)
{
TEST_ASSERT_EQUAL_INT(0, _test_vfs_fs_op_mount_res);
int res = vfs_umount(&_test_vfs_mount_null);
int res = vfs_umount(&_test_vfs_mount_null, false);
TEST_ASSERT_EQUAL_INT(0, res);
res = vfs_umount(&_test_vfs_mount_null);
res = vfs_umount(&_test_vfs_mount_null, false);
/* Not mounted */
TEST_ASSERT_EQUAL_INT(-EINVAL, res);
}

View File

@ -72,7 +72,7 @@ static void test_vfs_mount_umount(void)
int res;
res = vfs_mount(&_test_vfs_mount);
TEST_ASSERT_EQUAL_INT(0, res);
res = vfs_umount(&_test_vfs_mount);
res = vfs_umount(&_test_vfs_mount, false);
TEST_ASSERT_EQUAL_INT(0, res);
}
@ -89,9 +89,9 @@ static void test_vfs_mount__invalid(void)
static void test_vfs_umount__invalid_mount(void)
{
int res;
res = vfs_umount(NULL);
res = vfs_umount(NULL, false);
TEST_ASSERT(res < 0);
res = vfs_umount(&_test_vfs_mount);
res = vfs_umount(&_test_vfs_mount, false);
TEST_ASSERT(res < 0);
}
@ -124,7 +124,7 @@ static void test_vfs_constfs_open(void)
TEST_ASSERT_EQUAL_INT(0, res);
}
res = vfs_umount(&_test_vfs_mount);
res = vfs_umount(&_test_vfs_mount, false);
TEST_ASSERT_EQUAL_INT(0, res);
}
@ -169,7 +169,7 @@ static void test_vfs_constfs_read_lseek(void)
res = vfs_close(fd);
TEST_ASSERT_EQUAL_INT(0, res);
res = vfs_umount(&_test_vfs_mount);
res = vfs_umount(&_test_vfs_mount, false);
TEST_ASSERT_EQUAL_INT(0, res);
}
@ -199,7 +199,7 @@ static void test_vfs_constfs__posix(void)
res = close(fd);
TEST_ASSERT_EQUAL_INT(0, res);
res = vfs_umount(&_test_vfs_mount);
res = vfs_umount(&_test_vfs_mount, false);
TEST_ASSERT_EQUAL_INT(0, res);
}
#endif

View File

@ -96,7 +96,7 @@ int main(void) {
/* N1N2, unmount 3, N4E */
iter_and_report(&iter);
iter_and_report(&iter);
res |= vfs_umount(&mount3);
res |= vfs_umount(&mount3, false);
iter_and_report(&iter);
iter_and_report(&iter);
@ -104,19 +104,19 @@ int main(void) {
/* It is OK that 1 is reported twice, because its first occurrence is its
* old mounting, and later it reappears */
iter_and_report(&iter);
res |= vfs_umount(&mount2);
res |= vfs_umount(&mount2, false);
iter_and_report(&iter);
res |= vfs_mount(&mount3);
iter_and_report(&iter);
res |= vfs_umount(&mount1);
res |= vfs_umount(&mount1, false);
res |= vfs_mount(&mount1);
iter_and_report(&iter);
iter_and_report(&iter);
/* This ensures we're not leaking locks */
res |= vfs_umount(&mount1);
res |= vfs_umount(&mount3);
res |= vfs_umount(&mount4);
res |= vfs_umount(&mount1, false);
res |= vfs_umount(&mount3, false);
res |= vfs_umount(&mount4, false);
printf("All unmounted\n");
/* Only O */