Migrate to a common timer class
This change pulls in sdeventplus and uses the timer implementation as
a drop in for the currently included timer.
Tested:
Unit tests still build but are not currently running. Manually
tested this change on a zaius machine and made sure timers went off.
Change-Id: I2808196581fc766843931403b83fead16926b0ae
Signed-off-by: William A. Kennington III <wak@google.com>
diff --git a/test/Makefile.am b/test/Makefile.am
index b32e210..b726e53 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -21,6 +21,7 @@
generic_cxx_flags = $(PTHREAD_CFLAGS) \
$(SYSTEMD_CFLAGS) \
$(SDBUSPLUS_CFLAGS) \
+ $(SDEVENTPLUS_CFLAGS) \
$(PHOSPHOR_LOGGING_CFLAGS) \
$(PHOSPHOR_DBUS_INTERFACES_CFLAGS)
@@ -28,6 +29,7 @@
$(OESDK_TESTCASE_FLAGS) \
$(SYSTEMD_LIBS) \
$(SDBUSPLUS_LIBS) \
+ $(SDEVENTPLUS_LIBS) \
$(PHOSPHOR_LOGGING_LIBS) \
$(PHOSPHOR_DBUS_INTERFACES_LIBS)
@@ -49,7 +51,6 @@
$(top_builddir)/ipaddress.o \
$(top_builddir)/routing_table.o \
$(top_builddir)/util.o \
- $(top_builddir)/timer.o \
$(top_builddir)/rtnetlink_server.o \
$(top_builddir)/system_configuration.o \
$(top_builddir)/dhcp_configuration.o \
diff --git a/test/test_network_manager.cpp b/test/test_network_manager.cpp
index 1c0a116..d97b182 100644
--- a/test/test_network_manager.cpp
+++ b/test/test_network_manager.cpp
@@ -1,6 +1,5 @@
#include "mock_syscall.hpp"
#include "network_manager.hpp"
-#include "timer.hpp"
#include "xyz/openbmc_project/Common/error.hpp"
#include <arpa/inet.h>
diff --git a/test/test_rtnetlink.cpp b/test/test_rtnetlink.cpp
index 4be3743..ee43bf4 100644
--- a/test/test_rtnetlink.cpp
+++ b/test/test_rtnetlink.cpp
@@ -1,13 +1,15 @@
#include "mock_syscall.hpp"
#include "network_manager.hpp"
#include "rtnetlink_server.hpp"
-#include "timer.hpp"
#include "types.hpp"
#include <linux/rtnetlink.h>
#include <net/if.h>
+#include <chrono>
+#include <functional>
#include <sdbusplus/bus.hpp>
+#include <sdeventplus/event.hpp>
#include <gtest/gtest.h>
@@ -34,9 +36,8 @@
void initializeTimers()
{
- std::function<void()> refreshFunc(std::bind(&refreshObjects));
-
- refreshObjectTimer = std::make_unique<Timer>(refreshFunc);
+ refreshObjectTimer = std::make_unique<Timer>(
+ sdeventplus::Event::get_default(), std::bind(refreshObjects));
}
class TestRtNetlink : public testing::Test