summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorWilliam A. Kennington III <wak@google.com>2018-09-20 18:48:20 -0700
committerWilliam A. Kennington III <wak@google.com>2018-09-27 11:57:23 -0700
commit3a70fa24fc016a06b0dc2ecdc3c7275d1f25425c (patch)
tree649acab21ab5c66f607e02b348ee49c51ac53599 /test
parent548e9f13d2f0aa3eb0ec6ab179c3f5697b108366 (diff)
downloadphosphor-networkd-3a70fa24fc016a06b0dc2ecdc3c7275d1f25425c.tar.gz
phosphor-networkd-3a70fa24fc016a06b0dc2ecdc3c7275d1f25425c.zip
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>
Diffstat (limited to 'test')
-rw-r--r--test/Makefile.am3
-rw-r--r--test/test_network_manager.cpp1
-rw-r--r--test/test_rtnetlink.cpp9
3 files changed, 7 insertions, 6 deletions
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_cpp_flags = -Igtest $(GTEST_CPPFLAGS) $(AM_CPPFLAGS)
generic_cxx_flags = $(PTHREAD_CFLAGS) \
$(SYSTEMD_CFLAGS) \
$(SDBUSPLUS_CFLAGS) \
+ $(SDEVENTPLUS_CFLAGS) \
$(PHOSPHOR_LOGGING_CFLAGS) \
$(PHOSPHOR_DBUS_INTERFACES_CFLAGS)
@@ -28,6 +29,7 @@ generic_ld_flags = -lgtest_main -lgtest -lstdc++fs \
$(OESDK_TESTCASE_FLAGS) \
$(SYSTEMD_LIBS) \
$(SDBUSPLUS_LIBS) \
+ $(SDEVENTPLUS_LIBS) \
$(PHOSPHOR_LOGGING_LIBS) \
$(PHOSPHOR_DBUS_INTERFACES_LIBS)
@@ -49,7 +51,6 @@ test_LDADD = $(top_builddir)/ethernet_interface.o \
$(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 refreshObjects()
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
OpenPOWER on IntegriCloud