PEL: Create class to read from the journal
Create a Journal class that can extract messages out of the journal and
return them as a vector of strings that look like:
"Dec 14 15:58:17 systemd[1]: systemd-tmpfiles-clean.service: Deactivated
successfully."
It can either grab the previous N entries, or the previous N entries
that match a specific SYSLOG_IDENTIFIER value.
The class follows the same strategy as the DataInterface class where a
base class pointer is passed into the PEL Manager class so that during
unit test it can be mocked.
Future commits will capture the journal into PEL UserData sections.
Signed-off-by: Matt Spinler <spinler@us.ibm.com>
Change-Id: I9f4bb304c4b213165049fa00de2e62f962ae67f1
diff --git a/test/openpower-pels/mocks.hpp b/test/openpower-pels/mocks.hpp
index de7f757..7a1ee35 100644
--- a/test/openpower-pels/mocks.hpp
+++ b/test/openpower-pels/mocks.hpp
@@ -1,5 +1,6 @@
#include "extensions/openpower-pels/data_interface.hpp"
#include "extensions/openpower-pels/host_interface.hpp"
+#include "extensions/openpower-pels/journal.hpp"
#include <fcntl.h>
@@ -278,5 +279,14 @@
size_t _cmdsProcessed = 0;
};
+class MockJournal : public JournalBase
+{
+ public:
+ MockJournal() {}
+
+ MOCK_METHOD(std::vector<std::string>, getMessages,
+ (const std::string&, size_t), (const override));
+};
+
} // namespace pels
} // namespace openpower