Commit cc27d6aa authored by 's avatar

Use gtest and gmock if installed.


git-svn-id: https://google-glog.googlecode.com/svn/trunk@26 eb4d4688-79bd-11dd-afb4-1d65580434c0
parent 68e9555c
...@@ -45,7 +45,9 @@ dist_doc_DATA = AUTHORS COPYING ChangeLog INSTALL NEWS README \ ...@@ -45,7 +45,9 @@ dist_doc_DATA = AUTHORS COPYING ChangeLog INSTALL NEWS README \
lib_LTLIBRARIES = lib_LTLIBRARIES =
# The libraries libglog depends on. # 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'. ## unittests you want to run when people type 'make check'.
## TESTS is for binary unittests, check_SCRIPTS for script-based unittests. ## TESTS is for binary unittests, check_SCRIPTS for script-based unittests.
...@@ -66,7 +68,7 @@ logging_unittest_SOURCES = $(gloginclude_HEADERS) \ ...@@ -66,7 +68,7 @@ logging_unittest_SOURCES = $(gloginclude_HEADERS) \
nodist_logging_unittest_SOURCES = $(nodist_gloginclude_HEADERS) nodist_logging_unittest_SOURCES = $(nodist_gloginclude_HEADERS)
logging_unittest_CXXFLAGS = $(PTHREAD_CFLAGS) logging_unittest_CXXFLAGS = $(PTHREAD_CFLAGS)
logging_unittest_LDFLAGS = $(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 check_SCRIPTS += logging_striplog_test_sh
noinst_SCRIPTS += src/logging_striplog_test.sh noinst_SCRIPTS += src/logging_striplog_test.sh
...@@ -116,7 +118,7 @@ demangle_unittest_SOURCES = $(gloginclude_HEADERS) \ ...@@ -116,7 +118,7 @@ demangle_unittest_SOURCES = $(gloginclude_HEADERS) \
nodist_demangle_unittest_SOURCES = $(nodist_gloginclude_HEADERS) nodist_demangle_unittest_SOURCES = $(nodist_gloginclude_HEADERS)
demangle_unittest_CXXFLAGS = $(PTHREAD_CFLAGS) demangle_unittest_CXXFLAGS = $(PTHREAD_CFLAGS)
demangle_unittest_LDFLAGS = $(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 TESTS += stacktrace_unittest
stacktrace_unittest_SOURCES = $(gloginclude_HEADERS) \ stacktrace_unittest_SOURCES = $(gloginclude_HEADERS) \
...@@ -132,7 +134,7 @@ symbolize_unittest_SOURCES = $(gloginclude_HEADERS) \ ...@@ -132,7 +134,7 @@ symbolize_unittest_SOURCES = $(gloginclude_HEADERS) \
nodist_symbolize_unittest_SOURCES = $(nodist_gloginclude_HEADERS) nodist_symbolize_unittest_SOURCES = $(nodist_gloginclude_HEADERS)
symbolize_unittest_CXXFLAGS = $(PTHREAD_CFLAGS) symbolize_unittest_CXXFLAGS = $(PTHREAD_CFLAGS)
symbolize_unittest_LDFLAGS = $(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 TESTS += stl_logging_unittest
stl_logging_unittest_SOURCES = $(gloginclude_HEADERS) \ stl_logging_unittest_SOURCES = $(gloginclude_HEADERS) \
...@@ -156,7 +158,7 @@ utilities_unittest_SOURCES = $(gloginclude_HEADERS) \ ...@@ -156,7 +158,7 @@ utilities_unittest_SOURCES = $(gloginclude_HEADERS) \
nodist_utilities_unittest_SOURCES = $(nodist_gloginclude_HEADERS) nodist_utilities_unittest_SOURCES = $(nodist_gloginclude_HEADERS)
utilities_unittest_CXXFLAGS = $(PTHREAD_CFLAGS) utilities_unittest_CXXFLAGS = $(PTHREAD_CFLAGS)
utilities_unittest_LDFLAGS = $(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 ## vvvv RULES TO MAKE THE LIBRARIES, BINARIES, AND UNITTESTS
......
...@@ -111,7 +111,9 @@ am_demangle_unittest_OBJECTS = $(am__objects_1) \ ...@@ -111,7 +111,9 @@ am_demangle_unittest_OBJECTS = $(am__objects_1) \
nodist_demangle_unittest_OBJECTS = $(am__objects_1) nodist_demangle_unittest_OBJECTS = $(am__objects_1)
demangle_unittest_OBJECTS = $(am_demangle_unittest_OBJECTS) \ demangle_unittest_OBJECTS = $(am_demangle_unittest_OBJECTS) \
$(nodist_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) \ demangle_unittest_LINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CXXLD) \ $(LIBTOOLFLAGS) --mode=link $(CXXLD) \
$(demangle_unittest_CXXFLAGS) $(CXXFLAGS) \ $(demangle_unittest_CXXFLAGS) $(CXXFLAGS) \
...@@ -151,7 +153,8 @@ am_logging_unittest_OBJECTS = $(am__objects_1) \ ...@@ -151,7 +153,8 @@ am_logging_unittest_OBJECTS = $(am__objects_1) \
nodist_logging_unittest_OBJECTS = $(am__objects_1) nodist_logging_unittest_OBJECTS = $(am__objects_1)
logging_unittest_OBJECTS = $(am_logging_unittest_OBJECTS) \ logging_unittest_OBJECTS = $(am_logging_unittest_OBJECTS) \
$(nodist_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) \ logging_unittest_LINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CXXLD) \ $(LIBTOOLFLAGS) --mode=link $(CXXLD) \
$(logging_unittest_CXXFLAGS) $(CXXFLAGS) \ $(logging_unittest_CXXFLAGS) $(CXXFLAGS) \
...@@ -191,7 +194,8 @@ am_symbolize_unittest_OBJECTS = $(am__objects_1) \ ...@@ -191,7 +194,8 @@ am_symbolize_unittest_OBJECTS = $(am__objects_1) \
nodist_symbolize_unittest_OBJECTS = $(am__objects_1) nodist_symbolize_unittest_OBJECTS = $(am__objects_1)
symbolize_unittest_OBJECTS = $(am_symbolize_unittest_OBJECTS) \ symbolize_unittest_OBJECTS = $(am_symbolize_unittest_OBJECTS) \
$(nodist_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) \ symbolize_unittest_LINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CXXLD) \ $(LIBTOOLFLAGS) --mode=link $(CXXLD) \
$(symbolize_unittest_CXXFLAGS) $(CXXFLAGS) \ $(symbolize_unittest_CXXFLAGS) $(CXXFLAGS) \
...@@ -201,7 +205,8 @@ am_utilities_unittest_OBJECTS = $(am__objects_1) \ ...@@ -201,7 +205,8 @@ am_utilities_unittest_OBJECTS = $(am__objects_1) \
nodist_utilities_unittest_OBJECTS = $(am__objects_1) nodist_utilities_unittest_OBJECTS = $(am__objects_1)
utilities_unittest_OBJECTS = $(am_utilities_unittest_OBJECTS) \ utilities_unittest_OBJECTS = $(am_utilities_unittest_OBJECTS) \
$(nodist_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) \ utilities_unittest_LINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CXXLD) \ $(LIBTOOLFLAGS) --mode=link $(CXXLD) \
$(utilities_unittest_CXXFLAGS) $(CXXFLAGS) \ $(utilities_unittest_CXXFLAGS) $(CXXFLAGS) \
...@@ -302,7 +307,9 @@ EXEEXT = @EXEEXT@ ...@@ -302,7 +307,9 @@ EXEEXT = @EXEEXT@
F77 = @F77@ F77 = @F77@
FFLAGS = @FFLAGS@ FFLAGS = @FFLAGS@
GFLAGS_LIBS = @GFLAGS_LIBS@ GFLAGS_LIBS = @GFLAGS_LIBS@
GMOCK_LIBS = @GMOCK_LIBS@
GREP = @GREP@ GREP = @GREP@
GTEST_LIBS = @GTEST_LIBS@
INSTALL = @INSTALL@ INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@ INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_PROGRAM = @INSTALL_PROGRAM@
...@@ -423,6 +430,8 @@ lib_LTLIBRARIES = libglog.la ...@@ -423,6 +430,8 @@ lib_LTLIBRARIES = libglog.la
# The libraries libglog depends on. # 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)
TESTS_ENVIRONMENT = TESTS_ENVIRONMENT =
check_SCRIPTS = logging_striplog_test_sh demangle_unittest_sh \ check_SCRIPTS = logging_striplog_test_sh demangle_unittest_sh \
signalhandler_unittest_sh signalhandler_unittest_sh
...@@ -439,7 +448,7 @@ logging_unittest_SOURCES = $(gloginclude_HEADERS) \ ...@@ -439,7 +448,7 @@ logging_unittest_SOURCES = $(gloginclude_HEADERS) \
nodist_logging_unittest_SOURCES = $(nodist_gloginclude_HEADERS) nodist_logging_unittest_SOURCES = $(nodist_gloginclude_HEADERS)
logging_unittest_CXXFLAGS = $(PTHREAD_CFLAGS) logging_unittest_CXXFLAGS = $(PTHREAD_CFLAGS)
logging_unittest_LDFLAGS = $(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) \ logging_striptest0_SOURCES = $(gloginclude_HEADERS) \
src/logging_striptest_main.cc src/logging_striptest_main.cc
...@@ -467,7 +476,7 @@ demangle_unittest_SOURCES = $(gloginclude_HEADERS) \ ...@@ -467,7 +476,7 @@ demangle_unittest_SOURCES = $(gloginclude_HEADERS) \
nodist_demangle_unittest_SOURCES = $(nodist_gloginclude_HEADERS) nodist_demangle_unittest_SOURCES = $(nodist_gloginclude_HEADERS)
demangle_unittest_CXXFLAGS = $(PTHREAD_CFLAGS) demangle_unittest_CXXFLAGS = $(PTHREAD_CFLAGS)
demangle_unittest_LDFLAGS = $(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) \ stacktrace_unittest_SOURCES = $(gloginclude_HEADERS) \
src/stacktrace_unittest.cc src/stacktrace_unittest.cc
...@@ -481,7 +490,7 @@ symbolize_unittest_SOURCES = $(gloginclude_HEADERS) \ ...@@ -481,7 +490,7 @@ symbolize_unittest_SOURCES = $(gloginclude_HEADERS) \
nodist_symbolize_unittest_SOURCES = $(nodist_gloginclude_HEADERS) nodist_symbolize_unittest_SOURCES = $(nodist_gloginclude_HEADERS)
symbolize_unittest_CXXFLAGS = $(PTHREAD_CFLAGS) symbolize_unittest_CXXFLAGS = $(PTHREAD_CFLAGS)
symbolize_unittest_LDFLAGS = $(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) \ stl_logging_unittest_SOURCES = $(gloginclude_HEADERS) \
src/stl_logging_unittest.cc src/stl_logging_unittest.cc
...@@ -502,7 +511,7 @@ utilities_unittest_SOURCES = $(gloginclude_HEADERS) \ ...@@ -502,7 +511,7 @@ utilities_unittest_SOURCES = $(gloginclude_HEADERS) \
nodist_utilities_unittest_SOURCES = $(nodist_gloginclude_HEADERS) nodist_utilities_unittest_SOURCES = $(nodist_gloginclude_HEADERS)
utilities_unittest_CXXFLAGS = $(PTHREAD_CFLAGS) utilities_unittest_CXXFLAGS = $(PTHREAD_CFLAGS)
utilities_unittest_LDFLAGS = $(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) \ libglog_la_SOURCES = $(gloginclude_HEADERS) \
src/logging.cc src/raw_logging.cc src/vlog_is_on.cc \ src/logging.cc src/raw_logging.cc src/vlog_is_on.cc \
src/utilities.cc src/utilities.h \ src/utilities.cc src/utilities.h \
......
This diff is collapsed.
...@@ -105,6 +105,25 @@ else ...@@ -105,6 +105,25 @@ else
GFLAGS_LIBS= GFLAGS_LIBS=
fi 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 # We want to link in libunwind if it exists
UNWIND_LIBS= UNWIND_LIBS=
# Unfortunately, we need to check the header file in addition to the # Unfortunately, we need to check the header file in addition to the
...@@ -183,6 +202,8 @@ AC_SUBST(ac_cv_have_u_int16_t) ...@@ -183,6 +202,8 @@ AC_SUBST(ac_cv_have_u_int16_t)
AC_SUBST(ac_cv_have___uint16) AC_SUBST(ac_cv_have___uint16)
AC_SUBST(ac_cv_have_libgflags) AC_SUBST(ac_cv_have_libgflags)
AC_SUBST(GFLAGS_LIBS) AC_SUBST(GFLAGS_LIBS)
AC_SUBST(GTEST_LIBS)
AC_SUBST(GMOCK_LIBS)
# Write generated configuration file # 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]) 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 @@ ...@@ -30,6 +30,12 @@
/* define if you have google gflags library */ /* define if you have google gflags library */
#undef HAVE_LIB_GFLAGS #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 */ /* define if you have libunwind */
#undef HAVE_LIB_UNWIND #undef HAVE_LIB_UNWIND
......
...@@ -65,6 +65,8 @@ int main(int argc, char **argv) { ...@@ -65,6 +65,8 @@ int main(int argc, char **argv) {
#ifdef HAVE_LIB_GFLAGS #ifdef HAVE_LIB_GFLAGS
ParseCommandLineFlags(&argc, &argv, true); ParseCommandLineFlags(&argc, &argv, true);
#endif #endif
InitGoogleTest(&argc, argv);
FLAGS_logtostderr = true; FLAGS_logtostderr = true;
InitGoogleLogging(argv[0]); InitGoogleLogging(argv[0]);
if (FLAGS_demangle_filter) { if (FLAGS_demangle_filter) {
......
...@@ -61,8 +61,18 @@ DEFINE_int32(benchmark_iters, 100000000, "Number of iterations per benchmark"); ...@@ -61,8 +61,18 @@ DEFINE_int32(benchmark_iters, 100000000, "Number of iterations per benchmark");
DEFINE_int32(benchmark_iters, 1000000, "Number of iterations per benchmark"); DEFINE_int32(benchmark_iters, 1000000, "Number of iterations per benchmark");
#endif #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_ _START_GOOGLE_NAMESPACE_
void InitGoogleTest(int* argc, char** argv) {}
// The following is some bare-bones testing infrastructure // The following is some bare-bones testing infrastructure
#define EXPECT_TRUE(cond) \ #define EXPECT_TRUE(cond) \
...@@ -120,6 +130,33 @@ _START_GOOGLE_NAMESPACE_ ...@@ -120,6 +130,33 @@ _START_GOOGLE_NAMESPACE_
} \ } \
} while (0) } 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 bool g_called_abort;
static jmp_buf g_jmp_buf; static jmp_buf g_jmp_buf;
static void CalledAbort() { static void CalledAbort() {
...@@ -153,27 +190,6 @@ static void CalledAbort() { ...@@ -153,27 +190,6 @@ static void CalledAbort() {
#define ASSERT_DEBUG_DEATH(fn, msg) ASSERT_DEATH(fn, msg) #define ASSERT_DEBUG_DEATH(fn, msg) ASSERT_DEATH(fn, msg)
#endif // NDEBUG #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. // Benchmark tools.
#define BENCHMARK(n) static BenchmarkRegisterer __benchmark_ ## n (#n, &n); #define BENCHMARK(n) static BenchmarkRegisterer __benchmark_ ## n (#n, &n);
......
...@@ -112,6 +112,8 @@ int main(int argc, char **argv) { ...@@ -112,6 +112,8 @@ int main(int argc, char **argv) {
RunSpecifiedBenchmarks(); RunSpecifiedBenchmarks();
InitGoogleTest(&argc, argv);
// so that death tests run before we use threads // so that death tests run before we use threads
CHECK_EQ(RUN_ALL_TESTS(), 0); CHECK_EQ(RUN_ALL_TESTS(), 0);
......
...@@ -308,6 +308,7 @@ void ATTRIBUTE_NOINLINE TestWithReturnAddress() { ...@@ -308,6 +308,7 @@ void ATTRIBUTE_NOINLINE TestWithReturnAddress() {
int main(int argc, char **argv) { int main(int argc, char **argv) {
FLAGS_logtostderr = true; FLAGS_logtostderr = true;
InitGoogleLogging(argv[0]); InitGoogleLogging(argv[0]);
InitGoogleTest(&argc, argv);
#ifdef HAVE_SYMBOLIZE #ifdef HAVE_SYMBOLIZE
// We don't want to get affected by the callback interface, that may be // We don't want to get affected by the callback interface, that may be
// used to install some callback function at InitGoogle() time. // used to install some callback function at InitGoogle() time.
......
...@@ -16,6 +16,7 @@ TEST(sync_val_compare_and_swap, utilities) { ...@@ -16,6 +16,7 @@ TEST(sync_val_compare_and_swap, utilities) {
int main(int argc, char **argv) { int main(int argc, char **argv) {
InitGoogleLogging(argv[0]); InitGoogleLogging(argv[0]);
InitGoogleTest(&argc, argv);
CHECK_EQ(RUN_ALL_TESTS(), 0); CHECK_EQ(RUN_ALL_TESTS(), 0);
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment