From b3c7d9fe051033b36487931ca7e4cdcfc890e3e7 Mon Sep 17 00:00:00 2001 From: Fred Suter Date: Thu, 16 May 2024 10:57:05 -0400 Subject: [PATCH] test of moving file across partitions (forbidden) --- test/file_system_test.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/test/file_system_test.cpp b/test/file_system_test.cpp index 011db4c..af665be 100644 --- a/test/file_system_test.cpp +++ b/test/file_system_test.cpp @@ -154,7 +154,13 @@ TEST_F(FileSystemTest, FileMove) { ASSERT_FALSE(fs_->file_exists("/dev/a/b/c/foo.txt")); ASSERT_TRUE(fs_->file_exists("/dev/a/stuff.txt")); ASSERT_DOUBLE_EQ(fs_->partition_by_name("/dev/a/")->get_free_space(), 90*1000); - }); + + auto ods = sgfs::OneDiskStorage::create("my_storage", disk_two_); + XBT_INFO("Mount a new partition"); + ASSERT_NO_THROW(fs_->mount_partition("/dev/b/", ods, "100kB")); + XBT_INFO("Move file /dev/a/stuff.txt to /dev/b/stuff.txt which is forbidden"); + ASSERT_THROW(fs_->move_file("/dev/a/stuff.txt", "/dev/b/stuff.txt"), sgfs::FileSystemException); + }); // Run the simulation ASSERT_NO_THROW(sg4::Engine::get_instance()->run());