From fe446c17695b74106f7d64718afde02f90f216f6 Mon Sep 17 00:00:00 2001 From: Tom Hromatka Date: Thu, 19 Sep 2019 14:40:37 -0600 Subject: [PATCH] tests: Improve the unit test framework integration with automake 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 Signed-off-by: Dhaval Giani --- bootstrap.sh | 8 ++++++++ tests/gunit/Makefile.am | 13 +++++++------ 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/bootstrap.sh b/bootstrap.sh index 08a054ff..2a1386a1 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 8bc014c0..1f54ad93 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 -- 2.47.2