aboutsummaryrefslogtreecommitdiffstats
path: root/searchcore/src/tests/proton/attribute
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2023-07-23 10:53:10 +0000
committerHenning Baldersheim <balder@yahoo-inc.com>2023-07-25 07:57:52 +0000
commit59192dd1d07356497ea311b7f0d6a3b50f726f13 (patch)
tree5f9492d5ce9dd1e4b0125f7d6318127c30a964d6 /searchcore/src/tests/proton/attribute
parent78a211072a21ec5f368b99bce19c1b703d98152d (diff)
Prefer std::filesystem::exists over FastOS_StatInfo
Diffstat (limited to 'searchcore/src/tests/proton/attribute')
-rw-r--r--searchcore/src/tests/proton/attribute/attribute_manager/attribute_manager_test.cpp12
-rw-r--r--searchcore/src/tests/proton/attribute/attributeflush_test.cpp15
2 files changed, 14 insertions, 13 deletions
diff --git a/searchcore/src/tests/proton/attribute/attribute_manager/attribute_manager_test.cpp b/searchcore/src/tests/proton/attribute/attribute_manager/attribute_manager_test.cpp
index 140012624c2..2bf7aa85a0c 100644
--- a/searchcore/src/tests/proton/attribute/attribute_manager/attribute_manager_test.cpp
+++ b/searchcore/src/tests/proton/attribute/attribute_manager/attribute_manager_test.cpp
@@ -39,7 +39,6 @@
#include <vespa/vespalib/util/size_literals.h>
#include <vespa/vespalib/util/threadstackexecutor.h>
#include <vespa/config-attributes.h>
-#include <vespa/fastos/file.h>
#include <vespa/log/log.h>
LOG_SETUP("attribute_manager_test");
@@ -77,6 +76,8 @@ using AVConfig = search::attribute::Config;
using AttrSpecList = proton::AttributeCollectionSpec::AttributeList;
using AttrMgrSpec = proton::AttributeCollectionSpec;
+namespace fs = std::filesystem;
+
namespace {
const uint64_t createSerialNum = 42u;
@@ -567,10 +568,9 @@ TEST_F("require that removed fields can be pruned", Fixture)
SequentialAttributeManager sam(f._m, AttrMgrSpec(std::move(newSpec), 1, 11));
sam.mgr.pruneRemovedFields(11);
- FastOS_StatInfo si;
- EXPECT_TRUE(!FastOS_File::Stat(vespalib::string(test_dir + "/a1").c_str(), &si));
- EXPECT_TRUE(FastOS_File::Stat(vespalib::string(test_dir + "/a2").c_str(), &si));
- EXPECT_TRUE(!FastOS_File::Stat(vespalib::string(test_dir + "/a3").c_str(), &si));
+ EXPECT_FALSE(fs::exists(fs::path(test_dir + "/a1")));
+ EXPECT_TRUE(fs::exists(fs::path(test_dir + "/a2")));
+ EXPECT_FALSE(fs::exists(fs::path(test_dir + "/a3")));
}
TEST_F("require that lid space can be compacted", Fixture)
@@ -905,6 +905,6 @@ TEST_F("late create serial number is set on new attributes", Fixture)
TEST_MAIN()
{
- std::filesystem::remove_all(std::filesystem::path(test_dir));
+ fs::remove_all(fs::path(test_dir));
TEST_RUN_ALL();
}
diff --git a/searchcore/src/tests/proton/attribute/attributeflush_test.cpp b/searchcore/src/tests/proton/attribute/attributeflush_test.cpp
index dfcc8d1f08b..6b2c7a9e705 100644
--- a/searchcore/src/tests/proton/attribute/attributeflush_test.cpp
+++ b/searchcore/src/tests/proton/attribute/attributeflush_test.cpp
@@ -43,6 +43,8 @@ using namespace std::literals;
using GateSP = std::shared_ptr<Gate>;
+namespace fs = std::filesystem;
+
namespace proton {
namespace {
@@ -436,9 +438,9 @@ Test::requireThatCleanUpIsPerformedAfterFlush()
std::string base = "flush/a6";
std::string snap10 = "flush/a6/snapshot-10";
std::string snap20 = "flush/a6/snapshot-20";
- std::filesystem::create_directory(std::filesystem::path(base));
- std::filesystem::create_directory(std::filesystem::path(snap10));
- std::filesystem::create_directory(std::filesystem::path(snap20));
+ fs::create_directory(fs::path(base));
+ fs::create_directory(fs::path(snap10));
+ fs::create_directory(fs::path(snap20));
IndexMetaInfo info("flush/a6");
info.addSnapshot(IndexMetaInfo::Snapshot(true, 10, "snapshot-10"));
info.addSnapshot(IndexMetaInfo::Snapshot(false, 20, "snapshot-20"));
@@ -454,9 +456,8 @@ Test::requireThatCleanUpIsPerformedAfterFlush()
EXPECT_EQUAL(1u, info.snapshots().size()); // snapshots 10 & 20 removed
EXPECT_TRUE(info.snapshots()[0].valid);
EXPECT_EQUAL(30u, info.snapshots()[0].syncToken);
- FastOS_StatInfo statInfo;
- EXPECT_TRUE(!FastOS_File::Stat(snap10.c_str(), &statInfo));
- EXPECT_TRUE(!FastOS_File::Stat(snap20.c_str(), &statInfo));
+ EXPECT_FALSE(fs::exists(fs::path(snap10)));
+ EXPECT_FALSE(fs::exists(fs::path(snap20)));
}
@@ -662,7 +663,7 @@ Test::Main()
if (_argc > 0) {
DummyFileHeaderContext::setCreator(_argv[0]);
}
- std::filesystem::remove_all(std::filesystem::path(test_dir));
+ fs::remove_all(fs::path(test_dir));
TEST_DO(requireThatUpdaterAndFlusherCanRunConcurrently());
TEST_DO(requireThatFlushableAttributeReportsMemoryUsage());
TEST_DO(requireThatFlushableAttributeManagesSyncTokenInfo());