PEL: Add BMC uptime to PELs in UserData section
A UserData section has been added to each PEL with additional debug
information, now there is a need to add the output of the uptime
command to UserData and display it, but for Hostboot doesn't care
about this property, so skip adding it here it.
Tested: unit test passed
"User Data 0": {
"Section Version": "1",
"Sub-section type": "1",
"Created by": "0x2000",
...
"Uptime": "3y 332d 21h 33m 9s",
"Load": "1.47 0.94 0.61",
},
Signed-off-by: George Liu <liuxiwei@inspur.com>
Change-Id: I3d4c78bb1650da9a91804fc83de60597992ffc8a
diff --git a/test/openpower-pels/data_interface_test.cpp b/test/openpower-pels/data_interface_test.cpp
index 28e455f..3041bc2 100644
--- a/test/openpower-pels/data_interface_test.cpp
+++ b/test/openpower-pels/data_interface_test.cpp
@@ -22,3 +22,15 @@
EXPECT_TRUE(connector.empty());
}
}
+
+TEST(DataInterfaceTest, ExtractUptime)
+{
+ uint64_t seconds = 123456789;
+ std::string retUptime = "3y 332d 21h 33m 9s";
+
+ auto bus = sdbusplus::bus::new_default();
+ DataInterface dataIntf(bus);
+ std::string uptime = dataIntf.getBMCUptime(seconds);
+
+ EXPECT_EQ(uptime, retUptime);
+}
\ No newline at end of file