Skip to content

Commit

Permalink
Fix C++ test setup
Browse files Browse the repository at this point in the history
  • Loading branch information
marktsuchida committed Apr 16, 2020
1 parent 0e84e6f commit 836dff2
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 18 deletions.
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ test-reports/
/symbols/

# Testing
/testing/gmock-*.zip
/testing/gmock/
/testing/googletest.zip
/testing/googletest/

# Generated source
/buildscripts/launchers/micromanager
Expand Down
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ AC_PROG_CC([clang llvm-gcc gcc cc])

# Testing (googletest, googlemock)
# See testing/setuptesting.sh
MM_GMOCK([$srcdir/testing/gmock], [\$(top_srcdir)/testing/gmock])
MM_GMOCK([$srcdir/testing/googletest], [\$(top_srcdir)/testing/googletest])
AM_CONDITIONAL([BUILD_CPP_TESTS], [test "x$have_gmock" = xyes])


Expand Down
13 changes: 8 additions & 5 deletions m4/mm_gmock.m4
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
# MM_GMOCK(gmock-src-dir, make-gmock-src-dir)
# MM_GMOCK(gtest-src-dir, make-gtest-src-dir)
# Sets have_gmock to yes or no; if yes, sets the GMOCK_CPPFLAGS substitution
# variable.
# Note: This is named gmock because the gmock package used to contain gtest.
# Now it is the other way around. This test is written only for the particular
# googletest version we use.
AC_DEFUN([MM_GMOCK], [
AC_MSG_CHECKING([for gmock source in $1])
AS_IF([test -f $1/src/gmock-all.cc],
AC_MSG_CHECKING([for googletest source in $1])
AS_IF([test -f $1/googletest/src/gtest-all.cc],
[
AC_MSG_RESULT([yes])
have_gmock=yes
GMOCK_DIR="$2"
GTEST_DIR="$GMOCK_DIR/gtest"
GTEST_DIR="$2/googletest"
GMOCK_DIR="$2/googlemock"
AC_SUBST([GMOCK_CPPFLAGS],
["-isystem $GTEST_DIR/include -isystem $GMOCK_DIR/include"])
],
Expand Down
8 changes: 5 additions & 3 deletions testing/Makefile.am
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
AUTOMAKE_OPTIONS = subdir-objects

check_LTLIBRARIES = libgmock.la
libgmock_la_CPPFLAGS = $(GMOCK_CPPFLAGS) -Igmock -Igmock/gtest
libgmock_la_SOURCES = gmock/gtest/src/gtest-all.cc \
gmock/src/gmock-all.cc
libgmock_la_CPPFLAGS = $(GMOCK_CPPFLAGS) \
-Igoogletest/googletest \
-Igoogletest/googlemock
libgmock_la_SOURCES = googletest/googletest/src/gtest-all.cc \
googletest/googlemock/src/gmock-all.cc
14 changes: 7 additions & 7 deletions testing/setuptesting.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,22 @@ set -e
cd `dirname $0`
rm -rf gmock

GMOCK_VERSION=1.7.0
GMOCK="gmock-$GMOCK_VERSION"
GMOCK_SHA1=f9d9dd882a25f4069ed9ee48e70aff1b53e3c5a5
# 1.8.1 is last version supporting pre-C++11 compilers
GTEST_VER=1.8.1
GTEST_SHA1=7b41ea3682937069e3ce32cb06619fead505795e

if test -f $GMOCK.zip
then
:
else
curl -LO https://googlemock.googlecode.com/files/$GMOCK.zip
curl -L -o googletest.zip https://github.com/google/googletest/archive/release-$GTEST_VER.zip
fi

cat >sha1sums.tmp <<EOF
$GMOCK_SHA1 $GMOCK.zip
$GTEST_SHA1 googletest.zip
EOF
shasum -c sha1sums.tmp
rm sha1sums.tmp

unzip -q $GMOCK.zip
mv $GMOCK gmock
unzip -q googletest.zip
mv googletest-release-$GTEST_VER googletest

0 comments on commit 836dff2

Please sign in to comment.