winfsp unit tests and fixes
This commit is contained in:
parent
5ca67b28cf
commit
da60c39216
@ -71,8 +71,6 @@ protected:
|
|||||||
std::to_string(static_cast<std::uint8_t>(provider_t::type)),
|
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"});
|
mount_location = utils::path::combine(test_directory, {"mount"});
|
||||||
ASSERT_TRUE(utils::file::directory(mount_location).create_directory());
|
ASSERT_TRUE(utils::file::directory(mount_location).create_directory());
|
||||||
|
|
||||||
@ -145,9 +143,6 @@ protected:
|
|||||||
static void TearDownTestCase() {
|
static void TearDownTestCase() {
|
||||||
execute_unmount();
|
execute_unmount();
|
||||||
std::filesystem::current_path(current_directory);
|
std::filesystem::current_path(current_directory);
|
||||||
|
|
||||||
[[maybe_unused]] auto ret =
|
|
||||||
utils::file::directory(test_directory).remove_recursively();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -65,8 +65,6 @@ protected:
|
|||||||
std::to_string(static_cast<std::uint8_t>(provider_t::type)),
|
std::to_string(static_cast<std::uint8_t>(provider_t::type)),
|
||||||
});
|
});
|
||||||
|
|
||||||
ASSERT_TRUE(utils::file::directory(test_directory).remove_recursively());
|
|
||||||
|
|
||||||
mount_location = "U:";
|
mount_location = "U:";
|
||||||
|
|
||||||
cfg_directory = utils::path::combine(test_directory, {"cfg"});
|
cfg_directory = utils::path::combine(test_directory, {"cfg"});
|
||||||
@ -136,8 +134,6 @@ protected:
|
|||||||
static void TearDownTestCase() {
|
static void TearDownTestCase() {
|
||||||
execute_unmount();
|
execute_unmount();
|
||||||
std::filesystem::current_path(current_directory);
|
std::filesystem::current_path(current_directory);
|
||||||
[[maybe_unused]] auto ret =
|
|
||||||
utils::file::directory(test_directory).remove_recursively();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -28,6 +28,8 @@
|
|||||||
|
|
||||||
using namespace repertory;
|
using namespace repertory;
|
||||||
|
|
||||||
|
int PROJECT_TEST_RESULT{0};
|
||||||
|
|
||||||
auto main(int argc, char **argv) -> int {
|
auto main(int argc, char **argv) -> int {
|
||||||
#if defined(PROJECT_ENABLE_BACKWARD_CPP)
|
#if defined(PROJECT_ENABLE_BACKWARD_CPP)
|
||||||
static backward::SignalHandling sh;
|
static backward::SignalHandling sh;
|
||||||
@ -39,9 +41,9 @@ auto main(int argc, char **argv) -> int {
|
|||||||
}
|
}
|
||||||
|
|
||||||
::testing::InitGoogleTest(&argc, argv);
|
::testing::InitGoogleTest(&argc, argv);
|
||||||
auto ret = RUN_ALL_TESTS();
|
PROJECT_TEST_RESULT = RUN_ALL_TESTS();
|
||||||
|
|
||||||
repertory::project_cleanup();
|
repertory::project_cleanup();
|
||||||
|
|
||||||
return ret;
|
return PROJECT_TEST_RESULT;
|
||||||
}
|
}
|
||||||
|
@ -67,10 +67,7 @@ protected:
|
|||||||
cfg->set_enable_chunk_downloader_timeout(false);
|
cfg->set_enable_chunk_downloader_timeout(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TearDown() override {
|
void TearDown() override { event_system::instance().stop(); }
|
||||||
// EXPECT_TRUE(utils::file::directory(file_manager_dir).remove_recursively());
|
|
||||||
event_system::instance().stop();
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
std::atomic<std::size_t> file_manager_test::inst{0U};
|
std::atomic<std::size_t> file_manager_test::inst{0U};
|
||||||
|
@ -631,7 +631,6 @@ static void run_tests(const app_config &cfg, i_provider &provider) {
|
|||||||
TEST(providers, encrypt_provider) {
|
TEST(providers, encrypt_provider) {
|
||||||
const auto config_path =
|
const auto config_path =
|
||||||
utils::path::combine(test::get_test_output_dir(), {"encrypt_provider"});
|
utils::path::combine(test::get_test_output_dir(), {"encrypt_provider"});
|
||||||
ASSERT_TRUE(utils::file::directory(config_path).remove_recursively());
|
|
||||||
|
|
||||||
console_consumer consumer{};
|
console_consumer consumer{};
|
||||||
event_system::instance().start();
|
event_system::instance().start();
|
||||||
@ -674,7 +673,6 @@ TEST(providers, encrypt_provider) {
|
|||||||
TEST(providers, s3_provider) {
|
TEST(providers, s3_provider) {
|
||||||
const auto config_path =
|
const auto config_path =
|
||||||
utils::path::combine(test::get_test_output_dir(), {"s3_provider"});
|
utils::path::combine(test::get_test_output_dir(), {"s3_provider"});
|
||||||
ASSERT_TRUE(utils::file::directory(config_path).remove_recursively());
|
|
||||||
|
|
||||||
console_consumer consumer{};
|
console_consumer consumer{};
|
||||||
event_system::instance().start();
|
event_system::instance().start();
|
||||||
@ -713,7 +711,6 @@ TEST(providers, s3_provider) {
|
|||||||
TEST(providers, sia_provider) {
|
TEST(providers, sia_provider) {
|
||||||
const auto config_path =
|
const auto config_path =
|
||||||
utils::path::combine(test::get_test_output_dir(), {"sia_provider"});
|
utils::path::combine(test::get_test_output_dir(), {"sia_provider"});
|
||||||
ASSERT_TRUE(utils::file::directory(config_path).remove_recursively());
|
|
||||||
|
|
||||||
console_consumer consumer{};
|
console_consumer consumer{};
|
||||||
event_system::instance().start();
|
event_system::instance().start();
|
||||||
|
@ -206,10 +206,10 @@ static void fgetattr_test(repertory::remote_fuse::remote_client &client) {
|
|||||||
|
|
||||||
EXPECT_FALSE(directory);
|
EXPECT_FALSE(directory);
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
struct _stat64 st1 {};
|
struct _stat64 st1{};
|
||||||
_stat64(&test_file[0], &st1);
|
_stat64(&test_file[0], &st1);
|
||||||
#else
|
#else
|
||||||
struct stat st1 {};
|
struct stat st1{};
|
||||||
stat(&test_file[0], &st1);
|
stat(&test_file[0], &st1);
|
||||||
#endif
|
#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_EQ(0, client.fuse_getattr(api_path.c_str(), st, directory));
|
||||||
EXPECT_FALSE(directory);
|
EXPECT_FALSE(directory);
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
struct _stat64 st1 {};
|
struct _stat64 st1{};
|
||||||
_stat64(&test_file[0], &st1);
|
_stat64(&test_file[0], &st1);
|
||||||
#else
|
#else
|
||||||
struct stat st1 {};
|
struct stat st1{};
|
||||||
stat(&test_file[0], &st1);
|
stat(&test_file[0], &st1);
|
||||||
#endif
|
#endif
|
||||||
EXPECT_EQ(11u, st.st_gid);
|
EXPECT_EQ(11u, st.st_gid);
|
||||||
@ -990,6 +990,5 @@ TEST(remote_fuse, all_tests) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
event_system::instance().stop();
|
event_system::instance().stop();
|
||||||
EXPECT_TRUE(utils::file::directory(fuse_remote_dir).remove_recursively());
|
|
||||||
}
|
}
|
||||||
} // namespace fuse_test
|
} // namespace fuse_test
|
||||||
|
@ -538,6 +538,5 @@ TEST(remote_winfsp, all_tests) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
event_system::instance().stop();
|
event_system::instance().stop();
|
||||||
EXPECT_TRUE(utils::file::directory(win_remote_dir).remove_recursively());
|
|
||||||
}
|
}
|
||||||
} // namespace winfsp_test
|
} // namespace winfsp_test
|
||||||
|
@ -21,6 +21,8 @@
|
|||||||
*/
|
*/
|
||||||
#include "test.hpp"
|
#include "test.hpp"
|
||||||
|
|
||||||
|
extern int PROJECT_TEST_RESULT;
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
static std::recursive_mutex file_mtx{};
|
static std::recursive_mutex file_mtx{};
|
||||||
|
|
||||||
@ -28,22 +30,24 @@ static std::vector<std::unique_ptr<repertory::utils::file::i_fs_item>>
|
|||||||
generated_files{};
|
generated_files{};
|
||||||
|
|
||||||
static void delete_generated_files() {
|
static void delete_generated_files() {
|
||||||
repertory::recur_mutex_lock lock{file_mtx};
|
if (PROJECT_TEST_RESULT == 0) {
|
||||||
std::map<std::string, bool> parent_paths;
|
repertory::recur_mutex_lock lock{file_mtx};
|
||||||
for (auto &&path : generated_files) {
|
std::map<std::string, bool> parent_paths;
|
||||||
parent_paths[repertory::utils::path::get_parent_path(path->get_path())] =
|
for (auto &&path : generated_files) {
|
||||||
true;
|
parent_paths[repertory::utils::path::get_parent_path(path->get_path())] =
|
||||||
}
|
true;
|
||||||
generated_files.clear();
|
}
|
||||||
|
generated_files.clear();
|
||||||
|
|
||||||
for (auto &&entry : parent_paths) {
|
for (auto &&entry : parent_paths) {
|
||||||
EXPECT_TRUE(
|
EXPECT_TRUE(
|
||||||
repertory::utils::file::directory(entry.first).remove_recursively());
|
repertory::utils::file::directory(entry.first).remove_recursively());
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPECT_TRUE(
|
EXPECT_TRUE(repertory::utils::file::directory(
|
||||||
repertory::utils::file::directory(repertory::test::get_test_output_dir())
|
repertory::test::get_test_output_dir())
|
||||||
.remove_recursively());
|
.remove_recursively());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
struct file_deleter final {
|
struct file_deleter final {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user