summaryrefslogtreecommitdiffstats
path: root/searchcore/src/tests/proton/index
diff options
context:
space:
mode:
authorTor Egge <Tor.Egge@online.no>2022-06-23 21:39:48 +0200
committerTor Egge <Tor.Egge@online.no>2022-06-23 21:39:48 +0200
commit09d546dfdd152ce4e69971fc8ce422d998cb523a (patch)
tree18da6c3d44a2a056fcc41a213f47feec26f2e30b /searchcore/src/tests/proton/index
parent316b44c13d886ef9ff50b040f4a01f38dfd3f94c (diff)
Use std::filesystem to create and remove directories.
Diffstat (limited to 'searchcore/src/tests/proton/index')
-rw-r--r--searchcore/src/tests/proton/index/diskindexcleaner_test.cpp7
-rw-r--r--searchcore/src/tests/proton/index/fusionrunner_test.cpp7
-rw-r--r--searchcore/src/tests/proton/index/indexmanager_test.cpp2
3 files changed, 9 insertions, 7 deletions
diff --git a/searchcore/src/tests/proton/index/diskindexcleaner_test.cpp b/searchcore/src/tests/proton/index/diskindexcleaner_test.cpp
index c814bdf3f37..35583ea46da 100644
--- a/searchcore/src/tests/proton/index/diskindexcleaner_test.cpp
+++ b/searchcore/src/tests/proton/index/diskindexcleaner_test.cpp
@@ -6,6 +6,7 @@
#include <vespa/vespalib/testkit/testapp.h>
#include <vespa/fastos/file.h>
#include <algorithm>
+#include <filesystem>
#include <vespa/log/log.h>
LOG_SETUP("diskindexcleaner_test");
@@ -30,7 +31,7 @@ public:
const string index_dir = "diskindexcleaner_test_data";
void removeTestData() {
- FastOS_FileInterface::EmptyAndRemoveDirectory(index_dir.c_str());
+ std::filesystem::remove_all(std::filesystem::path(index_dir));
}
int
@@ -52,9 +53,9 @@ Test::Main()
}
void createIndex(const string &name) {
- FastOS_FileInterface::MakeDirIfNotPresentOrExit(index_dir.c_str());
+ std::filesystem::create_directory(std::filesystem::path(index_dir));
const string dir_name = index_dir + "/" + name;
- FastOS_FileInterface::MakeDirIfNotPresentOrExit(dir_name.c_str());
+ std::filesystem::create_directory(std::filesystem::path(dir_name));
const string serial_file = dir_name + "/serial.dat";
FastOS_File file(serial_file.c_str());
file.OpenWriteOnlyTruncate();
diff --git a/searchcore/src/tests/proton/index/fusionrunner_test.cpp b/searchcore/src/tests/proton/index/fusionrunner_test.cpp
index 4a84e3972ad..850f8a8f0d1 100644
--- a/searchcore/src/tests/proton/index/fusionrunner_test.cpp
+++ b/searchcore/src/tests/proton/index/fusionrunner_test.cpp
@@ -20,6 +20,7 @@
#include <vespa/vespalib/util/size_literals.h>
#include <vespa/vespalib/stllike/asciistream.h>
#include <vespa/fastos/file.h>
+#include <filesystem>
#include <set>
using document::Document;
@@ -134,7 +135,7 @@ Schema getSchema() {
}
void Test::setUp() {
- FastOS_FileInterface::EmptyAndRemoveDirectory(base_dir.c_str());
+ std::filesystem::remove_all(std::filesystem::path(base_dir));
_fusion_runner.reset(new FusionRunner(base_dir, getSchema(),
TuneFileAttributes(),
_fileHeaderContext));
@@ -144,7 +145,7 @@ void Test::setUp() {
}
void Test::tearDown() {
- FastOS_FileInterface::EmptyAndRemoveDirectory(base_dir.c_str());
+ std::filesystem::remove_all(std::filesystem::path(base_dir));
_selector.reset(0);
}
@@ -167,7 +168,7 @@ void addDocument(DocBuilder & doc_builder, MemoryIndex &index, ISourceSelector &
}
void Test::createIndex(const string &dir, uint32_t id, bool fusion) {
- FastOS_FileInterface::MakeDirIfNotPresentOrExit(dir.c_str());
+ std::filesystem::create_directory(std::filesystem::path(dir));
vespalib::asciistream ost;
if (fusion) {
ost << dir << "/index.fusion." << id;
diff --git a/searchcore/src/tests/proton/index/indexmanager_test.cpp b/searchcore/src/tests/proton/index/indexmanager_test.cpp
index 0bc11e64df8..b427daa4ad1 100644
--- a/searchcore/src/tests/proton/index/indexmanager_test.cpp
+++ b/searchcore/src/tests/proton/index/indexmanager_test.cpp
@@ -85,7 +85,7 @@ Schema getSchema() {
}
void removeTestData() {
- FastOS_FileInterface::EmptyAndRemoveDirectory(index_dir.c_str());
+ std::filesystem::remove_all(std::filesystem::path(index_dir));
}
Document::UP buildDocument(DocBuilder &doc_builder, int id,