build: add meson for unit-tests

Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: I96e75ba8a4853d0454f3f5012e0d79e1a34af02c
diff --git a/meson.build b/meson.build
index dfcad3d..e66c3c3 100644
--- a/meson.build
+++ b/meson.build
@@ -45,3 +45,7 @@
   install: true,
   install_dir: get_option('libdir') / 'ipmid-providers',
 )
+
+if get_option('tests').allowed()
+  subdir('test')
+endif
diff --git a/meson_options.txt b/meson_options.txt
index 5b73cce..70c130e 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -1,4 +1,10 @@
 option(
+    'tests',
+    type: 'feature',
+    value: 'enabled',
+    description: 'Build tests',
+)
+option(
     'google_oen',
     type: 'feature',
     value: 'enabled',
diff --git a/test/meson.build b/test/meson.build
new file mode 100644
index 0000000..727f53e
--- /dev/null
+++ b/test/meson.build
@@ -0,0 +1,19 @@
+gtest_dep = dependency('gtest', main: true)
+gmock_dep = dependency('gmock')
+
+test(
+  'test_ethstats',
+  executable(
+    'test-ethstats',
+    'ethstats_unittest.cpp',
+    include_directories: [
+      '..',
+    ],
+    dependencies: [
+      ethstatscmd_common_dep,
+      gmock_dep,
+      gtest_dep,
+      ipmid_dep,
+    ],
+  ),
+)