unit test hello world
Signed-off-by: Zane Shelley <zshelle@us.ibm.com>
Change-Id: Ieb1122c911e3199555b78abb18fe5a4d474947cc
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..547b6ed
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,2 @@
+*.sw*
+/build
diff --git a/meson.build b/meson.build
new file mode 100644
index 0000000..b28887d
--- /dev/null
+++ b/meson.build
@@ -0,0 +1,15 @@
+project('openpower-hw-diags', 'cpp',
+ version: '0.1', meson_version: '>=0.49.0',
+ default_options: [
+ 'warning_level=3',
+ 'werror=true',
+ 'cpp_std=c++17'
+ ])
+
+subdir('src')
+
+build_tests = get_option('tests')
+
+if not build_tests.disabled()
+ subdir('test')
+endif
diff --git a/meson_options.txt b/meson_options.txt
new file mode 100644
index 0000000..0fc2767
--- /dev/null
+++ b/meson_options.txt
@@ -0,0 +1 @@
+option('tests', type: 'feature', description: 'Build tests')
diff --git a/obj/.gitignore b/obj/.gitignore
deleted file mode 100644
index 3c95632..0000000
--- a/obj/.gitignore
+++ /dev/null
@@ -1,5 +0,0 @@
-# Ignore everything...
-*
-
-# Except...
-!.gitignore
diff --git a/src/meson.build b/src/meson.build
index ae878fd..ae1b040 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -1,9 +1 @@
-project('openpower-hw-diags', 'cpp',
- version: '0.1', meson_version: '>=0.49.0',
- default_options: [
- 'warning_level=3',
- 'werror=true',
- 'cpp_std=c++17'
- ])
-
executable('openpower-hw-diags', 'main.cpp', install : true)
diff --git a/test/hello-world.cpp b/test/hello-world.cpp
new file mode 100644
index 0000000..8cc0b19
--- /dev/null
+++ b/test/hello-world.cpp
@@ -0,0 +1,10 @@
+
+#include <stdio.h>
+
+int main()
+{
+ printf( "test: Hello, World!\n" );
+
+ return 0;
+}
+
diff --git a/test/meson.build b/test/meson.build
new file mode 100644
index 0000000..76aa354
--- /dev/null
+++ b/test/meson.build
@@ -0,0 +1,7 @@
+tests = [
+ 'hello-world',
+]
+
+foreach t : tests
+ test(t, executable(t.underscorify(), t + '.cpp'))
+endforeach