winfsp unit tests and fixes

This commit is contained in:
2024-10-30 11:25:08 -05:00
parent 5ca67b28cf
commit da60c39216
8 changed files with 27 additions and 38 deletions

View File

@@ -71,8 +71,6 @@ protected:
std::to_string(static_cast<std::uint8_t>(provider_t::type)),
});
ASSERT_TRUE(utils::file::directory(test_directory).remove_recursively());
mount_location = utils::path::combine(test_directory, {"mount"});
ASSERT_TRUE(utils::file::directory(mount_location).create_directory());
@@ -145,9 +143,6 @@ protected:
static void TearDownTestCase() {
execute_unmount();
std::filesystem::current_path(current_directory);
[[maybe_unused]] auto ret =
utils::file::directory(test_directory).remove_recursively();
}
public:

View File

@@ -65,8 +65,6 @@ protected:
std::to_string(static_cast<std::uint8_t>(provider_t::type)),
});
ASSERT_TRUE(utils::file::directory(test_directory).remove_recursively());
mount_location = "U:";
cfg_directory = utils::path::combine(test_directory, {"cfg"});
@@ -136,8 +134,6 @@ protected:
static void TearDownTestCase() {
execute_unmount();
std::filesystem::current_path(current_directory);
[[maybe_unused]] auto ret =
utils::file::directory(test_directory).remove_recursively();
}
public:

View File

@@ -28,6 +28,8 @@
using namespace repertory;
int PROJECT_TEST_RESULT{0};
auto main(int argc, char **argv) -> int {
#if defined(PROJECT_ENABLE_BACKWARD_CPP)
static backward::SignalHandling sh;
@@ -39,9 +41,9 @@ auto main(int argc, char **argv) -> int {
}
::testing::InitGoogleTest(&argc, argv);
auto ret = RUN_ALL_TESTS();
PROJECT_TEST_RESULT = RUN_ALL_TESTS();
repertory::project_cleanup();
return ret;
return PROJECT_TEST_RESULT;
}

View File

@@ -67,10 +67,7 @@ protected:
cfg->set_enable_chunk_downloader_timeout(false);
}
void TearDown() override {
// EXPECT_TRUE(utils::file::directory(file_manager_dir).remove_recursively());
event_system::instance().stop();
}
void TearDown() override { event_system::instance().stop(); }
};
std::atomic<std::size_t> file_manager_test::inst{0U};

View File

@@ -631,7 +631,6 @@ static void run_tests(const app_config &cfg, i_provider &provider) {
TEST(providers, encrypt_provider) {
const auto config_path =
utils::path::combine(test::get_test_output_dir(), {"encrypt_provider"});
ASSERT_TRUE(utils::file::directory(config_path).remove_recursively());
console_consumer consumer{};
event_system::instance().start();
@@ -674,7 +673,6 @@ TEST(providers, encrypt_provider) {
TEST(providers, s3_provider) {
const auto config_path =
utils::path::combine(test::get_test_output_dir(), {"s3_provider"});
ASSERT_TRUE(utils::file::directory(config_path).remove_recursively());
console_consumer consumer{};
event_system::instance().start();
@@ -713,7 +711,6 @@ TEST(providers, s3_provider) {
TEST(providers, sia_provider) {
const auto config_path =
utils::path::combine(test::get_test_output_dir(), {"sia_provider"});
ASSERT_TRUE(utils::file::directory(config_path).remove_recursively());
console_consumer consumer{};
event_system::instance().start();

View File

@@ -206,10 +206,10 @@ static void fgetattr_test(repertory::remote_fuse::remote_client &client) {
EXPECT_FALSE(directory);
#if defined(_WIN32)
struct _stat64 st1 {};
struct _stat64 st1{};
_stat64(&test_file[0], &st1);
#else
struct stat st1 {};
struct stat st1{};
stat(&test_file[0], &st1);
#endif
@@ -318,10 +318,10 @@ static void getattr_test(repertory::remote_fuse::remote_client &client) {
EXPECT_EQ(0, client.fuse_getattr(api_path.c_str(), st, directory));
EXPECT_FALSE(directory);
#if defined(_WIN32)
struct _stat64 st1 {};
struct _stat64 st1{};
_stat64(&test_file[0], &st1);
#else
struct stat st1 {};
struct stat st1{};
stat(&test_file[0], &st1);
#endif
EXPECT_EQ(11u, st.st_gid);
@@ -990,6 +990,5 @@ TEST(remote_fuse, all_tests) {
}
event_system::instance().stop();
EXPECT_TRUE(utils::file::directory(fuse_remote_dir).remove_recursively());
}
} // namespace fuse_test

View File

@@ -538,6 +538,5 @@ TEST(remote_winfsp, all_tests) {
}
event_system::instance().stop();
EXPECT_TRUE(utils::file::directory(win_remote_dir).remove_recursively());
}
} // namespace winfsp_test