Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: Fixing googletest build deps and scripts #19

Merged
merged 1 commit into from
May 7, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile.am
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
SUBDIRS = common

if TESTS
if GTEST
SUBDIRS += tests
endif
22 changes: 9 additions & 13 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -14,26 +14,22 @@ AC_CHECK_LIB([hiredis], [redisConnect])
AC_CHECK_LIB([nl-genl-3], [genl_connect])

AC_ARG_ENABLE(debug,
[ --enable-debug Compile with debugging flags],
[ --enable-debug Compile with debugging flags],
[case "${enableval}" in
yes) debug=true ;;
no) debug=false ;;
*) AC_MSG_ERROR(bad value ${enableval} for --enable-debug) ;;
esac],[debug=false])
AM_CONDITIONAL(DEBUG, test x$debug = xtrue)


AC_ARG_WITH(gtest,
[ --with-gtest=<dir> Compiles tests using the location of google tests],
AC_MSG_NOTICE(Using gtest path from:$with_gtest), with_gtest="none")

GTEST_PATH=
if test "x$with_gtest" != xnone; then
GTEST_PATH=$with_gtest
fi
AC_SUBST(GTEST_PATH)
AM_CONDITIONAL(TESTS, test "x$with_gtest" != xnone)

AC_ARG_ENABLE(gtest,
[ --enable-gtest Compile with googletest flags],
[case "${enableval}" in
yes) gtest=true ;;
no) gtest=false ;;
*) AC_MSG_ERROR(bad value ${enableval} for --enable-gtest) ;;
esac],[gtest=false])
AM_CONDITIONAL(GTEST, test x$gtest = xtrue)

CFLAGS_COMMON="-std=c++11 -Wall -fPIC -Wno-write-strings -I/usr/include/libnl3"
AC_SUBST(CFLAGS_COMMON)
Expand Down
9 changes: 9 additions & 0 deletions get-gtest.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash -ex

git clone https://github.com/google/googletest.git
cd googletest
mkdir build
cd build
cmake ..
cmake --build .
exit 0
8 changes: 4 additions & 4 deletions tests/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ else
DBGFLAGS = -g
endif

CFLAGS_GTEST = -I $(GTEST_PATH)/googletest/include
LDADD_GTEST = $(GTEST_PATH)/build/googletest/libgtest_main.a \
$(GTEST_PATH)/build/googletest/libgtest.a
CFLAGS_GTEST = -I $(top_srcdir)/googletest/googletest/include
LDADD_GTEST = $(top_srcdir)/googletest/build/googlemock/gtest/libgtest_main.a \
$(top_srcdir)/googletest/build/googlemock/gtest/libgtest.a

tests_SOURCES = redis_ut.cpp

tests_CFLAGS = $(DBGFLAGS) $(AM_CFLAGS) $(CFLAGS_COMMON) $(CFLAGS_GTEST)
tests_CPPFLAGS = $(DBGFLAGS) $(AM_CFLAGS) $(CFLAGS_COMMON) $(CFLAGS_GTEST)
tests_LDADD = $(LDADD_GTEST) -lnl-genl-3 -lhiredis -lhiredis -lpthread \
-L$(top_srcdir)/common -lswsscommon
-L$(top_srcdir)/common -lswsscommon