Skip to content

Commit 730c40f

Browse files
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 <[email protected]> Change-Id: I567462193ecc729e932da107d8e4932b7c6f5b49
1 parent 597f24a commit 730c40f

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

test/elog_update_ts_test.cpp

+8-5
Original file line numberDiff line numberDiff line change
@@ -102,12 +102,15 @@ TEST(TestUpdateTS, testChangeResolved)
102102

103103
TEST(TestResolveProhibited, testResolveFlagChange)
104104
{
105+
auto persist_path = phosphor::logging::paths::error();
106+
105107
// Setting resolved will serialize, so need this directory.
106-
fs::create_directory(ERRLOG_PERSIST_PATH);
108+
fs::create_directories(persist_path);
107109

108-
if (!fs::exists(ERRLOG_PERSIST_PATH))
110+
if (!fs::exists(persist_path))
109111
{
110-
ADD_FAILURE() << "Could not create " << ERRLOG_PERSIST_PATH << "\n";
112+
ADD_FAILURE() << "Could not create "
113+
<< phosphor::logging::paths::error() << "\n";
111114
exit(1);
112115
}
113116

@@ -119,7 +122,7 @@ TEST(TestResolveProhibited, testResolveFlagChange)
119122
std::srand(std::time(nullptr));
120123
uint32_t id = std::rand();
121124

122-
if (fs::exists(fs::path{ERRLOG_PERSIST_PATH} / std::to_string(id)))
125+
if (fs::exists(persist_path / std::to_string(id)))
123126
{
124127
std::cerr << "Another testcase is using ID " << id << "\n";
125128
id = std::rand();
@@ -157,7 +160,7 @@ TEST(TestResolveProhibited, testResolveFlagChange)
157160
EXPECT_EQ(elog.resolved(), true);
158161

159162
// Leave the directory in case other CI instances are running
160-
fs::remove(fs::path{ERRLOG_PERSIST_PATH} / std::to_string(id));
163+
fs::remove(persist_path / std::to_string(id));
161164
}
162165
} // namespace test
163166
} // namespace logging

0 commit comments

Comments
 (0)