Skip to content

Commit

Permalink
clang: update gtest to r435 and gmock to r300.
Browse files Browse the repository at this point in the history
This picks up some clang-specific fixes.
Unfortunately, the gtest update cascaded into a gmock update.
So I picked the earliest gmock version that mentioned a specific
gtest version so that they are more likely to work together.

gtest changelog:
- Fixes a leak in ThreadLocal.
- CMake 2.8/Visual Age compatibility patch by Hady Zalek.
- C++ Builder compatibility patch by Josh Kelley.
- Fixes gtest_filter_unittest and gtest_help_test on systems without death tests.
- Simplifies Makefile.am (by Zhanyong Wan and Vlad Losev).
- Adds alternative spellings for FAIL, SUCCEED, and TEST.
- Over-hauls README, and fixes Makefile.
- Fixes gtest-port_test on MinGW.
- Implements color output in GNU Screen sessions (issue 277).
- Minor improvement to hermetic build support in the CMake script, by Vlad Losev.
- Improves support for building Google Test as Windows DLL.
- Silence a Clang warning about an unused variable.
- Moves the universal printer from gmock to gtest and refactors the cmake script for reusing in gmock (by Vlad Losev).
- Suppresses some Clang warnings (by Chandler Carruth, Jeffrey Yasskin, and Zhanyong Wan).
- Renames CMake build script options.
- Lucid autotools compatibility patch by Jeffrey Yasskin.
- Replaces UniversalPrinter<T>::Print(x, os) with UniversalPrint(x, os) as appropriate (by Zhanyong Wan).
- Comment tweaks in CMakeLists.txt.
- Renames test script flags.
- Fixes a typo in comments.
- Adds GTEST_REMOVE_REFERENCE_AND_CONST_.
- Introduces gtest_force_shared_crt option for CMake build scripts.
- Implements printing parameters of failed parameterized tests (issue 71).

gmock changelog:
- Improves Makefile.am (by Vlad Losev); fixes Makefile and updates README (by Zhanyong Wan).
- Fixes a typo in README.
- Adds Each(m) (by Wojtek Moczydlowski); removes scripts/test/Makefile (by Zhanyong Wan); pulls in gtest r424.
- Adds a synchronization test.
- Fixes tests leaking altered values of GMOCK_FLAG(verbose) (issue 110).
- Moves the universal printer from gmock to gtest (by Vlad Losev).
- Renames test script flags.
- Adds CMake build script.
- Implements Pointwise().
- Fixes build failure on Windows/CMake (issue 111).
- Pulls r435 of gtest. This brings in the gtest_force_shared_crt option in CMake.

TEST=all existing tests should still pass

