summaryrefslogtreecommitdiffstats
path: root/test/openpower-pels/pel_manager_test.cpp
diff options
context:
space:
mode:
authorMatt Spinler <spinler@us.ibm.com>2020-01-07 08:48:53 -0600
committerMatt Spinler <spinler@us.ibm.com>2020-01-27 08:25:12 -0600
commit6b1a5c83bdb6c4d0619d7c154a223f6a1d97d52d (patch)
treea47db58f42a40d3aeead1f7b53212f0dd5a50a08 /test/openpower-pels/pel_manager_test.cpp
parenta34ab72c40382f98ff0d1badf909013ab3a458f5 (diff)
downloadphosphor-logging-6b1a5c83bdb6c4d0619d7c154a223f6a1d97d52d.tar.gz
phosphor-logging-6b1a5c83bdb6c4d0619d7c154a223f6a1d97d52d.zip
PEL: Close PEL FD after getPEL call
To close the file descriptor returned from the getPEL D-Bus method call, use the 'Defer' sdeventplus object to schedule it to happen from the event loop. Signed-off-by: Matt Spinler <spinler@us.ibm.com> Change-Id: I2b850a1c92215e7f66166cc5440d7071663065c0
Diffstat (limited to 'test/openpower-pels/pel_manager_test.cpp')
-rw-r--r--test/openpower-pels/pel_manager_test.cpp19
1 files changed, 15 insertions, 4 deletions
diff --git a/test/openpower-pels/pel_manager_test.cpp b/test/openpower-pels/pel_manager_test.cpp
index 3036f30..8f3df22 100644
--- a/test/openpower-pels/pel_manager_test.cpp
+++ b/test/openpower-pels/pel_manager_test.cpp
@@ -28,6 +28,21 @@ namespace fs = std::filesystem;
class ManagerTest : public CleanPELFiles
{
+ public:
+ ManagerTest() : logManager(bus, "logging_path")
+ {
+ sd_event_default(&sdEvent);
+ bus.attach_event(sdEvent, SD_EVENT_PRIORITY_NORMAL);
+ }
+
+ ~ManagerTest()
+ {
+ sd_event_unref(sdEvent);
+ }
+
+ sdbusplus::bus::bus bus = sdbusplus::bus::new_default();
+ phosphor::logging::internal::Manager logManager;
+ sd_event* sdEvent;
};
fs::path makeTempDir()
@@ -56,8 +71,6 @@ std::optional<fs::path> findAnyPELInRepo()
// a PEL saved in the repository.
TEST_F(ManagerTest, TestCreateWithPEL)
{
- auto bus = sdbusplus::bus::new_default();
- phosphor::logging::internal::Manager logManager(bus, "logging_path");
std::unique_ptr<DataInterfaceBase> dataIface =
std::make_unique<DataInterface>(bus);
@@ -170,8 +183,6 @@ TEST_F(ManagerTest, TestCreateWithMessageRegistry)
TEST_F(ManagerTest, TestDBusMethods)
{
- auto bus = sdbusplus::bus::new_default();
- phosphor::logging::internal::Manager logManager(bus, "logging_path");
std::unique_ptr<DataInterfaceBase> dataIface =
std::make_unique<DataInterface>(bus);
OpenPOWER on IntegriCloud