diff options
author | Lei YU <mine260309@gmail.com> | 2017-07-14 11:07:37 +0800 |
---|---|---|
committer | Lei YU <mine260309@gmail.com> | 2017-08-28 10:31:42 +0800 |
commit | 6c56a4a82863859d0d593621dc86f2a576440e77 (patch) | |
tree | 2a5fb6a3f016ce8be0cbfd6449837c571349cfeb /test/Makefile.am | |
parent | 0ab90ca75b825db8e2427ea62ea3ee212c9accbb (diff) | |
download | openpower-occ-control-6c56a4a82863859d0d593621dc86f2a576440e77.tar.gz openpower-occ-control-6c56a4a82863859d0d593621dc86f2a576440e77.zip |
Add unit tests for utils and refactor Makefiles
1. Add unit tests for utils;
2. Put the common code shared by app and utest into a library, and link the
library to app and utest.
This eliminates the duplicated compiled objects.
3. Update .gitignore
Change-Id: I05ee93c2b23748a1e038eeec3534d49b94911366
Signed-off-by: Lei YU <mine260309@gmail.com>
Diffstat (limited to 'test/Makefile.am')
-rw-r--r-- | test/Makefile.am | 30 |
1 files changed, 12 insertions, 18 deletions
diff --git a/test/Makefile.am b/test/Makefile.am index cd879f5..5311f9f 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -4,22 +4,16 @@ check_PROGRAMS = utest # Run all 'check' test programs TESTS = $(check_PROGRAMS) -# Build/add utest to test suite -utest_CPPFLAGS = -Igtest $(GTEST_CPPFLAGS) $(AM_CPPFLAGS) +utest_LDADD = $(top_builddir)/libocc_control.la -lstdc++fs + +utest_SOURCES = utest.cpp \ + TestI2cOcc.cpp + +utest_CPPFLAGS = $(GTEST_CPPFLAGS) \ + $(AM_CPPFLAGS) + utest_CXXFLAGS = $(PTHREAD_CFLAGS) -utest_LDFLAGS = -lgtest_main -lgtest \ - $(PTHREAD_LIBS) \ - $(OESDK_TESTCASE_FLAGS) \ - $(SYSTEMD_LIBS) \ - ${SDBUSPLUS_LIBS} \ - $(OPENPOWER_DBUS_INTERFACES_LIBS) \ - $(PHOSPHOR_DBUS_INTERFACES_LIBS) \ - -lstdc++fs -utest_SOURCES = utest.cpp -utest_LDADD = $(top_builddir)/powercap.o \ - $(top_builddir)/occ_status.o \ - $(top_builddir)/occ_device.o \ - $(top_builddir)/occ_errors.o \ - $(top_builddir)/i2c_occ.o \ - $(top_builddir)/utils.o \ - $(top_builddir)/org/open_power/OCC/Device/error.o + +utest_LDFLAGS = -lgmock_main \ + $(PTHREAD_LIBS) \ + $(OESDK_TESTCASE_FLAGS) |