summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--logd/src/tests/watcher/watcher_test.cpp11
-rw-r--r--storage/src/tests/common/metricstest.cpp4
-rw-r--r--storage/src/tests/persistence/persistencetestutils.cpp6
-rw-r--r--storage/src/tests/visiting/visitortest.cpp8
-rw-r--r--storage/src/vespa/storage/storageserver/storagenode.cpp6
-rw-r--r--vdstestlib/src/vespa/vdstestlib/config/dirconfig.cpp4
6 files changed, 20 insertions, 19 deletions
diff --git a/logd/src/tests/watcher/watcher_test.cpp b/logd/src/tests/watcher/watcher_test.cpp
index 50c8f47a203..b9199315c76 100644
--- a/logd/src/tests/watcher/watcher_test.cpp
+++ b/logd/src/tests/watcher/watcher_test.cpp
@@ -8,6 +8,7 @@
#include <vespa/vespalib/util/threadstackexecutor.h>
#include <vespa/vespalib/util/lambdatask.h>
#include <vespa/vespalib/util/size_literals.h>
+#include <filesystem>
#include <fstream>
#include <regex>
#include <thread>
@@ -132,7 +133,7 @@ WatcherTest::WatcherTest()
{
remove_files();
setenv("VESPA_LOG_TARGET", "file:vespa.log", true);
- vespalib::mkdir("var/db/vespa", true); // for logd.donestate
+ std::filesystem::create_directories(std::filesystem::path("var/db/vespa")); // for logd.donestate
_cfg = std::make_unique<ConfigFixture>("testconfigid");
}
@@ -177,9 +178,9 @@ WatcherTest::assert_lines(const std::vector<std::string> &lines)
void
WatcherTest::remove_files()
{
- vespalib::rmdir("var", true);
+ std::filesystem::remove_all(std::filesystem::path("var"));
remove_rotated();
- vespalib::unlink("vespa.log");
+ std::filesystem::remove(std::filesystem::path("vespa.log"));
}
void
@@ -188,7 +189,7 @@ WatcherTest::remove_rotated()
auto dirlist = vespalib::listDirectory(".");
for (const auto &entry : dirlist) {
if (std::regex_match(entry.data(), entry.data() + entry.size(), rotated_log)) {
- vespalib::unlink(entry);
+ std::filesystem::remove(std::filesystem::path(entry));
}
}
}
@@ -242,7 +243,7 @@ TEST_F(WatcherTest, require_that_watching_can_resume)
stop_watcher();
assert_lines({"bar", "baz"});
// remove state file. Old entry will resurface
- vespalib::unlink("var/db/vespa/logd.donestate");
+ std::filesystem::remove(std::filesystem::path("var/db/vespa/logd.donestate"));
setup_watcher();
run_watcher();
_watcher->fwd.waitLineCount(3);
diff --git a/storage/src/tests/common/metricstest.cpp b/storage/src/tests/common/metricstest.cpp
index d2a4f994bda..cff62542434 100644
--- a/storage/src/tests/common/metricstest.cpp
+++ b/storage/src/tests/common/metricstest.cpp
@@ -13,9 +13,9 @@
#include <vespa/metrics/metricmanager.h>
#include <vespa/config/common/exceptions.h>
#include <vespa/vespalib/stllike/hash_map.hpp>
-#include <vespa/vespalib/io/fileutil.h>
#include <vespa/vespalib/gtest/gtest.h>
#include <gmock/gmock.h>
+#include <filesystem>
#include <thread>
#include <vespa/log/log.h>
@@ -71,7 +71,7 @@ MetricsTest::~MetricsTest() = default;
void MetricsTest::SetUp() {
_config = std::make_unique<vdstestlib::DirConfig>(getStandardConfig(true, "metricstest"));
- vespalib::rmdir(getRootFolder(*_config), true);
+ std::filesystem::remove_all(std::filesystem::path(getRootFolder(*_config)));
try {
_node = std::make_unique<TestServiceLayerApp>(NodeIndex(0), _config->getConfigId());
_node->setupDummyPersistence();
diff --git a/storage/src/tests/persistence/persistencetestutils.cpp b/storage/src/tests/persistence/persistencetestutils.cpp
index b069ac078ef..940436307a1 100644
--- a/storage/src/tests/persistence/persistencetestutils.cpp
+++ b/storage/src/tests/persistence/persistencetestutils.cpp
@@ -11,11 +11,11 @@
#include <vespa/persistence/spi/test.h>
#include <vespa/storage/persistence/filestorage/filestorhandlerimpl.h>
#include <vespa/storage/persistence/persistencehandler.h>
-#include <vespa/vespalib/io/fileutil.h>
#include <vespa/vespalib/objects/nbostream.h>
#include <vespa/vespalib/util/exceptions.h>
#include <vespa/vespalib/util/sequencedtaskexecutor.h>
#include <vespa/config-stor-filestor.h>
+#include <filesystem>
#include <thread>
using document::DocumentType;
@@ -29,8 +29,8 @@ namespace {
vdstestlib::DirConfig initialize(const std::string & rootOfRoot) {
vdstestlib::DirConfig config(getStandardConfig(true, rootOfRoot));
std::string rootFolder = getRootFolder(config);
- vespalib::rmdir(rootFolder, true);
- vespalib::mkdir(vespalib::make_string("%s/disks/d0", rootFolder.c_str()), true);
+ std::filesystem::remove_all(std::filesystem::path(rootFolder));
+ std::filesystem::create_directories(std::filesystem::path(vespalib::make_string("%s/disks/d0", rootFolder.c_str())));
return config;
}
diff --git a/storage/src/tests/visiting/visitortest.cpp b/storage/src/tests/visiting/visitortest.cpp
index 4de7df7b366..7dc34bb4b6f 100644
--- a/storage/src/tests/visiting/visitortest.cpp
+++ b/storage/src/tests/visiting/visitortest.cpp
@@ -18,8 +18,8 @@
#include <tests/common/dummystoragelink.h>
#include <tests/storageserver/testvisitormessagesession.h>
#include <vespa/persistence/spi/docentry.h>
-#include <vespa/vespalib/io/fileutil.h>
#include <vespa/vespalib/gtest/gtest.h>
+#include <filesystem>
#include <thread>
#include <sys/stat.h>
@@ -153,9 +153,9 @@ VisitorTest::initializeTest(const TestParams& params)
std::string rootFolder = getRootFolder(config);
::chmod(rootFolder.c_str(), 0755);
- vespalib::rmdir(rootFolder, true);
- vespalib::mkdir(vespalib::make_string("%s/disks/d0", rootFolder.c_str()), true);
- vespalib::mkdir(vespalib::make_string("%s/disks/d1", rootFolder.c_str()), true);
+ std::filesystem::remove_all(std::filesystem::path(rootFolder));
+ std::filesystem::create_directories(std::filesystem::path(vespalib::make_string("%s/disks/d0", rootFolder.c_str())));
+ std::filesystem::create_directories(std::filesystem::path(vespalib::make_string("%s/disks/d1", rootFolder.c_str())));
_messageSessionFactory.reset(
new TestVisitorMessageSessionFactory(config.getConfigId()));
diff --git a/storage/src/vespa/storage/storageserver/storagenode.cpp b/storage/src/vespa/storage/storageserver/storagenode.cpp
index a4701d9f396..cc433ea4ee5 100644
--- a/storage/src/vespa/storage/storageserver/storagenode.cpp
+++ b/storage/src/vespa/storage/storageserver/storagenode.cpp
@@ -16,10 +16,10 @@
#include <vespa/storage/frameworkimpl/thread/deadlockdetector.h>
#include <vespa/config/helper/configfetcher.hpp>
#include <vespa/vdslib/distribution/distribution.h>
-#include <vespa/vespalib/io/fileutil.h>
#include <vespa/vespalib/util/exceptions.h>
#include <vespa/vespalib/util/time.h>
#include <fcntl.h>
+#include <filesystem>
#include <vespa/log/log.h>
@@ -41,7 +41,7 @@ namespace {
vespalib::string mypid = vespalib::make_string("%d\n", getpid());
size_t lastSlash = pidfile.rfind('/');
if (lastSlash != vespalib::string::npos) {
- vespalib::mkdir(pidfile.substr(0, lastSlash));
+ std::filesystem::create_directories(std::filesystem::path(pidfile.substr(0, lastSlash)));
}
int fd = open(pidfile.c_str(), O_WRONLY | O_CREAT | O_TRUNC, 0644);
if (fd != -1) {
@@ -172,7 +172,7 @@ StorageNode::initialize()
// Create VDS root folder, in case it doesn't already exist.
// Maybe better to rather fail if it doesn't exist, but tests
// might break if we do that. Might alter later.
- vespalib::mkdir(_rootFolder);
+ std::filesystem::create_directories(std::filesystem::path(_rootFolder));
initializeNodeSpecific();
diff --git a/vdstestlib/src/vespa/vdstestlib/config/dirconfig.cpp b/vdstestlib/src/vespa/vdstestlib/config/dirconfig.cpp
index 9276f0d7c41..daab92b3a59 100644
--- a/vdstestlib/src/vespa/vdstestlib/config/dirconfig.cpp
+++ b/vdstestlib/src/vespa/vdstestlib/config/dirconfig.cpp
@@ -2,9 +2,9 @@
#include "dirconfig.hpp"
-#include <vespa/vespalib/io/fileutil.h>
#include <vespa/vespalib/util/exceptions.h>
#include <vespa/vespalib/util/stringfmt.h>
+#include <filesystem>
#include <fstream>
#include <atomic>
#include <cassert>
@@ -115,7 +115,7 @@ DirConfig::DirConfig()
: _configs(),
_dirName(_G_root.nextDir())
{
- vespalib::mkdir(_dirName, true);
+ std::filesystem::create_directories(std::filesystem::path(_dirName));
}
DirConfig::~DirConfig() {}