regulators: Implement D-Bus error logging
Implemented the DBusErrorLogging class. This class creates error logs
using the D-Bus CreateWithFFDCFiles method.
Updated the abstract base class, ErrorLogging, to have the correct
virtual method parameters. The methods were previously defined with no
parameters as a temporary measure.
Also updated the MockErrorLogging class to have the correct virtual
method parameters.
Tested:
* Verified that all the log*Error() methods create an error log of the
correct type.
* Verified that created error logs have the expected:
* property/field values
* callouts with associated VPD
* User Data sections containing debug data stored in FFDC files
* Tested where creating an FFDC file fails.
* Tested where calling CreateWithFFDCFiles method fails.
* Tested where removing an FFDC file fails.
* Verified that if a failure occurs, it is written to the system
journal but does not result in a second error log (since that could
lead to an infinite loop).
* Verified that temporary FFDC files are removed even if creating the
error log fails.
Full Test Plan:
* https://gist.github.com/smccarney/60ecbc018c55a5d13661bda8ee256d61
Signed-off-by: Shawn McCarney <shawnmm@us.ibm.com>
Change-Id: I2837fc68dfbad2d89193a147222f1c51d9b1aad3
diff --git a/phosphor-regulators/test/mock_error_logging.hpp b/phosphor-regulators/test/mock_error_logging.hpp
index 697af3e..db75a37 100644
--- a/phosphor-regulators/test/mock_error_logging.hpp
+++ b/phosphor-regulators/test/mock_error_logging.hpp
@@ -38,13 +38,29 @@
MockErrorLogging& operator=(MockErrorLogging&&) = delete;
virtual ~MockErrorLogging() = default;
- // TODO: Add parameters when ErrorLogging interface is complete
- MOCK_METHOD(void, logConfigFileError, (), (override));
- MOCK_METHOD(void, logDBusError, (), (override));
- MOCK_METHOD(void, logI2CError, (), (override));
- MOCK_METHOD(void, logInternalError, (), (override));
- MOCK_METHOD(void, logPMBusError, (), (override));
- MOCK_METHOD(void, logWriteVerificationError, (), (override));
+ MOCK_METHOD(void, logConfigFileError,
+ (Entry::Level severity, Journal& journal), (override));
+
+ MOCK_METHOD(void, logDBusError, (Entry::Level severity, Journal& journal),
+ (override));
+
+ MOCK_METHOD(void, logI2CError,
+ (Entry::Level severity, Journal& journal,
+ const std::string& bus, uint8_t addr, int errorNumber),
+ (override));
+
+ MOCK_METHOD(void, logInternalError,
+ (Entry::Level severity, Journal& journal), (override));
+
+ MOCK_METHOD(void, logPMBusError,
+ (Entry::Level severity, Journal& journal,
+ const std::string& inventoryPath),
+ (override));
+
+ MOCK_METHOD(void, logWriteVerificationError,
+ (Entry::Level severity, Journal& journal,
+ const std::string& inventoryPath),
+ (override));
};
} // namespace phosphor::power::regulators