From 914317d3db05758483eaea09a60ef8bfa3981948 Mon Sep 17 00:00:00 2001 From: Tor Egge Date: Thu, 2 Jun 2022 16:35:21 +0200 Subject: Remove most use of vespalib::rmdir in searchcore. --- .../tests/proton/documentdb/configurer/configurer_test.cpp | 12 ++++++------ searchcore/src/tests/proton/documentdb/documentdb_test.cpp | 11 ++++++----- .../tests/proton/documentdb/feedhandler/feedhandler_test.cpp | 4 ++-- 3 files changed, 14 insertions(+), 13 deletions(-) (limited to 'searchcore/src/tests/proton/documentdb') diff --git a/searchcore/src/tests/proton/documentdb/configurer/configurer_test.cpp b/searchcore/src/tests/proton/documentdb/configurer/configurer_test.cpp index 948c9cfe25e..b57ff052e82 100644 --- a/searchcore/src/tests/proton/documentdb/configurer/configurer_test.cpp +++ b/searchcore/src/tests/proton/documentdb/configurer/configurer_test.cpp @@ -26,10 +26,10 @@ #include #include #include -#include #include #include #include +#include using namespace config; using namespace document; @@ -173,8 +173,8 @@ Fixture::Fixture() _resolver(), _configurer() { - vespalib::rmdir(BASE_DIR, true); - vespalib::mkdir(BASE_DIR); + std::filesystem::remove_all(std::filesystem::path(BASE_DIR)); + std::filesystem::create_directory(std::filesystem::path(BASE_DIR)); initViewSet(_views); _configurer = std::make_unique(_views._summaryMgr, _views.searchView, _views.feedView, _queryLimiter, _constantValueRepo, _clock.clock(), "test", 0); @@ -284,8 +284,8 @@ struct FastAccessFixture _view(_service.write()), _configurer(_view._feedView, std::make_unique(), "test") { - vespalib::rmdir(BASE_DIR, true); - vespalib::mkdir(BASE_DIR); + std::filesystem::remove_all(std::filesystem::path(BASE_DIR)); + std::filesystem::create_directory(std::filesystem::path(BASE_DIR)); } ~FastAccessFixture() { _service.shutdown(); @@ -692,5 +692,5 @@ TEST("require that subdbs should change if relevant config changed") TEST_MAIN() { TEST_RUN_ALL(); - vespalib::rmdir(BASE_DIR, true); + std::filesystem::remove_all(std::filesystem::path(BASE_DIR)); } diff --git a/searchcore/src/tests/proton/documentdb/documentdb_test.cpp b/searchcore/src/tests/proton/documentdb/documentdb_test.cpp index a9f923833e5..916f3106923 100644 --- a/searchcore/src/tests/proton/documentdb/documentdb_test.cpp +++ b/searchcore/src/tests/proton/documentdb/documentdb_test.cpp @@ -36,6 +36,7 @@ #include #include #include +#include #include using namespace cloud::config::filedistribution; @@ -62,10 +63,10 @@ namespace { void cleanup_dirs(bool file_config) { - vespalib::rmdir("typea", true); - vespalib::rmdir("tmp", true); + std::filesystem::remove_all(std::filesystem::path("typea")); + std::filesystem::remove_all(std::filesystem::path("tmp")); if (file_config) { - vespalib::rmdir("config", true); + std::filesystem::remove_all(std::filesystem::path("config")); } } @@ -105,7 +106,7 @@ FixtureBase::FixtureBase(bool file_config) : _cleanup(true), _file_config(file_config) { - vespalib::mkdir("typea"); + std::filesystem::create_directory(std::filesystem::path("typea")); } @@ -352,7 +353,7 @@ TEST("require that resume after interrupted save config works") std::cout << "Best config serial is " << best_config_snapshot.syncToken << std::endl; auto old_config_subdir = config_subdir(best_config_snapshot.syncToken); auto new_config_subdir = config_subdir(serialNum + 1); - vespalib::mkdir(new_config_subdir); + std::filesystem::create_directories(std::filesystem::path(new_config_subdir)); auto config_files = vespalib::listDirectory(old_config_subdir); for (auto &config_file : config_files) { vespalib::copy(old_config_subdir + "/" + config_file, new_config_subdir + "/" + config_file, false, false); diff --git a/searchcore/src/tests/proton/documentdb/feedhandler/feedhandler_test.cpp b/searchcore/src/tests/proton/documentdb/feedhandler/feedhandler_test.cpp index 8ef2742b6d8..f9518cb1b5e 100644 --- a/searchcore/src/tests/proton/documentdb/feedhandler/feedhandler_test.cpp +++ b/searchcore/src/tests/proton/documentdb/feedhandler/feedhandler_test.cpp @@ -35,7 +35,7 @@ #include #include #include -#include +#include #include LOG_SETUP("feedhandler_test"); @@ -784,5 +784,5 @@ TEST_MAIN() { DummyFileHeaderContext::setCreator("feedhandler_test"); TEST_RUN_ALL(); - vespalib::rmdir("mytlsdir", true); + std::filesystem::remove_all(std::filesystem::path("mytlsdir")); } -- cgit v1.2.3