summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorMatt Spinler <spinler@us.ibm.com>2019-09-20 15:11:04 -0500
committerMatt Spinler <spinler@us.ibm.com>2019-10-09 13:11:51 +0000
commitb832363d4314f7d93d09a626e9b987c287e774df (patch)
tree21d40a3fdce2adfaa3f0bb5e9acc5be75f05ed6c /test
parentfdb6a202fbd42124d1e6cdaf220e87a623894534 (diff)
downloadphosphor-logging-b832363d4314f7d93d09a626e9b987c287e774df.tar.gz
phosphor-logging-b832363d4314f7d93d09a626e9b987c287e774df.zip
PEL: Create PEL from parameters
Add a constructor to the PEL class so it can be built from the message registry entry for that error along with the event log properties. When support for new sections are added, they will be created here as well along with the PrivateHeader and UserHeader section classes. Eventually, this constructor will be called from the Manager class after it is told a new event log has been created and after it looks up that error's PEL message registry entry. Signed-off-by: Matt Spinler <spinler@us.ibm.com> Change-Id: I2d8ca550736aab45a30ac3db9861723b33e6cd32
Diffstat (limited to 'test')
-rw-r--r--test/openpower-pels/pel_test.cpp23
1 files changed, 19 insertions, 4 deletions
diff --git a/test/openpower-pels/pel_test.cpp b/test/openpower-pels/pel_test.cpp
index ba71dc2..6d888b7 100644
--- a/test/openpower-pels/pel_test.cpp
+++ b/test/openpower-pels/pel_test.cpp
@@ -1,3 +1,4 @@
+#include "elog_entry.hpp"
#include "extensions/openpower-pels/pel.hpp"
#include "pel_utils.hpp"
@@ -86,10 +87,6 @@ TEST_F(PELTest, InvalidPELTest)
EXPECT_FALSE(pel->userHeader()->valid());
EXPECT_FALSE(pel->valid());
- // Ensure we can still flatten bad data
- auto newData = pel->data();
- EXPECT_EQ(*data, newData);
-
// Now corrupt the private header
data = pelDataFactory(TestPelType::pelSimple);
data->at(0) = 0;
@@ -109,3 +106,21 @@ TEST_F(PELTest, EmptyDataTest)
EXPECT_FALSE(pel->userHeader()->valid());
EXPECT_FALSE(pel->valid());
}
+
+TEST_F(PELTest, CreateFromRegistryTest)
+{
+ message::Entry regEntry;
+ uint64_t timestamp = 5;
+
+ regEntry.name = "test";
+ regEntry.subsystem = 5;
+ regEntry.actionFlags = 0xC000;
+
+ PEL pel{regEntry, 42, timestamp, phosphor::logging::Entry::Level::Error};
+
+ EXPECT_TRUE(pel.valid());
+ EXPECT_EQ(pel.privateHeader()->obmcLogID(), 42);
+ EXPECT_EQ(pel.userHeader()->severity(), 0x40);
+
+ // Add more checks as more sections are added
+}
OpenPOWER on IntegriCloud