winfsp unit tests and fixes
This commit is contained in:
@ -21,6 +21,8 @@
|
||||
*/
|
||||
#include "test.hpp"
|
||||
|
||||
extern int PROJECT_TEST_RESULT;
|
||||
|
||||
namespace {
|
||||
static std::recursive_mutex file_mtx{};
|
||||
|
||||
@ -28,22 +30,24 @@ static std::vector<std::unique_ptr<repertory::utils::file::i_fs_item>>
|
||||
generated_files{};
|
||||
|
||||
static void delete_generated_files() {
|
||||
repertory::recur_mutex_lock lock{file_mtx};
|
||||
std::map<std::string, bool> parent_paths;
|
||||
for (auto &&path : generated_files) {
|
||||
parent_paths[repertory::utils::path::get_parent_path(path->get_path())] =
|
||||
true;
|
||||
}
|
||||
generated_files.clear();
|
||||
if (PROJECT_TEST_RESULT == 0) {
|
||||
repertory::recur_mutex_lock lock{file_mtx};
|
||||
std::map<std::string, bool> parent_paths;
|
||||
for (auto &&path : generated_files) {
|
||||
parent_paths[repertory::utils::path::get_parent_path(path->get_path())] =
|
||||
true;
|
||||
}
|
||||
generated_files.clear();
|
||||
|
||||
for (auto &&entry : parent_paths) {
|
||||
EXPECT_TRUE(
|
||||
repertory::utils::file::directory(entry.first).remove_recursively());
|
||||
}
|
||||
for (auto &&entry : parent_paths) {
|
||||
EXPECT_TRUE(
|
||||
repertory::utils::file::directory(entry.first).remove_recursively());
|
||||
}
|
||||
|
||||
EXPECT_TRUE(
|
||||
repertory::utils::file::directory(repertory::test::get_test_output_dir())
|
||||
.remove_recursively());
|
||||
EXPECT_TRUE(repertory::utils::file::directory(
|
||||
repertory::test::get_test_output_dir())
|
||||
.remove_recursively());
|
||||
}
|
||||
}
|
||||
|
||||
struct file_deleter final {
|
||||
|
Reference in New Issue
Block a user