aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcel Braun <marcel.braun@ost.ch>2026-05-14 15:23:52 +0200
committerMarcel Braun <marcel.braun@ost.ch>2026-05-14 15:23:52 +0200
commit2b7ebd69a43f9a392738fb2a7f081a5742a2b1fd (patch)
treec0ec1e104c6d7e07c9ec39db790fc4b6e64990d7
parent9b8aa22868a510ac15463e7d4376a506df2db110 (diff)
parenta5e65a09667cbaad0259ebf7315d09401651bbc2 (diff)
downloadkernel-2b7ebd69a43f9a392738fb2a7f081a5742a2b1fd.tar.xz
kernel-2b7ebd69a43f9a392738fb2a7f081a5742a2b1fd.zip
Merge branch 'mount-unmount-boot-root-fs-tests' into 'develop-BA-FS26'
add tests for mount and unmount boot root filesystem See merge request teachos/kernel!36
-rw-r--r--kernel/src/filesystem/vfs.tests.cpp63
1 files changed, 63 insertions, 0 deletions
diff --git a/kernel/src/filesystem/vfs.tests.cpp b/kernel/src/filesystem/vfs.tests.cpp
index add96aa..0f1d6d5 100644
--- a/kernel/src/filesystem/vfs.tests.cpp
+++ b/kernel/src/filesystem/vfs.tests.cpp
@@ -148,6 +148,69 @@ SCENARIO_METHOD(kernel::tests::filesystem::storage_boot_module_vfs_fixture, "VFS
REQUIRE(mounted_monkey != nullptr);
}
+ THEN("image can be mounted on / file opened and unmounted again")
+ {
+ auto info_1 = vfs.open("/information/info_1.txt");
+ REQUIRE(info_1 != nullptr);
+
+ REQUIRE(vfs.do_mount("/dev/ram16", "/") == kernel::filesystem::vfs::operation_result::success);
+
+ info_1 = vfs.open("/information/info_1.txt");
+ REQUIRE(info_1 == nullptr);
+
+ auto water = vfs.open("/monkey_house/infrastructure/water.txt");
+ REQUIRE(water != nullptr);
+
+ REQUIRE(vfs.unmount("/") == kernel::filesystem::vfs::operation_result::success);
+
+ info_1 = vfs.open("/information/info_1.txt");
+ REQUIRE(info_1 != nullptr);
+ }
+
+ THEN("image can be mounted on / just the boot root has /dev")
+ {
+ auto info_1 = vfs.open("/information/info_1.txt");
+ REQUIRE(info_1 != nullptr);
+
+ REQUIRE(vfs.do_mount("/dev/ram16", "/") == kernel::filesystem::vfs::operation_result::success);
+
+ info_1 = vfs.open("/information/info_1.txt");
+ REQUIRE(info_1 == nullptr);
+
+ auto water = vfs.open("/monkey_house/infrastructure/water.txt");
+ REQUIRE(water != nullptr);
+
+ auto dev_ram_16 = vfs.open("/dev/ram16");
+ REQUIRE(dev_ram_16 == nullptr);
+
+ REQUIRE(vfs.do_mount("/dev/ram32", "/") == kernel::filesystem::vfs::operation_result::non_existent_path);
+
+ REQUIRE(vfs.unmount("/") == kernel::filesystem::vfs::operation_result::success);
+
+ auto dev_ram_32 = vfs.open("/dev/ram32");
+ REQUIRE(dev_ram_32 != nullptr);
+ }
+
+ THEN("boot root can be unmounted and remounted again but /dev is not re-grafted")
+ {
+ auto info_1 = vfs.open("/information/info_1.txt");
+ REQUIRE(info_1 != nullptr);
+
+ REQUIRE(vfs.unmount("/dev") == kernel::filesystem::vfs::operation_result::success);
+ REQUIRE(vfs.unmount("/") == kernel::filesystem::vfs::operation_result::success);
+
+ info_1 = vfs.open("/information/info_1.txt");
+ REQUIRE(info_1 == nullptr);
+
+ REQUIRE(vfs.do_mount("/dev/ram0", "/") == kernel::filesystem::vfs::operation_result::success);
+
+ info_1 = vfs.open("/information/info_1.txt");
+ REQUIRE(info_1 != nullptr);
+
+ auto dev_ram_0 = vfs.open("/dev/ram0");
+ REQUIRE(dev_ram_0 == nullptr);
+ }
+
THEN("mount with null file system fails")
{
REQUIRE(vfs.do_mount("/closed.txt", "/information") ==