test: fix resolve-flag test
Due to two commits getting merged in close proximity, a variable
for the path to write error logs no longer exists and one test case
was broken in compile. Fix that per the second commit approach.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: I567462193ecc729e932da107d8e4932b7c6f5b49
diff --git a/test/elog_update_ts_test.cpp b/test/elog_update_ts_test.cpp
index e8ddc09..cabcb60 100644
--- a/test/elog_update_ts_test.cpp
+++ b/test/elog_update_ts_test.cpp
@@ -102,12 +102,15 @@
TEST(TestResolveProhibited, testResolveFlagChange)
{
- // Setting resolved will serialize, so need this directory.
- fs::create_directory(ERRLOG_PERSIST_PATH);
+ auto persist_path = phosphor::logging::paths::error();
- if (!fs::exists(ERRLOG_PERSIST_PATH))
+ // Setting resolved will serialize, so need this directory.
+ fs::create_directories(persist_path);
+
+ if (!fs::exists(persist_path))
{
- ADD_FAILURE() << "Could not create " << ERRLOG_PERSIST_PATH << "\n";
+ ADD_FAILURE() << "Could not create "
+ << phosphor::logging::paths::error() << "\n";
exit(1);
}
@@ -119,7 +122,7 @@
std::srand(std::time(nullptr));
uint32_t id = std::rand();
- if (fs::exists(fs::path{ERRLOG_PERSIST_PATH} / std::to_string(id)))
+ if (fs::exists(persist_path / std::to_string(id)))
{
std::cerr << "Another testcase is using ID " << id << "\n";
id = std::rand();
@@ -157,7 +160,7 @@
EXPECT_EQ(elog.resolved(), true);
// Leave the directory in case other CI instances are running
- fs::remove(fs::path{ERRLOG_PERSIST_PATH} / std::to_string(id));
+ fs::remove(persist_path / std::to_string(id));
}
} // namespace test
} // namespace logging