aboutsummaryrefslogtreecommitdiff
path: root/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'kernel')
-rw-r--r--kernel/src/filesystem/vfs.tests.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/kernel/src/filesystem/vfs.tests.cpp b/kernel/src/filesystem/vfs.tests.cpp
index eaffbc9..28782ec 100644
--- a/kernel/src/filesystem/vfs.tests.cpp
+++ b/kernel/src/filesystem/vfs.tests.cpp
@@ -105,6 +105,8 @@ SCENARIO_METHOD(kernel::tests::filesystem::storage_boot_module_vfs_fixture, "VFS
auto mounted_monkey_1 = vfs.open("/information/monkey_house/monkey_1.txt");
REQUIRE(mounted_monkey_1 != nullptr);
+ REQUIRE(vfs.close(mounted_monkey_1->get_absolute_path().view()) ==
+ kernel::filesystem::vfs::operation_result::success);
REQUIRE(vfs.unmount("/information") == kernel::filesystem::vfs::operation_result::success);
auto unmounted_monkey_1 = vfs.open("/information/monkey_house/monkey_1.txt");
@@ -126,6 +128,11 @@ SCENARIO_METHOD(kernel::tests::filesystem::storage_boot_module_vfs_fixture, "VFS
REQUIRE(mounted_monkey_1 != nullptr);
REQUIRE(mounted_fish1 != nullptr);
+ REQUIRE(vfs.close(mounted_monkey_1->get_absolute_path().view()) ==
+ kernel::filesystem::vfs::operation_result::success);
+ REQUIRE(vfs.close(mounted_fish1->get_absolute_path().view()) ==
+ kernel::filesystem::vfs::operation_result::success);
+
REQUIRE(vfs.unmount("/information") == kernel::filesystem::vfs::operation_result::unmount_failed);
REQUIRE(vfs.unmount("/information/monkey_house/infrastructure") ==
kernel::filesystem::vfs::operation_result::success);
@@ -140,6 +147,9 @@ SCENARIO_METHOD(kernel::tests::filesystem::storage_boot_module_vfs_fixture, "VFS
auto mounted_tickets = vfs.open("/information/entrance/tickets.txt");
REQUIRE(mounted_tickets != nullptr);
+ REQUIRE(vfs.close(mounted_tickets->get_absolute_path().view()) ==
+ kernel::filesystem::vfs::operation_result::success);
+
REQUIRE(vfs.unmount("/information") == kernel::filesystem::vfs::operation_result::success);
mounted_tickets = vfs.open("/information/entrance/tickets.txt");
REQUIRE(mounted_tickets == nullptr);
@@ -161,6 +171,8 @@ SCENARIO_METHOD(kernel::tests::filesystem::storage_boot_module_vfs_fixture, "VFS
auto water = vfs.open("/monkey_house/infrastructure/water.txt");
REQUIRE(water != nullptr);
+ REQUIRE(vfs.close(water->get_absolute_path().view()) == kernel::filesystem::vfs::operation_result::success);
+
REQUIRE(vfs.unmount("/") == kernel::filesystem::vfs::operation_result::success);
info_1 = vfs.open("/information/info_1.txt");
@@ -180,6 +192,8 @@ SCENARIO_METHOD(kernel::tests::filesystem::storage_boot_module_vfs_fixture, "VFS
auto water = vfs.open("/monkey_house/infrastructure/water.txt");
REQUIRE(water != nullptr);
+ REQUIRE(vfs.close(water->get_absolute_path().view()) == kernel::filesystem::vfs::operation_result::success);
+
auto dev_ram_16 = vfs.open("/dev/ram16");
REQUIRE(dev_ram_16 == nullptr);
@@ -196,6 +210,8 @@ SCENARIO_METHOD(kernel::tests::filesystem::storage_boot_module_vfs_fixture, "VFS
auto info_1 = vfs.open("/information/info_1.txt");
REQUIRE(info_1 != nullptr);
+ REQUIRE(vfs.close(info_1->get_absolute_path().view()) == kernel::filesystem::vfs::operation_result::success);
+
REQUIRE(vfs.unmount("/dev") == kernel::filesystem::vfs::operation_result::success);
REQUIRE(vfs.unmount("/") == kernel::filesystem::vfs::operation_result::success);
@@ -317,6 +333,8 @@ SCENARIO_METHOD(kernel::tests::filesystem::storage_boot_module_vfs_fixture, "VFS
std::string_view buffer_as_str{reinterpret_cast<char *>(buffer.data()), bytes_read};
REQUIRE(buffer_as_str == "sheep_1");
+ REQUIRE(vfs.close(dentry->get_absolute_path().view()) == kernel::filesystem::vfs::operation_result::success);
+
REQUIRE(vfs.unmount("/information") == kernel::filesystem::vfs::operation_result::success);
auto unmounted_sheep_1 = vfs.open("/information/sheep_1.txt");
REQUIRE(unmounted_sheep_1 == nullptr);
@@ -348,6 +366,9 @@ SCENARIO_METHOD(kernel::tests::filesystem::storage_boot_module_vfs_fixture, "VFS
buffer_as_str = std::string_view{reinterpret_cast<char *>(goat_buffer.data()), bytes_read};
REQUIRE(buffer_as_str == "goat_1");
+ REQUIRE(vfs.close(sheep_1->get_absolute_path().view()) == kernel::filesystem::vfs::operation_result::success);
+ REQUIRE(vfs.close(goat_1->get_absolute_path().view()) == kernel::filesystem::vfs::operation_result::success);
+
REQUIRE(vfs.unmount("/information") == kernel::filesystem::vfs::operation_result::unmount_failed);
REQUIRE(vfs.unmount("/information/stable") == kernel::filesystem::vfs::operation_result::success);
@@ -357,6 +378,9 @@ SCENARIO_METHOD(kernel::tests::filesystem::storage_boot_module_vfs_fixture, "VFS
auto still_mounted_sheep_1 = vfs.open("/information/sheep_1.txt");
REQUIRE(still_mounted_sheep_1 != nullptr);
+ REQUIRE(vfs.close(still_mounted_sheep_1->get_absolute_path().view()) ==
+ kernel::filesystem::vfs::operation_result::success);
+
REQUIRE(vfs.unmount("/information") == kernel::filesystem::vfs::operation_result::success);
auto unmounted_sheep_1 = vfs.open("/information/sheep_1.txt");
REQUIRE(unmounted_sheep_1 == nullptr);