updated build system
Some checks failed
BlockStorage/repertory/pipeline/head There was a failure building this commit

This commit is contained in:
2024-08-31 08:27:23 -05:00
parent 64f1083fb7
commit 82ead48fa8
8 changed files with 360 additions and 194 deletions

View File

@ -24,7 +24,7 @@
namespace {
static std::recursive_mutex file_mtx{};
static std::vector<std::unique_ptr<repertory::utils::file::i_file>>
static std::vector<std::unique_ptr<repertory::utils::file::i_fs_item>>
generated_files{};
static void delete_generated_files() {
@ -32,8 +32,7 @@ static void delete_generated_files() {
std::optional<std::string> parent_path;
for (auto &&path : generated_files) {
if (parent_path->empty()) {
parent_path =
repertory::utils::path::get_parent_path(path->get_path());
parent_path = repertory::utils::path::get_parent_path(path->get_path());
}
[[maybe_unused]] auto removed = path->remove();
@ -73,10 +72,25 @@ auto create_random_file(std::size_t size) -> utils::file::i_file & {
}
generated_files.emplace_back(std::move(file));
return *generated_files.back();
return *dynamic_cast<utils::file::i_file *>(generated_files.back().get());
}
#endif // defined(PROJECT_ENABLE_LIBSODIUM)
auto generate_test_directory() -> utils::file::i_directory & {
recur_mutex_lock lock{file_mtx};
auto path = utils::path::combine(
get_test_output_dir(),
{
std::string{"test_dir"} + std::to_string(generated_files.size()),
});
generated_files.emplace_back(std::unique_ptr<utils::file::i_fs_item>(
new utils::file::directory{path}));
return *dynamic_cast<utils::file::i_directory *>(
generated_files.back().get());
}
auto generate_test_file_name(std::string_view file_name_no_extension)
-> std::string {
recur_mutex_lock lock{file_mtx};