regulators: Add phase faults to ErrorHistory
Add the new N and N+1 phase fault errors to the ErrorHistory class.
Update the gtests to test for the new phase fault error types.
Signed-off-by: Shawn McCarney <shawnmm@us.ibm.com>
Change-Id: Ief9482219cfa8940f26a752dce9965b6c0c257e7
diff --git a/phosphor-regulators/src/error_history.hpp b/phosphor-regulators/src/error_history.hpp
index 8a2a011..f5afdae30 100644
--- a/phosphor-regulators/src/error_history.hpp
+++ b/phosphor-regulators/src/error_history.hpp
@@ -36,7 +36,9 @@
internal = 3,
pmbus = 4,
writeVerification = 5,
- numTypes = 6
+ phaseFaultN = 6,
+ phaseFaultNPlus1 = 7,
+ numTypes = 8
};
/**
diff --git a/phosphor-regulators/test/error_history_tests.cpp b/phosphor-regulators/test/error_history_tests.cpp
index 55f77f5..187c36e 100644
--- a/phosphor-regulators/test/error_history_tests.cpp
+++ b/phosphor-regulators/test/error_history_tests.cpp
@@ -22,7 +22,7 @@
TEST(ErrorHistoryTests, ErrorType)
{
EXPECT_EQ(static_cast<int>(ErrorType::internal), 3);
- EXPECT_EQ(static_cast<int>(ErrorType::numTypes), 6);
+ EXPECT_EQ(static_cast<int>(ErrorType::numTypes), 8);
}
TEST(ErrorHistoryTests, Constructor)
@@ -34,6 +34,8 @@
EXPECT_FALSE(history.wasLogged(ErrorType::internal));
EXPECT_FALSE(history.wasLogged(ErrorType::pmbus));
EXPECT_FALSE(history.wasLogged(ErrorType::writeVerification));
+ EXPECT_FALSE(history.wasLogged(ErrorType::phaseFaultN));
+ EXPECT_FALSE(history.wasLogged(ErrorType::phaseFaultNPlus1));
}
TEST(ErrorHistoryTests, Clear)
@@ -46,6 +48,8 @@
history.setWasLogged(ErrorType::internal, true);
history.setWasLogged(ErrorType::pmbus, true);
history.setWasLogged(ErrorType::writeVerification, true);
+ history.setWasLogged(ErrorType::phaseFaultN, true);
+ history.setWasLogged(ErrorType::phaseFaultNPlus1, true);
EXPECT_TRUE(history.wasLogged(ErrorType::configFile));
EXPECT_TRUE(history.wasLogged(ErrorType::dbus));
@@ -53,6 +57,8 @@
EXPECT_TRUE(history.wasLogged(ErrorType::internal));
EXPECT_TRUE(history.wasLogged(ErrorType::pmbus));
EXPECT_TRUE(history.wasLogged(ErrorType::writeVerification));
+ EXPECT_TRUE(history.wasLogged(ErrorType::phaseFaultN));
+ EXPECT_TRUE(history.wasLogged(ErrorType::phaseFaultNPlus1));
history.clear();
@@ -62,6 +68,8 @@
EXPECT_FALSE(history.wasLogged(ErrorType::internal));
EXPECT_FALSE(history.wasLogged(ErrorType::pmbus));
EXPECT_FALSE(history.wasLogged(ErrorType::writeVerification));
+ EXPECT_FALSE(history.wasLogged(ErrorType::phaseFaultN));
+ EXPECT_FALSE(history.wasLogged(ErrorType::phaseFaultNPlus1));
}
TEST(ErrorHistoryTests, SetWasLogged)