enable unit-tests
This CL simply enables unit-tests.
Change-Id: I4ea62005566e2aa42fc29258559654fe2745f726
Signed-off-by: Patrick Venture <venture@google.com>
diff --git a/Makefile.am b/Makefile.am
index b5d488f..ea2a963 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -70,4 +70,4 @@
# $(PHOSPHOR_DBUS_INTERFACES_CFLAGS) \
# $(PHOSPHOR_LOGGING_CFLAGS)
-SUBDIRS = .
+SUBDIRS = . test
diff --git a/configure.ac b/configure.ac
index 69629fa..626fd5f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -33,6 +33,8 @@
LT_INIT # Required for systemd linking
# Check/set gtest specific functions.
+PKG_CHECK_MODULES([GTEST], [gtest], [], [AC_MSG_NOTICE([gtest not found, tests will not build])])
+PKG_CHECK_MODULES([GMOCK], [gmock], [], [AC_MSG_NOTICE([gmock not found, tests will not build])])
AX_PTHREAD([GTEST_CPPFLAGS="-DGTEST_HAS_PTHREAD=1"],[GTEST_CPPFLAGS="-DGTEST_HAS_PTHREAD=0"])
AC_SUBST(GTEST_CPPFLAGS)
@@ -67,5 +69,5 @@
AC_SUBST(ZONEGEN)
# Create configured output
-AC_CONFIG_FILES([Makefile])
+AC_CONFIG_FILES([Makefile test/Makefile])
AC_OUTPUT
diff --git a/test/Makefile.am b/test/Makefile.am
new file mode 100644
index 0000000..ea93a96
--- /dev/null
+++ b/test/Makefile.am
@@ -0,0 +1,16 @@
+AM_CPPFLAGS = -I$(top_srcdir)/ $(GTEST_CFLAGS) $(GMOCK_CFLAGS)
+AM_CXXFLAGS = $(PTHREAD_CFLAGS) \
+ $(GTEST_CFLAGS) \
+ $(GMOCK_CFLAGS) \
+ $(SDBUSPLUS_CFLAGS) \
+ $(PHOSPHOR_DBUS_INTERFACES_CFLAGS)
+AM_LDFLAGS = $(GTEST_LIBS) \
+ $(PTHREAD_LIBS) \
+ $(GMOCK_LIBS) \
+ $(OESDK_TESTCASE_FLAGS) \
+ $(SDBUSPLUS_LIBS) \
+ $(PHOSPHOR_DBUS_INTERFACES_LIBS)
+
+# Run all 'check' test programs
+check_PROGRAMS =
+TESTS = $(check_PROGRAMS)