meson: enable unit tests
Signed-off-by: Andrew Geissler <geissonator@yahoo.com>
Change-Id: I69e3f705848d375313ba6e13f4475b9eab573763
diff --git a/meson.build b/meson.build
index fe1fcc5..81bcfae 100644
--- a/meson.build
+++ b/meson.build
@@ -108,3 +108,36 @@
implicit_include_directories: true,
install: true
)
+
+build_tests = get_option('tests')
+
+# If test coverage of source files within the root directory are wanted,
+# need to define and build the tests from here
+if not build_tests.disabled()
+gtest = dependency('gtest', main: true, disabler: true, required: build_tests)
+ test(
+ 'test_systemd_parser',
+ executable('test_systemd_parser',
+ './test/systemd_parser.cpp',
+ 'systemd_target_parser.cpp',
+ dependencies: [
+ gtest,
+ ],
+ implicit_include_directories: true,
+ include_directories: '../'
+ )
+ )
+
+ test(
+ 'test_systemd_signal',
+ executable('test_systemd_signal',
+ './test/systemd_signal.cpp',
+ 'systemd_target_signal.cpp',
+ dependencies: [
+ gtest, sdbusplus, sdeventplus, phosphorlogging,
+ ],
+ implicit_include_directories: true,
+ include_directories: '../'
+ )
+ )
+endif