From ab757dfd36c5a3a8f81e8f6829f7c4ddc71a32e2 Mon Sep 17 00:00:00 2001 From: "Scott E. Graves" Date: Wed, 2 Apr 2025 14:11:37 -0500 Subject: [PATCH] [Unit Test] Complete WinFSP unit tests #21 initial support for winfsp to linux remote testing --- .../include/fixtures/fuse_fixture.hpp | 38 +++++++++++++++++-- 1 file changed, 35 insertions(+), 3 deletions(-) diff --git a/repertory/repertory_test/include/fixtures/fuse_fixture.hpp b/repertory/repertory_test/include/fixtures/fuse_fixture.hpp index bd495be6..55e65640 100644 --- a/repertory/repertory_test/include/fixtures/fuse_fixture.hpp +++ b/repertory/repertory_test/include/fixtures/fuse_fixture.hpp @@ -54,21 +54,37 @@ namespace repertory { struct local_s3 final { static constexpr const provider_type type{provider_type::s3}; static constexpr const provider_type type2{provider_type::s3}; + static constexpr const std::uint16_t port{0U}; }; struct local_sia final { static constexpr const provider_type type{provider_type::sia}; static constexpr const provider_type type2{provider_type::sia}; + static constexpr const std::uint16_t port{0U}; }; struct remote_s3 final { static constexpr const provider_type type{provider_type::remote}; static constexpr const provider_type type2{provider_type::s3}; + static constexpr const std::uint16_t port{0U}; }; struct remote_sia final { static constexpr const provider_type type{provider_type::remote}; static constexpr const provider_type type2{provider_type::sia}; + static constexpr const std::uint16_t port{0U}; +}; + +struct remote_winfsp_to_linux final { + static constexpr const provider_type type{provider_type::remote}; + static constexpr const provider_type type2{provider_type::unknown}; + static constexpr const std::uint16_t port{30001U}; +}; + +struct remote_linux_to_winfsp final { + static constexpr const provider_type type{provider_type::remote}; + static constexpr const provider_type type2{provider_type::unknown}; + static constexpr const std::uint16_t port{30001U}; }; template class fuse_test : public ::testing::Test { @@ -178,7 +194,7 @@ protected: execute_mount(drive_args, mount_location); }; - const auto mount_remote = [&]() { + const auto mount_remote = [&](std::uint16_t port = 30000U) { { mount_location2 = mount_location; @@ -187,7 +203,8 @@ protected: { "fuse_test", app_config::get_provider_name(provider_t::type) + '_' + - app_config::get_provider_name(provider_t::type2), + app_config::get_provider_name(provider_t::type2) + '_' + + std::to_string(port), }); mount_location = utils::path::combine(test_directory, {"mount"}); @@ -206,7 +223,7 @@ protected: "-dd", config2->get_data_directory(), "-rm", - "localhost:30000", + fmt::format("localhost:{}", port), mount_location, }); } @@ -233,6 +250,10 @@ protected: mount_sia(); } break; + case provider_type::unknown: + mount_remote(provider_t::port); + return; + default: throw std::runtime_error("remote provider type is not implemented"); return; @@ -411,8 +432,19 @@ template std::string fuse_test::mount_location2; // using fuse_provider_types = ::testing::Types; +#if defined(_WIN32) +using fuse_provider_types = + ::testing::Types; +#elif defined(__linux__) using fuse_provider_types = ::testing::Types; +// using fuse_provider_types = +// ::testing::Types; +#else // !defined(__linux__) +build fails here +#endif // defined(_WIN32) } // namespace repertory #endif // !defined(_WIN32)