summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPatrick Venture <venture@google.com>2018-06-13 09:39:46 -0700
committerPatrick Venture <venture@google.com>2018-06-13 09:40:29 -0700
commit7a841b624997ecc17db7251b9170c210507dc373 (patch)
treeaf917e53e31df39e67561a1e8dab8d01a34d22fd
parente49bbfc7ff829641267ca28eba2547466f41175c (diff)
downloadphosphor-pid-control-7a841b624997ecc17db7251b9170c210507dc373.tar.gz
phosphor-pid-control-7a841b624997ecc17db7251b9170c210507dc373.zip
enable unit-tests
This CL simply enables unit-tests. Change-Id: I4ea62005566e2aa42fc29258559654fe2745f726 Signed-off-by: Patrick Venture <venture@google.com>
-rw-r--r--Makefile.am2
-rw-r--r--configure.ac4
-rw-r--r--test/Makefile.am16
3 files changed, 20 insertions, 2 deletions
diff --git a/Makefile.am b/Makefile.am
index b5d488f..ea2a963 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -70,4 +70,4 @@ libswampd_la_SOURCES = \
# $(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 @@ PKG_CHECK_MODULES([LIBCONFIGXX], [libconfig++ >= 1.5], ,AC_MSG_ERROR([libconfig+
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 @@ ZONEGEN="$PYTHON ${srcdir}/scripts/zone_gen.py -i $ZONE_YAML_GEN"
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)
OpenPOWER on IntegriCloud