Prior to this commit, the unit test framework behaved slightly
differently depending upon how the libcgroup git repo was
cloned.  This commit standardizes the unit test framework's
behavior by initializing the googletest submodule when
bootstrap.sh is invoked.

This commit also cleans up a potential issue on some versions
of automake that don't properly expand $(top_builddir) early
in the automake process.

Signed-off-by: Tom Hromatka <tom.hroma...@oracle.com>
---
 bootstrap.sh            |  8 ++++++++
 tests/gunit/Makefile.am | 13 +++++++------
 2 files changed, 15 insertions(+), 6 deletions(-)

diff --git a/bootstrap.sh b/bootstrap.sh
index 08a054f..2a1386a 100755
--- a/bootstrap.sh
+++ b/bootstrap.sh
@@ -8,6 +8,14 @@ if [ -f .git/hooks/pre-commit.sample -a ! -f 
.git/hooks/pre-commit ] ; then
        echo "Activated pre-commit hook."
 fi
 
+# configure googletest
+git submodule update --init --recursive
+pushd googletest
+git checkout release-1.8.1
+cmake .
+make
+popd
+
 aclocal
 libtoolize -c
 autoconf
diff --git a/tests/gunit/Makefile.am b/tests/gunit/Makefile.am
index 8bc014c..1f54ad9 100644
--- a/tests/gunit/Makefile.am
+++ b/tests/gunit/Makefile.am
@@ -21,15 +21,16 @@
 
 AM_CPPFLAGS = -I$(top_srcdir)/include \
              -I$(top_srcdir)/src \
-             -I$(top_srcdir)/googletest/googletest/include \
-             -I$(top_srcdir)/googletest/googletest \
+             -I$(top_builddir)/googletest/googletest/include \
+             -I$(top_builddir)/googletest/googletest \
              -std=c++11
-LDADD = $(top_builddir)/src/.libs/libcgroupfortesting.la \
+LDADD = ../../src/.libs/libcgroupfortesting.la \
        libgtest.la
 
-libgtest_la_SOURCES = $(top_srcdir)/googletest/googletest/src/gtest-all.cc
-libgtest_la_CPPFLAGS = -I$(top_srcdir)/googletest/googletest/include \
-                      -I$(top_srcdir)/googletest/googletest
+libgtest_la_SOURCES = ../../googletest/googletest/src/gtest-all.cc
+libgtest_la_CPPFLAGS = -I$(top_builddir)/googletest/googletest/include \
+                      -I$(top_builddir)/googletest/googletest
+libgtest_la_LDFLAGS = -lpthread
 
 check_LTLIBRARIES = libgtest.la
 check_PROGRAMS = gtest
-- 
1.8.3.1



_______________________________________________
Libcg-devel mailing list
Libcg-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libcg-devel

Reply via email to