Review URL: http://codereview.chromium.org/3427004

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@59701 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
evan@chromium.org committed Sep 16, 2010
1 parent bb41572 commit eac1cd2
Show file tree
Hide file tree
Showing 39 changed files with 1,143 additions and 3,539 deletions.
2 changes: 1 addition & 1 deletion DEPS
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ deps = {
(Var("googlecode_url") % "open-vcdiff") + "/trunk@28",

"src/testing/gtest":
(Var("googlecode_url") % "googletest") + "/trunk@408",
(Var("googlecode_url") % "googletest") + "/trunk@435",

"src/third_party/angle":
(Var("googlecode_url") % "angleproject") + "/trunk@419",
Expand Down
38 changes: 20 additions & 18 deletions chrome/browser/notifications/desktop_notifications_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -269,25 +269,27 @@ TEST_F(DesktopNotificationsTest, TestQueueing) {

// Cancel the notifications from the start; the balloon space should
// remain full.
int id;
for (id = 1;
id <= kLotsOfToasts - balloon_collection_->max_balloon_count();
++id) {
service_->CancelDesktopNotification(process_id, route_id, id);
MessageLoopForUI::current()->RunAllPending();
expected_log.append("notification closed by script\n");
expected_log.append("notification displayed\n");
EXPECT_EQ(balloon_collection_->max_balloon_count(),
balloon_collection_->count());
EXPECT_EQ(expected_log, log_output_);
}
{
int id;
for (id = 1;
id <= kLotsOfToasts - balloon_collection_->max_balloon_count();
++id) {
service_->CancelDesktopNotification(process_id, route_id, id);
MessageLoopForUI::current()->RunAllPending();
expected_log.append("notification closed by script\n");
expected_log.append("notification displayed\n");
EXPECT_EQ(balloon_collection_->max_balloon_count(),
balloon_collection_->count());
EXPECT_EQ(expected_log, log_output_);
}

// Now cancel the rest. It should empty the balloon space.
for (; id <= kLotsOfToasts; ++id) {
service_->CancelDesktopNotification(process_id, route_id, id);
expected_log.append("notification closed by script\n");
MessageLoopForUI::current()->RunAllPending();
EXPECT_EQ(expected_log, log_output_);
// Now cancel the rest. It should empty the balloon space.
for (; id <= kLotsOfToasts; ++id) {
service_->CancelDesktopNotification(process_id, route_id, id);
expected_log.append("notification closed by script\n");
MessageLoopForUI::current()->RunAllPending();
EXPECT_EQ(expected_log, log_output_);
}
}

// Verify that the balloon collection is now empty.
Expand Down
2 changes: 0 additions & 2 deletions testing/gmock.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
'gmock/include/gmock/gmock-generated-matchers.h',
'gmock/include/gmock/gmock-generated-nice-strict.h',
'gmock/include/gmock/gmock-matchers.h',
'gmock/include/gmock/gmock-printers.h',
'gmock/include/gmock/gmock-spec-builders.h',
'gmock/include/gmock/gmock.h',
'gmock/include/gmock/internal/gmock-generated-internal-utils.h',
Expand All @@ -30,7 +29,6 @@
'gmock/src/gmock-cardinalities.cc',
'gmock/src/gmock-internal-utils.cc',
'gmock/src/gmock-matchers.cc',
'gmock/src/gmock-printers.cc',
'gmock/src/gmock-spec-builders.cc',
'gmock/src/gmock.cc',
'gmock_mutant.h', # gMock helpers
Expand Down
155 changes: 155 additions & 0 deletions testing/gmock/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
########################################################################
# Experimental CMake build script for Google Mock.
#
# Consider this a prototype. It will change drastically. For now,
# this is only for people on the cutting edge.
#
# To run the tests for Google Mock itself on Linux, use 'make test' or
# ctest. You can select which tests to run using 'ctest -R regex'.
# For more options, run 'ctest --help'.

# BUILD_SHARED_LIBS is a standard CMake variable, but we declare it here to
# make it prominent in the GUI.
option(BUILD_SHARED_LIBS "Build shared libraries (DLLs)." OFF)

# Forses BUILD_SHARED_LIBS to OFF as Google Mock currently does not support
# working in a DLL.
# TODO(vladl@google.com): Implement building gMock as a DLL.
set(BUILD_SHARED_LIBS OFF)

option(gmock_build_tests "Build all of Google Mock's own tests." OFF)

# A directory to find Google Test sources.
if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/gtest/CMakeLists.txt")
set(gtest_dir gtest)
else()
set(gtest_dir ../gtest)
endif()

include("${gtest_dir}/cmake/hermetic_build.cmake" OPTIONAL)

if (COMMAND pre_project_set_up_hermetic_build)
# Google Test also calls hermetic setup functions from add_subdirectory,
# although its changes will not affect things at the current scope.
pre_project_set_up_hermetic_build()
endif()

########################################################################
#
# Project-wide settings

# Name of the project.
#
# CMake files in this project can refer to the root source directory
# as ${gmock_SOURCE_DIR} and to the root binary directory as
# ${gmock_BINARY_DIR}.
# Language "C" is required for find_package(Threads).
project(gmock CXX C)
cmake_minimum_required(VERSION 2.6.2)

if (COMMAND set_up_hermetic_build)
set_up_hermetic_build()
endif()

# Defines functions and variables used by Google Mock.
include("${gtest_dir}/cmake/internal_utils.cmake")

# Google Test also calls this function from add_subdirectory,
# although its changes will not affect things at the current scope.
fix_default_settings() # Defined in internal_utils.cmake.

# Instructs CMake to process Google Test's CMakeLists.txt and add its
# targets to the current scope. We are placing Google Test's binary
# directory in a subdirectory of our own as VC compilation may break if they
# are the same (the default).
add_subdirectory("${gtest_dir}" "${gmock_BINARY_DIR}/gtest")

# Adds Google Mock's and Google Test's header directories to the search path.
include_directories("${gmock_SOURCE_DIR}/include"
"${gmock_SOURCE_DIR}"
"${gtest_SOURCE_DIR}/include"
# This directory is needed to build directly from Google
# Test sources.
"${gtest_SOURCE_DIR}")

########################################################################
#
# Defines the gmock & gmock_main libraries. User tests should link
# with one of them.

# Google Mock libraries. We build them using more strict warnings than what
# are used for other targets, to ensure that Google Mock can be compiled by
# a user aggressive about warnings.
cxx_library(gmock "${cxx_strict}" src/gmock-all.cc)
target_link_libraries(gmock gtest)

cxx_library(gmock_main "${cxx_strict}" src/gmock_main.cc)
target_link_libraries(gmock_main gmock)

########################################################################
#
# Google Mock's own tests.
#
# You can skip this section if you aren't interested in testing
# Google Mock itself.
#
# The tests are not built by default. To build them, set the
# gmock_build_tests option to ON. You can do it by running ccmake
# or specifying the -Dgmock_build_tests=ON flag when running cmake.

if (gmock_build_tests)
# This must be set in the root directory for the tests to be run by
# 'make test' or ctest.
enable_testing()

############################################################
# C++ tests built with standard compiler flags.

cxx_test(gmock-actions_test gmock_main)
cxx_test(gmock-cardinalities_test gmock_main)
cxx_test(gmock-generated-actions_test gmock_main)
cxx_test(gmock-generated-function-mockers_test gmock_main)
cxx_test(gmock-generated-internal-utils_test gmock_main)
cxx_test(gmock-generated-matchers_test gmock_main)
cxx_test(gmock-internal-utils_test gmock_main)
cxx_test(gmock-matchers_test gmock_main)
cxx_test(gmock-more-actions_test gmock_main)
cxx_test(gmock-nice-strict_test gmock_main)
cxx_test(gmock-port_test gmock_main)
cxx_test(gmock-spec-builders_test gmock_main)
cxx_test(gmock_link_test gmock_main test/gmock_link2_test.cc)
# cxx_test(gmock_stress_test gmock)
cxx_test(gmock_test gmock_main)

# gmock_all_test is commented to save time building and running tests.
# Uncomment if necessary.
# cxx_test(gmock_all_test gmock_main)

############################################################
# C++ tests built with non-standard compiler flags.

cxx_library(gmock_main_no_exception "${cxx_no_exception}"
"${gtest_dir}/src/gtest-all.cc" src/gmock-all.cc src/gmock_main.cc)
cxx_library(gmock_main_no_rtti "${cxx_no_rtti}"
"${gtest_dir}/src/gtest-all.cc" src/gmock-all.cc src/gmock_main.cc)
cxx_library(gmock_main_use_own_tuple "${cxx_use_own_tuple}"
"${gtest_dir}/src/gtest-all.cc" src/gmock-all.cc src/gmock_main.cc)

cxx_test_with_flags(gmock-more-actions_no_exception_test "${cxx_no_exception}"
gmock_main_no_exception test/gmock-more-actions_test.cc)

cxx_test_with_flags(gmock_no_rtti_test "${cxx_no_rtti}"
gmock_main_no_rtti test/gmock-spec-builders_test.cc)

cxx_test_with_flags(gmock_use_own_tuple_test "${cxx_use_own_tuple}"
gmock_main_use_own_tuple test/gmock-spec-builders_test.cc)

############################################################
# Python tests.

cxx_executable(gmock_leak_test_ test gmock_main)
py_test(gmock_leak_test)

cxx_executable(gmock_output_test_ test gmock)
py_test(gmock_output_test)
endif()
51 changes: 42 additions & 9 deletions testing/gmock/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ pkginclude_HEADERS = include/gmock/gmock.h \
include/gmock/gmock-generated-nice-strict.h \
include/gmock/gmock-matchers.h \
include/gmock/gmock-more-actions.h \
include/gmock/gmock-printers.h \
include/gmock/gmock-spec-builders.h

pkginclude_internaldir = $(pkgincludedir)/internal
Expand Down Expand Up @@ -76,15 +75,26 @@ test_gmock_link_test_SOURCES = test/gmock_link_test.cc \
test/gmock_link_test.h
test_gmock_link_test_LDADD = $(GTEST_LIBS) lib/libgmock_main.la

# Tests that fused gmock files compile and work.
TESTS += test/gmock_fused_test
check_PROGRAMS += test/gmock_fused_test
test_gmock_fused_test_SOURCES = fused-src/gmock-gtest-all.cc \
fused-src/gmock_main.cc \
fused-src/gmock/gmock.h \
fused-src/gtest/gtest.h \
test/gmock_test.cc
test_gmock_fused_test_CPPFLAGS = -I"$(srcdir)/fused-src"

# Google Mock source files that we don't compile directly.
EXTRA_DIST += \
GMOCK_SOURCE_INGLUDES = \
src/gmock.cc \
src/gmock-cardinalities.cc \
src/gmock-internal-utils.cc \
src/gmock-matchers.cc \
src/gmock-printers.cc \
src/gmock-spec-builders.cc

EXTRA_DIST += $(GMOCK_SOURCE_INGLUDES)

# C++ tests that we don't compile using autotools.
EXTRA_DIST += \
test/gmock_all_test.cc \
Expand All @@ -98,9 +108,7 @@ EXTRA_DIST += \
test/gmock-matchers_test.cc \
test/gmock-more-actions_test.cc \
test/gmock-nice-strict_test.cc \
test/gmock-port_test.cc \
test/gmock-printers_test.cc \
test/gmock_test.cc
test/gmock-port_test.cc

# Python tests, which we don't run using autotools.
EXTRA_DIST += \
Expand All @@ -126,9 +134,7 @@ EXTRA_DIST += include/gmock/gmock-generated-actions.h.pump \
include/gmock/internal/gmock-generated-internal-utils.h.pump

# Script for fusing Google Mock and Google Test source files.
EXTRA_DIST += \
scripts/fuse_gmock_files.py \
scripts/test/Makefile
EXTRA_DIST += scripts/fuse_gmock_files.py

# The Google Mock Generator tool from the cppclean project.
EXTRA_DIST += \
Expand All @@ -152,3 +158,30 @@ EXTRA_DIST += \
msvc/gmock_main.vcproj \
msvc/gmock-spec-builders_test.vcproj \
msvc/gmock_test.vcproj

# gmock_test.cc does not really depend on files generated by the
# fused-gmock-internal rule. However, gmock_test.o does, and it is
# important to include test/gmock_test.cc as part of this rule in order to
# prevent compiling gmock_test.o until all dependent files have been
# generated.
$(test_gmock_fused_test_SOURCES): fused-gmock-internal

# TODO(vladl@google.com): Find a way to add Google Tests's sources here.
fused-gmock-internal: $(pkginclude_HEADERS) $(pkginclude_internal_HEADERS) \
$(lib_libgmock_la_SOURCES) $(GMOCK_SOURCE_INGLUDES) \
$(lib_libgmock_main_la_SOURCES) \
scripts/fuse_gmock_files.py
mkdir -p "$(srcdir)/fused-src"
chmod -R u+w "$(srcdir)/fused-src"
rm -f "$(srcdir)/fused-src/gtest/gtest.h"
rm -f "$(srcdir)/fused-src/gmock/gmock.h"
rm -f "$(srcdir)/fused-src/gmock-gtest-all.cc"
"$(srcdir)/scripts/fuse_gmock_files.py" "$(srcdir)/fused-src"
cp -f "$(srcdir)/src/gmock_main.cc" "$(srcdir)/fused-src"

maintainer-clean-local:
rm -rf "$(srcdir)/fused-src"

# Death tests may produce core dumps in the build directory. In case
# this happens, clean them to keep distcleancheck happy.
CLEANFILES = core
Loading

0 comments on commit eac1cd2

Please sign in to comment.