aboutsummaryrefslogtreecommitdiff
path: root/kernel/src/filesystem/mount.tests.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/src/filesystem/mount.tests.cpp')
-rw-r--r--kernel/src/filesystem/mount.tests.cpp16
1 files changed, 9 insertions, 7 deletions
diff --git a/kernel/src/filesystem/mount.tests.cpp b/kernel/src/filesystem/mount.tests.cpp
index 6b66571..40b7cbb 100644
--- a/kernel/src/filesystem/mount.tests.cpp
+++ b/kernel/src/filesystem/mount.tests.cpp
@@ -11,6 +11,8 @@
#include <catch2/catch_test_macros.hpp>
+#include <stdexcept>
+
SCENARIO("Mount construction", "[filesystem][mount]")
{
GIVEN("a filesystem and a root dentry")
@@ -21,7 +23,7 @@ SCENARIO("Mount construction", "[filesystem][mount]")
WHEN("constructing a mount with the filesystem and root dentry")
{
- auto mount = kernel::filesystem::mount{root_dentry, root_dentry, fs, nullptr};
+ auto mount = kernel::filesystem::mount{root_dentry, root_dentry, fs, nullptr, nullptr};
THEN("the mount has the correct filesystem, root dentry, mount dentry, and mount path")
{
@@ -42,7 +44,7 @@ SCENARIO("Mount construction", "[filesystem][mount]")
{
THEN("the constructor panics")
{
- REQUIRE_THROWS_AS((kernel::filesystem::mount{root_dentry, root_dentry, nullptr, nullptr}),
+ REQUIRE_THROWS_AS((kernel::filesystem::mount{root_dentry, root_dentry, nullptr, nullptr, nullptr}),
kernel::tests::cpu::halt);
}
}
@@ -60,7 +62,7 @@ SCENARIO("Mount reference counting", "[filesystem][mount]")
THEN("reference count can be incremented and decremented, the mount is ready to unmount when the reference "
"count == 0")
{
- auto mount = kernel::filesystem::mount{root_dentry, root_dentry, fs, nullptr};
+ auto mount = kernel::filesystem::mount{root_dentry, root_dentry, fs, nullptr, nullptr};
mount.increment_ref_count();
REQUIRE(mount.ref_count() == 1);
@@ -70,20 +72,20 @@ SCENARIO("Mount reference counting", "[filesystem][mount]")
REQUIRE(mount.ref_count() == 2);
REQUIRE_FALSE(mount.is_ready_to_unmount());
- REQUIRE(mount.decrement_ref_count());
+ mount.decrement_ref_count();
REQUIRE(mount.ref_count() == 1);
REQUIRE_FALSE(mount.is_ready_to_unmount());
- REQUIRE(mount.decrement_ref_count());
+ mount.decrement_ref_count();
REQUIRE(mount.ref_count() == 0);
REQUIRE(mount.is_ready_to_unmount());
}
THEN("decrementing reference count when it is already zero does not decrement it below zero")
{
- auto mount = kernel::filesystem::mount{root_dentry, root_dentry, fs, nullptr};
+ auto mount = kernel::filesystem::mount{root_dentry, root_dentry, fs, nullptr, nullptr};
- REQUIRE_FALSE(mount.decrement_ref_count());
+ REQUIRE_THROWS_AS(mount.decrement_ref_count(), std::runtime_error);
REQUIRE(mount.ref_count() == 0);
REQUIRE(mount.is_ready_to_unmount());
}