PEL: Pass in subsystem to use with additional data
There is a requirement to pass in the subsystem to use with
the additional data field. In the process update the user
header code and SRC with the passed-in subsystem value
instead from the message registry.
Signed-off-by: Sumit Kumar <sumit_kumar@in.ibm.com>
Change-Id: I08c8c3bab100fec581df9043f4bb27b28cb556e1
diff --git a/test/openpower-pels/src_test.cpp b/test/openpower-pels/src_test.cpp
index 11b15d4..97d9b27 100644
--- a/test/openpower-pels/src_test.cpp
+++ b/test/openpower-pels/src_test.cpp
@@ -1446,3 +1446,31 @@
EXPECT_EQ(0x00080655, hexwords[0]);
}
}
+
+// Test SRC with additional data - PEL_SUBSYSTEM
+TEST_F(SRCTest, TestPELSubsystem)
+{
+ message::Entry entry;
+ entry.src.type = 0xBD;
+ entry.src.reasonCode = 0xABCD;
+ entry.subsystem = 0x42;
+ entry.src.powerFault = true;
+
+ // Values for the SRC words pointed to above
+ std::vector<std::string> adData{"PEL_SUBSYSTEM=0x20"};
+ AdditionalData ad{adData};
+ NiceMock<MockDataInterface> dataIface;
+
+ EXPECT_CALL(dataIface, getMotherboardCCIN).WillOnce(Return("ABCD"));
+
+ std::vector<std::string> dumpType{"bmc/entry", "resource/entry",
+ "system/entry"};
+ EXPECT_CALL(dataIface, checkDumpStatus(dumpType))
+ .WillOnce(Return(std::vector<bool>{false, false, false}));
+
+ SRC src{entry, ad, dataIface};
+
+ EXPECT_TRUE(src.valid());
+
+ EXPECT_EQ(src.asciiString(), "BD20ABCD ");
+}