diff --git a/repertory/librepertory/src/drives/winfsp/remotewinfsp/remote_winfsp_drive.cpp b/repertory/librepertory/src/drives/winfsp/remotewinfsp/remote_winfsp_drive.cpp index aced7c96..d9e28372 100644 --- a/repertory/librepertory/src/drives/winfsp/remotewinfsp/remote_winfsp_drive.cpp +++ b/repertory/librepertory/src/drives/winfsp/remotewinfsp/remote_winfsp_drive.cpp @@ -213,9 +213,10 @@ auto remote_winfsp_drive::Init(PVOID host) -> NTSTATUS { } file_system_host->SetCasePreservedNames(TRUE); - file_system_host->SetCaseSensitiveSearch(FALSE); + file_system_host->SetCaseSensitiveSearch(TRUE); file_system_host->SetFileInfoTimeout(1000); file_system_host->SetFlushAndPurgeOnCleanup(TRUE); + file_system_host->SetMaxComponentLength(255U); file_system_host->SetNamedStreams(FALSE); file_system_host->SetPassQueryDirectoryPattern(FALSE); file_system_host->SetPersistentAcls(FALSE); diff --git a/repertory/repertory_test/include/fixtures/fuse_fixture.hpp b/repertory/repertory_test/include/fixtures/fuse_fixture.hpp index 51c10f84..5b295328 100644 --- a/repertory/repertory_test/include/fixtures/fuse_fixture.hpp +++ b/repertory/repertory_test/include/fixtures/fuse_fixture.hpp @@ -73,6 +73,8 @@ protected: }); mount_location = utils::path::combine(test_directory, {"mount"}); + utils::string::to_lower(mount_location); + ASSERT_TRUE(utils::file::directory(mount_location).create_directory()); cfg_directory = utils::path::combine(test_directory, {"cfg"}); diff --git a/repertory/repertory_test/src/winfsp_drive_info_test.cpp b/repertory/repertory_test/src/winfsp_drive_info_test.cpp index 03f29ef4..cb8d912e 100644 --- a/repertory/repertory_test/src/winfsp_drive_info_test.cpp +++ b/repertory/repertory_test/src/winfsp_drive_info_test.cpp @@ -124,8 +124,7 @@ TYPED_TEST(winfsp_test, info_can_get_file_name_info) { auto *info = reinterpret_cast(name_info.data()); auto expected_name{ - std::string{"\\repertory\\"} + - utils::string::to_lower(this->mount_location).at(0U) + + std::string{"\\repertory\\"} + this->mount_location.at(0U) + "\\test_file_2", }; @@ -229,8 +228,7 @@ TYPED_TEST(winfsp_test, info_can_get_file_path) { VOLUME_NAME_NONE | FILE_NAME_OPENED); auto expected_name{ - std::string{"\\repertory\\"} + - utils::string::to_lower(this->mount_location).at(0U) + + std::string{"\\repertory\\"} + this->mount_location.at(0U) + "\\test_file_2", }; EXPECT_EQ(result, static_cast(expected_name.size())); diff --git a/repertory/repertory_test/src/winfsp_drive_test.cpp b/repertory/repertory_test/src/winfsp_drive_test.cpp index 8764a21d..eee43dc4 100644 --- a/repertory/repertory_test/src/winfsp_drive_test.cpp +++ b/repertory/repertory_test/src/winfsp_drive_test.cpp @@ -31,7 +31,14 @@ // TODO revisit delete_access_test // TODO revisit getfileattr_test // TODO revisit delete_ex_test -// TODO revisit rename_backslash_dotest +// TODO revisit rename_backslash_test +// TODO revisit rename_open_test +// TODO revisit rename_caseins_test +// TODO revisit rename_flipflop_test +// TODO revisit rename_mmap_test +// TODO revisit rename_standby_test +// TODO revisit rename_pid_test +// TODO revisit rename_ex_test // // Implemented test cases based on WinFsp tests: diff --git a/repertory/repertory_test/src/winfsp_drive_volume_test.cpp b/repertory/repertory_test/src/winfsp_drive_volume_test.cpp new file mode 100644 index 00000000..52f5d1f1 --- /dev/null +++ b/repertory/repertory_test/src/winfsp_drive_volume_test.cpp @@ -0,0 +1,58 @@ +/* + Copyright <2018-2024> + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all + copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE. +*/ +#if defined(_WIN32) + +// +// Implemented test cases based on WinFsp tests: +// https://github.com/winfsp/winfsp/blob/v2.0/tst/winfsp-tests +// +#include "fixtures/winfsp_fixture.hpp" + +namespace repertory { +TYPED_TEST_CASE(winfsp_test, winfsp_provider_types); + +TYPED_TEST(winfsp_test, volume_can_get_volume_info) { + std::string volume_label; + volume_label.resize(MAX_PATH + 1U); + + std::string fs_name; + fs_name.resize(MAX_PATH + 1U); + + DWORD flags{}; + DWORD max_component_length{}; + DWORD serial_num{}; + EXPECT_TRUE(::GetVolumeInformationA( + this->mount_location.c_str(), volume_label.data(), + static_cast(volume_label.size()), &serial_num, + &max_component_length, &flags, fs_name.data(), + static_cast(fs_name.size()))); + EXPECT_EQ(FILE_CASE_SENSITIVE_SEARCH | FILE_CASE_PRESERVED_NAMES | + FILE_UNICODE_ON_DISK, + flags); + EXPECT_EQ(255U, max_component_length); + EXPECT_EQ(0U, serial_num); + EXPECT_STREQ("", volume_label.c_str()); + EXPECT_STREQ(this->mount_location.c_str(), fs_name.c_str()); +} +} // namespace repertory + +#endif // defined(_WIN32)