summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorMatt Spinler <spinler@us.ibm.com>2020-01-23 10:04:29 -0600
committerMatt Spinler <spinler@us.ibm.com>2020-01-31 15:00:11 +0000
commit677381b8fc84d49923cf49ab9e2fe6f520f19767 (patch)
treedda76bf4ed287b68e79a5507e15d221c04625999 /test
parent4dcd3f46599a8c702fca4b13e4370a0ec7f66ffd (diff)
downloadphosphor-logging-677381b8fc84d49923cf49ab9e2fe6f520f19767.tar.gz
phosphor-logging-677381b8fc84d49923cf49ab9e2fe6f520f19767.zip
PEL: Save BMC Version ID in UserData section
When creating a PEL, save the VERSION_ID value from the /etc/os-release file in the UserData section that keeps useful system information. Signed-off-by: Matt Spinler <spinler@us.ibm.com> Change-Id: I6d9008b15c5347239bf8c21ef79219d3b6ee08e6
Diffstat (limited to 'test')
-rw-r--r--test/openpower-pels/mocks.hpp1
-rw-r--r--test/openpower-pels/pel_test.cpp8
2 files changed, 8 insertions, 1 deletions
diff --git a/test/openpower-pels/mocks.hpp b/test/openpower-pels/mocks.hpp
index 5bec579..e00e006 100644
--- a/test/openpower-pels/mocks.hpp
+++ b/test/openpower-pels/mocks.hpp
@@ -23,6 +23,7 @@ class MockDataInterface : public DataInterfaceBase
MOCK_METHOD(std::string, getMachineSerialNumber, (), (const override));
MOCK_METHOD(std::string, getServerFWVersion, (), (const override));
MOCK_METHOD(std::string, getBMCFWVersion, (), (const override));
+ MOCK_METHOD(std::string, getBMCFWVersionID, (), (const override));
void changeHostState(bool newState)
{
diff --git a/test/openpower-pels/pel_test.cpp b/test/openpower-pels/pel_test.cpp
index 1a5f81f..32f8d5e 100644
--- a/test/openpower-pels/pel_test.cpp
+++ b/test/openpower-pels/pel_test.cpp
@@ -26,6 +26,7 @@
namespace fs = std::filesystem;
using namespace openpower::pels;
+using ::testing::Return;
class PELTest : public CleanLogID
{
@@ -313,10 +314,12 @@ TEST_F(PELTest, MakeUDSectionTest)
}
// Create the UserData section that contains system info
-TEST_F(PELTest, MakeSysInfoSectionTest)
+TEST_F(PELTest, SysInfoSectionTest)
{
MockDataInterface dataIface;
+ EXPECT_CALL(dataIface, getBMCFWVersionID()).WillOnce(Return("ABCD1234"));
+
std::string pid = "_PID=" + std::to_string(getpid());
std::vector<std::string> ad{pid};
AdditionalData additionalData{ad};
@@ -337,4 +340,7 @@ TEST_F(PELTest, MakeSysInfoSectionTest)
// Ensure the 'Process Name' entry contains 'pel_test'
auto name = json["Process Name"].get<std::string>();
EXPECT_NE(name.find("pel_test"), std::string::npos);
+
+ auto version = json["BMC Version ID"].get<std::string>();
+ EXPECT_EQ(version, "ABCD1234");
}
OpenPOWER on IntegriCloud