diff options
author | Matt Spinler <spinler@us.ibm.com> | 2019-08-27 13:56:05 -0500 |
---|---|---|
committer | Matt Spinler <spinler@us.ibm.com> | 2019-10-01 12:52:33 -0500 |
commit | 835a86938f3cf59fbdcd25835b48e6cdb1e6552b (patch) | |
tree | eca6865e34aa490abfe231b72c8b7f2492a88908 /test/openpower-pels | |
parent | 09d6400fb70d5324c0ed026d1084fc51cb495216 (diff) | |
download | phosphor-logging-835a86938f3cf59fbdcd25835b48e6cdb1e6552b.tar.gz phosphor-logging-835a86938f3cf59fbdcd25835b48e6cdb1e6552b.zip |
PEL: Support for going between PELs & registry
Add tables that allow one to go between how a PEL field actually shows
up in the PEL (raw bytes) and how it shows up in the message registry (a
string enumeration). The tables also have a column to show a string
description of that value that can be used by the parser, though for now
those descriptions are all left at "TODO".
There only needs to be a table for a PEL field when there is a
corresponding message registry field that is a string enumeration, so
that when code looks up an error in the message registry it knows what
to fill in the PEL with.
Also provide APIs to look up a row in the table by either the PEL value
or the message registry value.
Signed-off-by: Matt Spinler <spinler@us.ibm.com>
Change-Id: Iac849bcd2b0449a8d03fac7eb067484e91d28259
Diffstat (limited to 'test/openpower-pels')
-rw-r--r-- | test/openpower-pels/Makefile.include | 9 | ||||
-rw-r--r-- | test/openpower-pels/pel_values_test.cpp | 24 |
2 files changed, 33 insertions, 0 deletions
diff --git a/test/openpower-pels/Makefile.include b/test/openpower-pels/Makefile.include index fefbbc6..5705f73 100644 --- a/test/openpower-pels/Makefile.include +++ b/test/openpower-pels/Makefile.include @@ -7,6 +7,7 @@ check_PROGRAMS += \ log_id_test \ mtms_test \ pel_test \ + pel_values_test \ pel_manager_test \ private_header_test \ repository_test \ @@ -123,3 +124,11 @@ failing_mtms_test_LDADD = \ $(top_builddir)/extensions/openpower-pels/failing_mtms.o \ $(top_builddir)/extensions/openpower-pels/mtms.o failing_mtms_test_LDFLAGS = $(test_ldflags) + +pel_values_test_SOURCES = %reldir%/pel_values_test.cpp +pel_values_test_CPPFLAGS = $(test_cppflags) +pel_values_test_CXXFLAGS = $(test_cxxflags) +pel_values_test_LDADD = \ + $(test_ldflags) \ + $(top_builddir)/extensions/openpower-pels/pel_values.o +pel_values_test_LDFLAGS = $(test_ldflags) diff --git a/test/openpower-pels/pel_values_test.cpp b/test/openpower-pels/pel_values_test.cpp new file mode 100644 index 0000000..d44153c --- /dev/null +++ b/test/openpower-pels/pel_values_test.cpp @@ -0,0 +1,24 @@ +#include "extensions/openpower-pels/pel_values.hpp" + +#include <gtest/gtest.h> + +using namespace openpower::pels::pel_values; + +TEST(PELFieldsTest, TestFindFields) +{ + auto s = findByValue(0x5D, subsystemValues); + ASSERT_NE(s, subsystemValues.end()); + ASSERT_EQ(0x5D, std::get<fieldValuePos>(*s)); + ASSERT_EQ("cec_service_network", std::get<registryNamePos>(*s)); + + s = findByName("cec_clocks", subsystemValues); + ASSERT_NE(s, subsystemValues.end()); + ASSERT_EQ(0x58, std::get<fieldValuePos>(*s)); + ASSERT_EQ("cec_clocks", std::get<registryNamePos>(*s)); + + s = findByValue(0xFF, subsystemValues); + ASSERT_EQ(s, subsystemValues.end()); + + s = findByName("foo", subsystemValues); + ASSERT_EQ(s, subsystemValues.end()); +} |