diff options
| author | Lukas Oesch <lukasoesch20@gmail.com> | 2026-04-08 15:48:32 +0200 |
|---|---|---|
| committer | Lukas Oesch <lukasoesch20@gmail.com> | 2026-04-11 07:58:21 +0200 |
| commit | 5865dac062f3291b8081eca39c2835015d2c43c6 (patch) | |
| tree | 3680241b3f118c83a398d723530e95b098e7812f /kernel | |
| parent | eef84863f56a9453aaf086391a85b8d78d722358 (diff) | |
| download | teachos-5865dac062f3291b8081eca39c2835015d2c43c6.tar.xz teachos-5865dac062f3291b8081eca39c2835015d2c43c6.zip | |
extend tests with another filesystem
Diffstat (limited to 'kernel')
| -rw-r--r-- | kernel/src/main.cpp | 28 |
1 files changed, 25 insertions, 3 deletions
diff --git a/kernel/src/main.cpp b/kernel/src/main.cpp index 1d73e20..79ed703 100644 --- a/kernel/src/main.cpp +++ b/kernel/src/main.cpp @@ -139,15 +139,37 @@ auto test_file_lookup() -> void "limits_for_testing_purposes_and_we_add_more_characters_to_make_it_even_longer_30.txt"); auto storage_mgmt = kernel::devices::storage::management::get(); - auto device = storage_mgmt.device_by_major_minor(1, 16); - auto new_filesystem = kernel::filesystem::filesystem::probe_and_mount(device); + auto device_1 = storage_mgmt.device_by_major_minor(1, 16); + auto fs_1 = kernel::filesystem::filesystem::probe_and_mount(device_1); - vfs.do_mount("/enclosures/aquarium", new_filesystem); + vfs.do_mount("/enclosures/aquarium", fs_1); read_and_write_file("/enclosures/aquarium/closed.txt"); read_and_write_file("/enclosures/aquarium/information/info_2.txt"); vfs.unmount("/enclosures/aquarium"); read_and_write_file("/enclosures/aquarium/tank_1/fish_4.txt"); + + auto device_2 = storage_mgmt.device_by_major_minor(1, 32); + auto fs_2 = kernel::filesystem::filesystem::probe_and_mount(device_2); + + vfs.do_mount("/enclosures/elephant_house", fs_2); + read_and_write_file("/enclosures/elephant_house/monkey_house/infrastructure/info.txt"); + + vfs.do_mount("/enclosures/elephant_house/monkey_house", fs_1); + read_and_write_file("/enclosures/elephant_house/monkey_house/information/info_2.txt"); + + auto result = vfs.unmount("/enclosures/elephant_house"); + if (result == kernel::filesystem::vfs::operation_result::unmount_failed) + { + kstd::println("[TEST] Unmount failed as expected due to active child mount."); + } + + vfs.unmount("/enclosures/elephant_house/monkey_house"); + result = vfs.unmount("/enclosures/elephant_house"); + if (result == kernel::filesystem::vfs::operation_result::success) + { + kstd::println("[TEST] Unmount succeeded after unmounting child mount."); + } } auto run_test_code() -> void |
