sysd_monitor: Parse json file(s)
Parse the json file(s) into a c++ data object that can be used in later
commits to easily check for monitored targets and log appropriate
errors.
Accept a command line parameter to input file and call parsing function
Tested:
- Verified 100% code coverage of new parser cpp
Change-Id: I0bacd80b7f5330eb9cb03d8e3717742ab107bf94
Signed-off-by: Andrew Geissler <geissonator@yahoo.com>
diff --git a/Makefile.am b/Makefile.am
index 1be2555..aba2d6b 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,5 +1,23 @@
AM_DEFAULT_SOURCE_EXT = .cpp
+if AUTOCONF_CODE_COVERAGE_2019_01_06
+include $(top_srcdir)/aminclude_static.am
+clean-local: code-coverage-clean
+distclean-local: code-coverage-dist-clean
+else
+@CODE_COVERAGE_RULES@
+endif
+
+AM_LIBS = $(CODE_COVERAGE_LIBS)
+AM_CPPFLAGS = $(CODE_COVERAGE_CPPFLAGS) -UNDEBUG $(GTEST_CPPFLAGS)
+AM_CFLAGS = $(CODE_COVERAGE_CFLAGS)
+AM_CXXFLAGS = $(CODE_COVERAGE_CXXFLAGS) \
+ -DBOOST_SYSTEM_NO_DEPRECATED -DBOOST_ERROR_CODE_HEADER_ONLY \
+ -DBOOST_ALL_NO_LIB
+AM_LDFLAGS = $(GMOCK_LIBS) -lgmock_main \
+ $(GTEST_LIBS) $(OESDK_TESTCASE_FLAGS) $(PTHREAD_LIBS) \
+$(SDBUSPLUS_LIBS) -lboost_system
+
bin_PROGRAMS = \
phosphor-host-state-manager \
phosphor-chassis-state-manager \
@@ -32,7 +50,8 @@
host_check_main.cpp
phosphor_systemd_target_monitor_SOURCES = \
- systemd_target_monitor.cpp
+ systemd_target_monitor.cpp \
+ systemd_target_parser.cpp
generic_cxxflags = \
$(SYSTEMD_CFLAGS) \
@@ -73,3 +92,14 @@
$(generic_ldflags) \
$(SDEVENTPLUS_LIBS) \
-lstdc++fs
+
+
+check_PROGRAMS =
+XFAIL_TESTS =
+
+# Ignore system headers
+CODE_COVERAGE_IGNORE_PATTERN = '/include/*' '/usr/include/*' '$(includedir)/*'
+
+include test/Makefile.am.include
+
+TESTS = $(check_PROGRAMS)