fix
Some checks reported errors
BlockStorage/repertory/pipeline/head Something is wrong with the build of this commit
Some checks reported errors
BlockStorage/repertory/pipeline/head Something is wrong with the build of this commit
This commit is contained in:
@ -29,33 +29,21 @@ static std::recursive_mutex file_mtx{};
|
||||
static std::vector<std::unique_ptr<repertory::utils::file::i_fs_item>>
|
||||
generated_files{};
|
||||
|
||||
static void delete_generated_files() {
|
||||
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;
|
||||
}
|
||||
struct file_deleter final {
|
||||
std::string test_output_dir;
|
||||
|
||||
~file_deleter() {
|
||||
generated_files.clear();
|
||||
|
||||
for (auto &&entry : parent_paths) {
|
||||
EXPECT_TRUE(
|
||||
repertory::utils::file::directory(entry.first).remove_recursively());
|
||||
if (PROJECT_TEST_RESULT == 0) {
|
||||
EXPECT_TRUE(repertory::utils::file::directory(test_output_dir)
|
||||
.remove_recursively());
|
||||
}
|
||||
|
||||
EXPECT_TRUE(repertory::utils::file::directory(
|
||||
repertory::test::get_test_output_dir())
|
||||
.remove_recursively());
|
||||
}
|
||||
}
|
||||
|
||||
struct file_deleter final {
|
||||
~file_deleter() { delete_generated_files(); }
|
||||
};
|
||||
|
||||
static auto deleter{
|
||||
std::make_unique<file_deleter>(),
|
||||
const auto deleter{
|
||||
std::make_unique<file_deleter>(repertory::test::get_test_output_dir()),
|
||||
};
|
||||
} // namespace
|
||||
|
||||
|
Reference in New Issue
Block a user