winfsp unit tests and fixes
This commit is contained in:
parent
47a6bdbcd2
commit
151b6775b0
@ -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);
|
||||
|
@ -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"});
|
||||
|
@ -124,8 +124,7 @@ TYPED_TEST(winfsp_test, info_can_get_file_name_info) {
|
||||
|
||||
auto *info = reinterpret_cast<FILE_NAME_INFO *>(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<DWORD>(expected_name.size()));
|
||||
|
@ -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:
|
||||
|
58
repertory/repertory_test/src/winfsp_drive_volume_test.cpp
Normal file
58
repertory/repertory_test/src/winfsp_drive_volume_test.cpp
Normal file
@ -0,0 +1,58 @@
|
||||
/*
|
||||
Copyright <2018-2024> <scott.e.graves@protonmail.com>
|
||||
|
||||
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<DWORD>(volume_label.size()), &serial_num,
|
||||
&max_component_length, &flags, fs_name.data(),
|
||||
static_cast<DWORD>(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)
|
Loading…
x
Reference in New Issue
Block a user