Use gtest and gmock if installed.
git-svn-id: https://google-glog.googlecode.com/svn/trunk@26 eb4d4688-79bd-11dd-afb4-1d65580434c0
This commit is contained in:
parent
68e9555c91
commit
cc27d6aa59
12
Makefile.am
12
Makefile.am
@ -45,7 +45,9 @@ dist_doc_DATA = AUTHORS COPYING ChangeLog INSTALL NEWS README \
|
||||
lib_LTLIBRARIES =
|
||||
|
||||
# The libraries libglog depends on.
|
||||
COMMON_LIBS=$(PTHREAD_LIBS) $(GFLAGS_LIBS) $(UNWIND_LIBS)
|
||||
COMMON_LIBS = $(PTHREAD_LIBS) $(GFLAGS_LIBS) $(UNWIND_LIBS)
|
||||
# Libraries for our unittest.
|
||||
TEST_LIBS = $(GTEST_LIBS) $(GMOCK_LIBS)
|
||||
|
||||
## unittests you want to run when people type 'make check'.
|
||||
## TESTS is for binary unittests, check_SCRIPTS for script-based unittests.
|
||||
@ -66,7 +68,7 @@ logging_unittest_SOURCES = $(gloginclude_HEADERS) \
|
||||
nodist_logging_unittest_SOURCES = $(nodist_gloginclude_HEADERS)
|
||||
logging_unittest_CXXFLAGS = $(PTHREAD_CFLAGS)
|
||||
logging_unittest_LDFLAGS = $(PTHREAD_CFLAGS)
|
||||
logging_unittest_LDADD = libglog.la $(COMMON_LIBS)
|
||||
logging_unittest_LDADD = libglog.la $(COMMON_LIBS) $(TEST_LIBS)
|
||||
|
||||
check_SCRIPTS += logging_striplog_test_sh
|
||||
noinst_SCRIPTS += src/logging_striplog_test.sh
|
||||
@ -116,7 +118,7 @@ demangle_unittest_SOURCES = $(gloginclude_HEADERS) \
|
||||
nodist_demangle_unittest_SOURCES = $(nodist_gloginclude_HEADERS)
|
||||
demangle_unittest_CXXFLAGS = $(PTHREAD_CFLAGS)
|
||||
demangle_unittest_LDFLAGS = $(PTHREAD_CFLAGS)
|
||||
demangle_unittest_LDADD = libglog.la $(COMMON_LIBS)
|
||||
demangle_unittest_LDADD = libglog.la $(COMMON_LIBS) $(TEST_LIBS)
|
||||
|
||||
TESTS += stacktrace_unittest
|
||||
stacktrace_unittest_SOURCES = $(gloginclude_HEADERS) \
|
||||
@ -132,7 +134,7 @@ symbolize_unittest_SOURCES = $(gloginclude_HEADERS) \
|
||||
nodist_symbolize_unittest_SOURCES = $(nodist_gloginclude_HEADERS)
|
||||
symbolize_unittest_CXXFLAGS = $(PTHREAD_CFLAGS)
|
||||
symbolize_unittest_LDFLAGS = $(PTHREAD_CFLAGS)
|
||||
symbolize_unittest_LDADD = libglog.la $(COMMON_LIBS)
|
||||
symbolize_unittest_LDADD = libglog.la $(COMMON_LIBS) $(TEST_LIBS)
|
||||
|
||||
TESTS += stl_logging_unittest
|
||||
stl_logging_unittest_SOURCES = $(gloginclude_HEADERS) \
|
||||
@ -156,7 +158,7 @@ utilities_unittest_SOURCES = $(gloginclude_HEADERS) \
|
||||
nodist_utilities_unittest_SOURCES = $(nodist_gloginclude_HEADERS)
|
||||
utilities_unittest_CXXFLAGS = $(PTHREAD_CFLAGS)
|
||||
utilities_unittest_LDFLAGS = $(PTHREAD_CFLAGS)
|
||||
utilities_unittest_LDADD = libglog.la $(COMMON_LIBS)
|
||||
utilities_unittest_LDADD = libglog.la $(COMMON_LIBS) $(TEST_LIBS)
|
||||
|
||||
## vvvv RULES TO MAKE THE LIBRARIES, BINARIES, AND UNITTESTS
|
||||
|
||||
|
||||
25
Makefile.in
25
Makefile.in
@ -111,7 +111,9 @@ am_demangle_unittest_OBJECTS = $(am__objects_1) \
|
||||
nodist_demangle_unittest_OBJECTS = $(am__objects_1)
|
||||
demangle_unittest_OBJECTS = $(am_demangle_unittest_OBJECTS) \
|
||||
$(nodist_demangle_unittest_OBJECTS)
|
||||
demangle_unittest_DEPENDENCIES = libglog.la $(am__DEPENDENCIES_2)
|
||||
am__DEPENDENCIES_3 = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
|
||||
demangle_unittest_DEPENDENCIES = libglog.la $(am__DEPENDENCIES_2) \
|
||||
$(am__DEPENDENCIES_3)
|
||||
demangle_unittest_LINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) \
|
||||
$(LIBTOOLFLAGS) --mode=link $(CXXLD) \
|
||||
$(demangle_unittest_CXXFLAGS) $(CXXFLAGS) \
|
||||
@ -151,7 +153,8 @@ am_logging_unittest_OBJECTS = $(am__objects_1) \
|
||||
nodist_logging_unittest_OBJECTS = $(am__objects_1)
|
||||
logging_unittest_OBJECTS = $(am_logging_unittest_OBJECTS) \
|
||||
$(nodist_logging_unittest_OBJECTS)
|
||||
logging_unittest_DEPENDENCIES = libglog.la $(am__DEPENDENCIES_2)
|
||||
logging_unittest_DEPENDENCIES = libglog.la $(am__DEPENDENCIES_2) \
|
||||
$(am__DEPENDENCIES_3)
|
||||
logging_unittest_LINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) \
|
||||
$(LIBTOOLFLAGS) --mode=link $(CXXLD) \
|
||||
$(logging_unittest_CXXFLAGS) $(CXXFLAGS) \
|
||||
@ -191,7 +194,8 @@ am_symbolize_unittest_OBJECTS = $(am__objects_1) \
|
||||
nodist_symbolize_unittest_OBJECTS = $(am__objects_1)
|
||||
symbolize_unittest_OBJECTS = $(am_symbolize_unittest_OBJECTS) \
|
||||
$(nodist_symbolize_unittest_OBJECTS)
|
||||
symbolize_unittest_DEPENDENCIES = libglog.la $(am__DEPENDENCIES_2)
|
||||
symbolize_unittest_DEPENDENCIES = libglog.la $(am__DEPENDENCIES_2) \
|
||||
$(am__DEPENDENCIES_3)
|
||||
symbolize_unittest_LINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) \
|
||||
$(LIBTOOLFLAGS) --mode=link $(CXXLD) \
|
||||
$(symbolize_unittest_CXXFLAGS) $(CXXFLAGS) \
|
||||
@ -201,7 +205,8 @@ am_utilities_unittest_OBJECTS = $(am__objects_1) \
|
||||
nodist_utilities_unittest_OBJECTS = $(am__objects_1)
|
||||
utilities_unittest_OBJECTS = $(am_utilities_unittest_OBJECTS) \
|
||||
$(nodist_utilities_unittest_OBJECTS)
|
||||
utilities_unittest_DEPENDENCIES = libglog.la $(am__DEPENDENCIES_2)
|
||||
utilities_unittest_DEPENDENCIES = libglog.la $(am__DEPENDENCIES_2) \
|
||||
$(am__DEPENDENCIES_3)
|
||||
utilities_unittest_LINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) \
|
||||
$(LIBTOOLFLAGS) --mode=link $(CXXLD) \
|
||||
$(utilities_unittest_CXXFLAGS) $(CXXFLAGS) \
|
||||
@ -302,7 +307,9 @@ EXEEXT = @EXEEXT@
|
||||
F77 = @F77@
|
||||
FFLAGS = @FFLAGS@
|
||||
GFLAGS_LIBS = @GFLAGS_LIBS@
|
||||
GMOCK_LIBS = @GMOCK_LIBS@
|
||||
GREP = @GREP@
|
||||
GTEST_LIBS = @GTEST_LIBS@
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
@ -423,6 +430,8 @@ lib_LTLIBRARIES = libglog.la
|
||||
|
||||
# The libraries libglog depends on.
|
||||
COMMON_LIBS = $(PTHREAD_LIBS) $(GFLAGS_LIBS) $(UNWIND_LIBS)
|
||||
# Libraries for our unittest.
|
||||
TEST_LIBS = $(GTEST_LIBS) $(GMOCK_LIBS)
|
||||
TESTS_ENVIRONMENT =
|
||||
check_SCRIPTS = logging_striplog_test_sh demangle_unittest_sh \
|
||||
signalhandler_unittest_sh
|
||||
@ -439,7 +448,7 @@ logging_unittest_SOURCES = $(gloginclude_HEADERS) \
|
||||
nodist_logging_unittest_SOURCES = $(nodist_gloginclude_HEADERS)
|
||||
logging_unittest_CXXFLAGS = $(PTHREAD_CFLAGS)
|
||||
logging_unittest_LDFLAGS = $(PTHREAD_CFLAGS)
|
||||
logging_unittest_LDADD = libglog.la $(COMMON_LIBS)
|
||||
logging_unittest_LDADD = libglog.la $(COMMON_LIBS) $(TEST_LIBS)
|
||||
logging_striptest0_SOURCES = $(gloginclude_HEADERS) \
|
||||
src/logging_striptest_main.cc
|
||||
|
||||
@ -467,7 +476,7 @@ demangle_unittest_SOURCES = $(gloginclude_HEADERS) \
|
||||
nodist_demangle_unittest_SOURCES = $(nodist_gloginclude_HEADERS)
|
||||
demangle_unittest_CXXFLAGS = $(PTHREAD_CFLAGS)
|
||||
demangle_unittest_LDFLAGS = $(PTHREAD_CFLAGS)
|
||||
demangle_unittest_LDADD = libglog.la $(COMMON_LIBS)
|
||||
demangle_unittest_LDADD = libglog.la $(COMMON_LIBS) $(TEST_LIBS)
|
||||
stacktrace_unittest_SOURCES = $(gloginclude_HEADERS) \
|
||||
src/stacktrace_unittest.cc
|
||||
|
||||
@ -481,7 +490,7 @@ symbolize_unittest_SOURCES = $(gloginclude_HEADERS) \
|
||||
nodist_symbolize_unittest_SOURCES = $(nodist_gloginclude_HEADERS)
|
||||
symbolize_unittest_CXXFLAGS = $(PTHREAD_CFLAGS)
|
||||
symbolize_unittest_LDFLAGS = $(PTHREAD_CFLAGS)
|
||||
symbolize_unittest_LDADD = libglog.la $(COMMON_LIBS)
|
||||
symbolize_unittest_LDADD = libglog.la $(COMMON_LIBS) $(TEST_LIBS)
|
||||
stl_logging_unittest_SOURCES = $(gloginclude_HEADERS) \
|
||||
src/stl_logging_unittest.cc
|
||||
|
||||
@ -502,7 +511,7 @@ utilities_unittest_SOURCES = $(gloginclude_HEADERS) \
|
||||
nodist_utilities_unittest_SOURCES = $(nodist_gloginclude_HEADERS)
|
||||
utilities_unittest_CXXFLAGS = $(PTHREAD_CFLAGS)
|
||||
utilities_unittest_LDFLAGS = $(PTHREAD_CFLAGS)
|
||||
utilities_unittest_LDADD = libglog.la $(COMMON_LIBS)
|
||||
utilities_unittest_LDADD = libglog.la $(COMMON_LIBS) $(TEST_LIBS)
|
||||
libglog_la_SOURCES = $(gloginclude_HEADERS) \
|
||||
src/logging.cc src/raw_logging.cc src/vlog_is_on.cc \
|
||||
src/utilities.cc src/utilities.h \
|
||||
|
||||
200
configure
vendored
200
configure
vendored
@ -901,6 +901,8 @@ ac_cv_have_u_int16_t
|
||||
ac_cv_have___uint16
|
||||
ac_cv_have_libgflags
|
||||
GFLAGS_LIBS
|
||||
GTEST_LIBS
|
||||
GMOCK_LIBS
|
||||
LIBOBJS
|
||||
LTLIBOBJS'
|
||||
ac_subst_files=''
|
||||
@ -5064,7 +5066,7 @@ ia64-*-hpux*)
|
||||
;;
|
||||
*-*-irix6*)
|
||||
# Find out which ABI we are using.
|
||||
echo '#line 5067 "configure"' > conftest.$ac_ext
|
||||
echo '#line 5069 "configure"' > conftest.$ac_ext
|
||||
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
|
||||
(eval $ac_compile) 2>&5
|
||||
ac_status=$?
|
||||
@ -7419,11 +7421,11 @@ else
|
||||
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
|
||||
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
|
||||
-e 's:$: $lt_compiler_flag:'`
|
||||
(eval echo "\"\$as_me:7422: $lt_compile\"" >&5)
|
||||
(eval echo "\"\$as_me:7424: $lt_compile\"" >&5)
|
||||
(eval "$lt_compile" 2>conftest.err)
|
||||
ac_status=$?
|
||||
cat conftest.err >&5
|
||||
echo "$as_me:7426: \$? = $ac_status" >&5
|
||||
echo "$as_me:7428: \$? = $ac_status" >&5
|
||||
if (exit $ac_status) && test -s "$ac_outfile"; then
|
||||
# The compiler can only warn and ignore the option if not recognized
|
||||
# So say no if there are warnings other than the usual output.
|
||||
@ -7709,11 +7711,11 @@ else
|
||||
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
|
||||
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
|
||||
-e 's:$: $lt_compiler_flag:'`
|
||||
(eval echo "\"\$as_me:7712: $lt_compile\"" >&5)
|
||||
(eval echo "\"\$as_me:7714: $lt_compile\"" >&5)
|
||||
(eval "$lt_compile" 2>conftest.err)
|
||||
ac_status=$?
|
||||
cat conftest.err >&5
|
||||
echo "$as_me:7716: \$? = $ac_status" >&5
|
||||
echo "$as_me:7718: \$? = $ac_status" >&5
|
||||
if (exit $ac_status) && test -s "$ac_outfile"; then
|
||||
# The compiler can only warn and ignore the option if not recognized
|
||||
# So say no if there are warnings other than the usual output.
|
||||
@ -7813,11 +7815,11 @@ else
|
||||
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
|
||||
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
|
||||
-e 's:$: $lt_compiler_flag:'`
|
||||
(eval echo "\"\$as_me:7816: $lt_compile\"" >&5)
|
||||
(eval echo "\"\$as_me:7818: $lt_compile\"" >&5)
|
||||
(eval "$lt_compile" 2>out/conftest.err)
|
||||
ac_status=$?
|
||||
cat out/conftest.err >&5
|
||||
echo "$as_me:7820: \$? = $ac_status" >&5
|
||||
echo "$as_me:7822: \$? = $ac_status" >&5
|
||||
if (exit $ac_status) && test -s out/conftest2.$ac_objext
|
||||
then
|
||||
# The compiler can only warn and ignore the option if not recognized
|
||||
@ -10190,7 +10192,7 @@ else
|
||||
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
|
||||
lt_status=$lt_dlunknown
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 10193 "configure"
|
||||
#line 10195 "configure"
|
||||
#include "confdefs.h"
|
||||
|
||||
#if HAVE_DLFCN_H
|
||||
@ -10290,7 +10292,7 @@ else
|
||||
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
|
||||
lt_status=$lt_dlunknown
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 10293 "configure"
|
||||
#line 10295 "configure"
|
||||
#include "confdefs.h"
|
||||
|
||||
#if HAVE_DLFCN_H
|
||||
@ -12691,11 +12693,11 @@ else
|
||||
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
|
||||
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
|
||||
-e 's:$: $lt_compiler_flag:'`
|
||||
(eval echo "\"\$as_me:12694: $lt_compile\"" >&5)
|
||||
(eval echo "\"\$as_me:12696: $lt_compile\"" >&5)
|
||||
(eval "$lt_compile" 2>conftest.err)
|
||||
ac_status=$?
|
||||
cat conftest.err >&5
|
||||
echo "$as_me:12698: \$? = $ac_status" >&5
|
||||
echo "$as_me:12700: \$? = $ac_status" >&5
|
||||
if (exit $ac_status) && test -s "$ac_outfile"; then
|
||||
# The compiler can only warn and ignore the option if not recognized
|
||||
# So say no if there are warnings other than the usual output.
|
||||
@ -12795,11 +12797,11 @@ else
|
||||
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
|
||||
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
|
||||
-e 's:$: $lt_compiler_flag:'`
|
||||
(eval echo "\"\$as_me:12798: $lt_compile\"" >&5)
|
||||
(eval echo "\"\$as_me:12800: $lt_compile\"" >&5)
|
||||
(eval "$lt_compile" 2>out/conftest.err)
|
||||
ac_status=$?
|
||||
cat out/conftest.err >&5
|
||||
echo "$as_me:12802: \$? = $ac_status" >&5
|
||||
echo "$as_me:12804: \$? = $ac_status" >&5
|
||||
if (exit $ac_status) && test -s out/conftest2.$ac_objext
|
||||
then
|
||||
# The compiler can only warn and ignore the option if not recognized
|
||||
@ -14393,11 +14395,11 @@ else
|
||||
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
|
||||
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
|
||||
-e 's:$: $lt_compiler_flag:'`
|
||||
(eval echo "\"\$as_me:14396: $lt_compile\"" >&5)
|
||||
(eval echo "\"\$as_me:14398: $lt_compile\"" >&5)
|
||||
(eval "$lt_compile" 2>conftest.err)
|
||||
ac_status=$?
|
||||
cat conftest.err >&5
|
||||
echo "$as_me:14400: \$? = $ac_status" >&5
|
||||
echo "$as_me:14402: \$? = $ac_status" >&5
|
||||
if (exit $ac_status) && test -s "$ac_outfile"; then
|
||||
# The compiler can only warn and ignore the option if not recognized
|
||||
# So say no if there are warnings other than the usual output.
|
||||
@ -14497,11 +14499,11 @@ else
|
||||
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
|
||||
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
|
||||
-e 's:$: $lt_compiler_flag:'`
|
||||
(eval echo "\"\$as_me:14500: $lt_compile\"" >&5)
|
||||
(eval echo "\"\$as_me:14502: $lt_compile\"" >&5)
|
||||
(eval "$lt_compile" 2>out/conftest.err)
|
||||
ac_status=$?
|
||||
cat out/conftest.err >&5
|
||||
echo "$as_me:14504: \$? = $ac_status" >&5
|
||||
echo "$as_me:14506: \$? = $ac_status" >&5
|
||||
if (exit $ac_status) && test -s out/conftest2.$ac_objext
|
||||
then
|
||||
# The compiler can only warn and ignore the option if not recognized
|
||||
@ -16717,11 +16719,11 @@ else
|
||||
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
|
||||
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
|
||||
-e 's:$: $lt_compiler_flag:'`
|
||||
(eval echo "\"\$as_me:16720: $lt_compile\"" >&5)
|
||||
(eval echo "\"\$as_me:16722: $lt_compile\"" >&5)
|
||||
(eval "$lt_compile" 2>conftest.err)
|
||||
ac_status=$?
|
||||
cat conftest.err >&5
|
||||
echo "$as_me:16724: \$? = $ac_status" >&5
|
||||
echo "$as_me:16726: \$? = $ac_status" >&5
|
||||
if (exit $ac_status) && test -s "$ac_outfile"; then
|
||||
# The compiler can only warn and ignore the option if not recognized
|
||||
# So say no if there are warnings other than the usual output.
|
||||
@ -17007,11 +17009,11 @@ else
|
||||
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
|
||||
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
|
||||
-e 's:$: $lt_compiler_flag:'`
|
||||
(eval echo "\"\$as_me:17010: $lt_compile\"" >&5)
|
||||
(eval echo "\"\$as_me:17012: $lt_compile\"" >&5)
|
||||
(eval "$lt_compile" 2>conftest.err)
|
||||
ac_status=$?
|
||||
cat conftest.err >&5
|
||||
echo "$as_me:17014: \$? = $ac_status" >&5
|
||||
echo "$as_me:17016: \$? = $ac_status" >&5
|
||||
if (exit $ac_status) && test -s "$ac_outfile"; then
|
||||
# The compiler can only warn and ignore the option if not recognized
|
||||
# So say no if there are warnings other than the usual output.
|
||||
@ -17111,11 +17113,11 @@ else
|
||||
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
|
||||
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
|
||||
-e 's:$: $lt_compiler_flag:'`
|
||||
(eval echo "\"\$as_me:17114: $lt_compile\"" >&5)
|
||||
(eval echo "\"\$as_me:17116: $lt_compile\"" >&5)
|
||||
(eval "$lt_compile" 2>out/conftest.err)
|
||||
ac_status=$?
|
||||
cat out/conftest.err >&5
|
||||
echo "$as_me:17118: \$? = $ac_status" >&5
|
||||
echo "$as_me:17120: \$? = $ac_status" >&5
|
||||
if (exit $ac_status) && test -s out/conftest2.$ac_objext
|
||||
then
|
||||
# The compiler can only warn and ignore the option if not recognized
|
||||
@ -23925,6 +23927,152 @@ else
|
||||
GFLAGS_LIBS=
|
||||
fi
|
||||
|
||||
# Check if there is gtest library installed.
|
||||
{ echo "$as_me:$LINENO: checking for main in -lgtest" >&5
|
||||
echo $ECHO_N "checking for main in -lgtest... $ECHO_C" >&6; }
|
||||
if test "${ac_cv_lib_gtest_main+set}" = set; then
|
||||
echo $ECHO_N "(cached) $ECHO_C" >&6
|
||||
else
|
||||
ac_check_lib_save_LIBS=$LIBS
|
||||
LIBS="-lgtest $LIBS"
|
||||
cat >conftest.$ac_ext <<_ACEOF
|
||||
/* confdefs.h. */
|
||||
_ACEOF
|
||||
cat confdefs.h >>conftest.$ac_ext
|
||||
cat >>conftest.$ac_ext <<_ACEOF
|
||||
/* end confdefs.h. */
|
||||
|
||||
|
||||
int
|
||||
main ()
|
||||
{
|
||||
return main ();
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
rm -f conftest.$ac_objext conftest$ac_exeext
|
||||
if { (ac_try="$ac_link"
|
||||
case "(($ac_try" in
|
||||
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
|
||||
*) ac_try_echo=$ac_try;;
|
||||
esac
|
||||
eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
|
||||
(eval "$ac_link") 2>conftest.er1
|
||||
ac_status=$?
|
||||
grep -v '^ *+' conftest.er1 >conftest.err
|
||||
rm -f conftest.er1
|
||||
cat conftest.err >&5
|
||||
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); } && {
|
||||
test -z "$ac_c_werror_flag" ||
|
||||
test ! -s conftest.err
|
||||
} && test -s conftest$ac_exeext &&
|
||||
$as_test_x conftest$ac_exeext; then
|
||||
ac_cv_lib_gtest_main=yes
|
||||
else
|
||||
echo "$as_me: failed program was:" >&5
|
||||
sed 's/^/| /' conftest.$ac_ext >&5
|
||||
|
||||
ac_cv_lib_gtest_main=no
|
||||
fi
|
||||
|
||||
rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
|
||||
conftest$ac_exeext conftest.$ac_ext
|
||||
LIBS=$ac_check_lib_save_LIBS
|
||||
fi
|
||||
{ echo "$as_me:$LINENO: result: $ac_cv_lib_gtest_main" >&5
|
||||
echo "${ECHO_T}$ac_cv_lib_gtest_main" >&6; }
|
||||
if test $ac_cv_lib_gtest_main = yes; then
|
||||
ac_cv_have_libgtest=1
|
||||
else
|
||||
ac_cv_have_libgtest=0
|
||||
fi
|
||||
|
||||
if test x"$ac_cv_have_libgtest" = x"1"; then
|
||||
GTEST_LIBS=-lgtest
|
||||
|
||||
cat >>confdefs.h <<\_ACEOF
|
||||
#define HAVE_LIB_GTEST 1
|
||||
_ACEOF
|
||||
|
||||
|
||||
# Check if there is gmock library installed.
|
||||
{ echo "$as_me:$LINENO: checking for main in -lgmock" >&5
|
||||
echo $ECHO_N "checking for main in -lgmock... $ECHO_C" >&6; }
|
||||
if test "${ac_cv_lib_gmock_main+set}" = set; then
|
||||
echo $ECHO_N "(cached) $ECHO_C" >&6
|
||||
else
|
||||
ac_check_lib_save_LIBS=$LIBS
|
||||
LIBS="-lgmock $GTEST_LIBS $LIBS"
|
||||
cat >conftest.$ac_ext <<_ACEOF
|
||||
/* confdefs.h. */
|
||||
_ACEOF
|
||||
cat confdefs.h >>conftest.$ac_ext
|
||||
cat >>conftest.$ac_ext <<_ACEOF
|
||||
/* end confdefs.h. */
|
||||
|
||||
|
||||
int
|
||||
main ()
|
||||
{
|
||||
return main ();
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
rm -f conftest.$ac_objext conftest$ac_exeext
|
||||
if { (ac_try="$ac_link"
|
||||
case "(($ac_try" in
|
||||
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
|
||||
*) ac_try_echo=$ac_try;;
|
||||
esac
|
||||
eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
|
||||
(eval "$ac_link") 2>conftest.er1
|
||||
ac_status=$?
|
||||
grep -v '^ *+' conftest.er1 >conftest.err
|
||||
rm -f conftest.er1
|
||||
cat conftest.err >&5
|
||||
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); } && {
|
||||
test -z "$ac_c_werror_flag" ||
|
||||
test ! -s conftest.err
|
||||
} && test -s conftest$ac_exeext &&
|
||||
$as_test_x conftest$ac_exeext; then
|
||||
ac_cv_lib_gmock_main=yes
|
||||
else
|
||||
echo "$as_me: failed program was:" >&5
|
||||
sed 's/^/| /' conftest.$ac_ext >&5
|
||||
|
||||
ac_cv_lib_gmock_main=no
|
||||
fi
|
||||
|
||||
rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
|
||||
conftest$ac_exeext conftest.$ac_ext
|
||||
LIBS=$ac_check_lib_save_LIBS
|
||||
fi
|
||||
{ echo "$as_me:$LINENO: result: $ac_cv_lib_gmock_main" >&5
|
||||
echo "${ECHO_T}$ac_cv_lib_gmock_main" >&6; }
|
||||
if test $ac_cv_lib_gmock_main = yes; then
|
||||
ac_cv_have_libgmock=1
|
||||
else
|
||||
ac_cv_have_libgmock=0
|
||||
fi
|
||||
|
||||
if test x"$ac_cv_have_libgmock" = x"1"; then
|
||||
GMOCK_LIBS=-lgmock
|
||||
|
||||
cat >>confdefs.h <<\_ACEOF
|
||||
#define HAVE_LIB_GMOCK 1
|
||||
_ACEOF
|
||||
|
||||
else
|
||||
GMOCK_LIBS=
|
||||
fi
|
||||
else
|
||||
GTEST_LIBS=
|
||||
fi
|
||||
|
||||
# We want to link in libunwind if it exists
|
||||
UNWIND_LIBS=
|
||||
# Unfortunately, we need to check the header file in addition to the
|
||||
@ -24482,6 +24630,8 @@ fi
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# Write generated configuration file
|
||||
ac_config_files="$ac_config_files Makefile src/glog/logging.h src/glog/raw_logging.h src/glog/vlog_is_on.h src/glog/stl_logging.h"
|
||||
|
||||
@ -25332,11 +25482,13 @@ ac_cv_have_u_int16_t!$ac_cv_have_u_int16_t$ac_delim
|
||||
ac_cv_have___uint16!$ac_cv_have___uint16$ac_delim
|
||||
ac_cv_have_libgflags!$ac_cv_have_libgflags$ac_delim
|
||||
GFLAGS_LIBS!$GFLAGS_LIBS$ac_delim
|
||||
GTEST_LIBS!$GTEST_LIBS$ac_delim
|
||||
GMOCK_LIBS!$GMOCK_LIBS$ac_delim
|
||||
LIBOBJS!$LIBOBJS$ac_delim
|
||||
LTLIBOBJS!$LTLIBOBJS$ac_delim
|
||||
_ACEOF
|
||||
|
||||
if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 37; then
|
||||
if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 39; then
|
||||
break
|
||||
elif $ac_last_try; then
|
||||
{ { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
|
||||
|
||||
21
configure.ac
21
configure.ac
@ -105,6 +105,25 @@ else
|
||||
GFLAGS_LIBS=
|
||||
fi
|
||||
|
||||
# Check if there is gtest library installed.
|
||||
AC_CHECK_LIB(gtest, main, ac_cv_have_libgtest=1, ac_cv_have_libgtest=0)
|
||||
if test x"$ac_cv_have_libgtest" = x"1"; then
|
||||
GTEST_LIBS=-lgtest
|
||||
AC_DEFINE(HAVE_LIB_GTEST, 1, [define if you have google gtest library])
|
||||
|
||||
# Check if there is gmock library installed.
|
||||
AC_CHECK_LIB(gmock, main, ac_cv_have_libgmock=1, ac_cv_have_libgmock=0,
|
||||
[$GTEST_LIBS])
|
||||
if test x"$ac_cv_have_libgmock" = x"1"; then
|
||||
GMOCK_LIBS=-lgmock
|
||||
AC_DEFINE(HAVE_LIB_GMOCK, 1, [define if you have google gmock library])
|
||||
else
|
||||
GMOCK_LIBS=
|
||||
fi
|
||||
else
|
||||
GTEST_LIBS=
|
||||
fi
|
||||
|
||||
# We want to link in libunwind if it exists
|
||||
UNWIND_LIBS=
|
||||
# Unfortunately, we need to check the header file in addition to the
|
||||
@ -183,6 +202,8 @@ AC_SUBST(ac_cv_have_u_int16_t)
|
||||
AC_SUBST(ac_cv_have___uint16)
|
||||
AC_SUBST(ac_cv_have_libgflags)
|
||||
AC_SUBST(GFLAGS_LIBS)
|
||||
AC_SUBST(GTEST_LIBS)
|
||||
AC_SUBST(GMOCK_LIBS)
|
||||
|
||||
# Write generated configuration file
|
||||
AC_CONFIG_FILES([Makefile src/glog/logging.h src/glog/raw_logging.h src/glog/vlog_is_on.h src/glog/stl_logging.h])
|
||||
|
||||
@ -30,6 +30,12 @@
|
||||
/* define if you have google gflags library */
|
||||
#undef HAVE_LIB_GFLAGS
|
||||
|
||||
/* define if you have google gmock library */
|
||||
#undef HAVE_LIB_GMOCK
|
||||
|
||||
/* define if you have google gtest library */
|
||||
#undef HAVE_LIB_GTEST
|
||||
|
||||
/* define if you have libunwind */
|
||||
#undef HAVE_LIB_UNWIND
|
||||
|
||||
|
||||
@ -65,6 +65,8 @@ int main(int argc, char **argv) {
|
||||
#ifdef HAVE_LIB_GFLAGS
|
||||
ParseCommandLineFlags(&argc, &argv, true);
|
||||
#endif
|
||||
InitGoogleTest(&argc, argv);
|
||||
|
||||
FLAGS_logtostderr = true;
|
||||
InitGoogleLogging(argv[0]);
|
||||
if (FLAGS_demangle_filter) {
|
||||
|
||||
@ -61,8 +61,18 @@ DEFINE_int32(benchmark_iters, 100000000, "Number of iterations per benchmark");
|
||||
DEFINE_int32(benchmark_iters, 1000000, "Number of iterations per benchmark");
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_LIB_GTEST
|
||||
# include <gtest/gtest.h>
|
||||
// Use our ASSERT_DEATH implementation.
|
||||
# undef ASSERT_DEATH
|
||||
# undef ASSERT_DEBUG_DEATH
|
||||
using testing::InitGoogleTest;
|
||||
#else
|
||||
|
||||
_START_GOOGLE_NAMESPACE_
|
||||
|
||||
void InitGoogleTest(int* argc, char** argv) {}
|
||||
|
||||
// The following is some bare-bones testing infrastructure
|
||||
|
||||
#define EXPECT_TRUE(cond) \
|
||||
@ -120,6 +130,33 @@ _START_GOOGLE_NAMESPACE_
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
vector<void (*)()> g_testlist; // the tests to run
|
||||
|
||||
#define TEST(a, b) \
|
||||
struct Test_##a##_##b { \
|
||||
Test_##a##_##b() { g_testlist.push_back(&Run); } \
|
||||
static void Run() { FlagSaver fs; RunTest(); } \
|
||||
static void RunTest(); \
|
||||
}; \
|
||||
static Test_##a##_##b g_test_##a##_##b; \
|
||||
void Test_##a##_##b::RunTest()
|
||||
|
||||
|
||||
static int RUN_ALL_TESTS() {
|
||||
vector<void (*)()>::const_iterator it;
|
||||
for (it = g_testlist.begin(); it != g_testlist.end(); ++it) {
|
||||
(*it)();
|
||||
}
|
||||
fprintf(stderr, "Passed %d tests\n\nPASS\n", (int)g_testlist.size());
|
||||
return 0;
|
||||
}
|
||||
|
||||
_END_GOOGLE_NAMESPACE_
|
||||
|
||||
#endif
|
||||
|
||||
_START_GOOGLE_NAMESPACE_
|
||||
|
||||
static bool g_called_abort;
|
||||
static jmp_buf g_jmp_buf;
|
||||
static void CalledAbort() {
|
||||
@ -153,27 +190,6 @@ static void CalledAbort() {
|
||||
#define ASSERT_DEBUG_DEATH(fn, msg) ASSERT_DEATH(fn, msg)
|
||||
#endif // NDEBUG
|
||||
|
||||
vector<void (*)()> g_testlist; // the tests to run
|
||||
|
||||
#define TEST(a, b) \
|
||||
struct Test_##a##_##b { \
|
||||
Test_##a##_##b() { g_testlist.push_back(&Run); } \
|
||||
static void Run() { FlagSaver fs; RunTest(); } \
|
||||
static void RunTest(); \
|
||||
}; \
|
||||
static Test_##a##_##b g_test_##a##_##b; \
|
||||
void Test_##a##_##b::RunTest()
|
||||
|
||||
|
||||
static int RUN_ALL_TESTS() {
|
||||
vector<void (*)()>::const_iterator it;
|
||||
for (it = g_testlist.begin(); it != g_testlist.end(); ++it) {
|
||||
(*it)();
|
||||
}
|
||||
fprintf(stderr, "Passed %d tests\n\nPASS\n", (int)g_testlist.size());
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Benchmark tools.
|
||||
|
||||
#define BENCHMARK(n) static BenchmarkRegisterer __benchmark_ ## n (#n, &n);
|
||||
|
||||
@ -112,6 +112,8 @@ int main(int argc, char **argv) {
|
||||
|
||||
RunSpecifiedBenchmarks();
|
||||
|
||||
InitGoogleTest(&argc, argv);
|
||||
|
||||
// so that death tests run before we use threads
|
||||
CHECK_EQ(RUN_ALL_TESTS(), 0);
|
||||
|
||||
|
||||
@ -308,6 +308,7 @@ void ATTRIBUTE_NOINLINE TestWithReturnAddress() {
|
||||
int main(int argc, char **argv) {
|
||||
FLAGS_logtostderr = true;
|
||||
InitGoogleLogging(argv[0]);
|
||||
InitGoogleTest(&argc, argv);
|
||||
#ifdef HAVE_SYMBOLIZE
|
||||
// We don't want to get affected by the callback interface, that may be
|
||||
// used to install some callback function at InitGoogle() time.
|
||||
|
||||
@ -16,6 +16,7 @@ TEST(sync_val_compare_and_swap, utilities) {
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
InitGoogleLogging(argv[0]);
|
||||
InitGoogleTest(&argc, argv);
|
||||
|
||||
CHECK_EQ(RUN_ALL_TESTS(), 0);
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user