Add host_error_monitor.cpp to the unit test build
Some functions are only available in host_error_monitor.cpp, so it needs
to be included in unit test builds.
Signed-off-by: Jason M. Bills <jason.m.bills@linux.intel.com>
Change-Id: Ib1e2b698fde3e3639e739a3ff3964eaba40338eb
diff --git a/src/host_error_monitor.cpp b/src/host_error_monitor.cpp
index 00177b9..ffeab44 100644
--- a/src/host_error_monitor.cpp
+++ b/src/host_error_monitor.cpp
@@ -46,7 +46,7 @@
}
}
}
-static void initializeHostState()
+[[maybe_unused]] static void initializeHostState()
{
// Get the current host state to prepare to start the signal monitors
conn->async_method_call(
@@ -72,7 +72,8 @@
"xyz.openbmc_project.State.Host", "CurrentHostState");
}
-static std::shared_ptr<sdbusplus::bus::match_t> startHostStateMonitor()
+[[maybe_unused]] static std::shared_ptr<sdbusplus::bus::match_t>
+ startHostStateMonitor()
{
return std::make_shared<sdbusplus::bus::match_t>(
*conn,
@@ -119,6 +120,7 @@
}
} // namespace host_error_monitor
+#ifndef UNIT_TEST
int main(int /*argc*/, char* /*argv*/[])
{
// setup connection to dbus
@@ -142,3 +144,4 @@
return 0;
}
+#endif
diff --git a/tests/meson.build b/tests/meson.build
index 545c988..2cadb5c 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -29,6 +29,8 @@
executable(
unit_test,
unit_test + '.cpp',
+ '../src/host_error_monitor.cpp',
+ cpp_args: '-DUNIT_TEST',
include_directories: incs,
dependencies: deps
+ [