Skip to content

Commit f9df3e4

Browse files
committed
Merge branch 'master' into remove-gtest-type-util.pump
2 parents 973c777 + a648da9 commit f9df3e4

27 files changed

+166
-350
lines changed

BUILD.bazel

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@
3030
#
3131
# Bazel Build for Google C++ Testing Framework(Google Test)
3232

33+
load("@rules_cc//cc:defs.bzl", "cc_library", "cc_test")
34+
3335
package(default_visibility = ["//visibility:public"])
3436

3537
licenses(["notice"])
@@ -81,6 +83,10 @@ cc_library(
8183
":has_absl": ["GTEST_HAS_ABSL=1"],
8284
"//conditions:default": [],
8385
}),
86+
features = select({
87+
":windows": ["windows_export_all_symbols"],
88+
"//conditions:default": [],
89+
}),
8490
includes = [
8591
"googlemock",
8692
"googlemock/include",
@@ -102,20 +108,16 @@ cc_library(
102108
],
103109
"//conditions:default": [],
104110
}),
105-
features = select({
106-
":windows": ["windows_export_all_symbols"],
107-
"//conditions:default": [],
108-
})
109111
)
110112

111113
cc_library(
112114
name = "gtest_main",
113115
srcs = ["googlemock/src/gmock_main.cc"],
114-
deps = [":gtest"],
115116
features = select({
116117
":windows": ["windows_export_all_symbols"],
117118
"//conditions:default": [],
118-
})
119+
}),
120+
deps = [":gtest"],
119121
)
120122

121123
# The following rules build samples of how to use gTest.
@@ -136,7 +138,7 @@ cc_library(
136138
features = select({
137139
":windows": ["windows_export_all_symbols"],
138140
"//conditions:default": [],
139-
})
141+
}),
140142
)
141143

142144
cc_test(
@@ -155,11 +157,11 @@ cc_test(
155157
"googletest/samples/sample7_unittest.cc",
156158
"googletest/samples/sample8_unittest.cc",
157159
],
160+
linkstatic = 0,
158161
deps = [
159162
"gtest_sample_lib",
160163
":gtest_main",
161164
],
162-
linkstatic = 0,
163165
)
164166

165167
cc_test(

CONTRIBUTING.md

Lines changed: 19 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -90,32 +90,40 @@ and their own tests from a git checkout, which has further requirements:
9090
* [Python](https://www.python.org/) v2.3 or newer (for running some of the
9191
tests and re-generating certain source files from templates)
9292
* [CMake](https://cmake.org/) v2.6.4 or newer
93-
* [GNU Build System](https://en.wikipedia.org/wiki/GNU_Build_System) including
94-
automake (>= 1.9), autoconf (>= 2.59), and libtool / libtoolize.
9593

96-
## Developing Google Test
94+
## Developing Google Test and Google Mock
9795

98-
This section discusses how to make your own changes to Google Test.
96+
This section discusses how to make your own changes to the Google Test project.
9997

100-
### Testing Google Test Itself
98+
### Testing Google Test and Google Mock Themselves
10199

102100
To make sure your changes work as intended and don't break existing
103-
functionality, you'll want to compile and run Google Test's own tests. For that
104-
you can use CMake:
101+
functionality, you'll want to compile and run Google Test and GoogleMock's own
102+
tests. For that you can use CMake:
105103

106104
mkdir mybuild
107105
cd mybuild
108-
cmake -Dgtest_build_tests=ON ${GTEST_DIR}
106+
cmake -Dgtest_build_tests=ON -Dgmock_build_tests=ON ${GTEST_REPO_DIR}
107+
108+
To choose between building only Google Test or Google Mock, you may modify your
109+
cmake command to be one of each
110+
111+
cmake -Dgtest_build_tests=ON ${GTEST_DIR} # sets up Google Test tests
112+
cmake -Dgmock_build_tests=ON ${GMOCK_DIR} # sets up Google Mock tests
109113

110114
Make sure you have Python installed, as some of Google Test's tests are written
111115
in Python. If the cmake command complains about not being able to find Python
112116
(`Could NOT find PythonInterp (missing: PYTHON_EXECUTABLE)`), try telling it
113117
explicitly where your Python executable can be found:
114118

115-
cmake -DPYTHON_EXECUTABLE=path/to/python -Dgtest_build_tests=ON ${GTEST_DIR}
119+
cmake -DPYTHON_EXECUTABLE=path/to/python ...
120+
121+
Next, you can build Google Test and / or Google Mock and all desired tests. On
122+
\*nix, this is usually done by
123+
124+
make
116125

117-
Next, you can build Google Test and all of its own tests. On \*nix, this is
118-
usually done by 'make'. To run the tests, do
126+
To run the tests, do
119127

120128
make test
121129

@@ -132,27 +140,3 @@ You don't need to worry about regenerating the source files unless you need to
132140
modify them. You would then modify the corresponding `.pump` files and run the
133141
'[pump.py](googlemock/scripts/pump.py)' generator script. See the
134142
[Pump Manual](googlemock/docs/pump_manual.md).
135-
136-
## Developing Google Mock
137-
138-
This section discusses how to make your own changes to Google Mock.
139-
140-
#### Testing Google Mock Itself
141-
142-
To make sure your changes work as intended and don't break existing
143-
functionality, you'll want to compile and run Google Test's own tests. For that
144-
you'll need Autotools. First, make sure you have followed the instructions above
145-
to configure Google Mock. Then, create a build output directory and enter it.
146-
Next,
147-
148-
${GMOCK_DIR}/configure # try --help for more info
149-
150-
Once you have successfully configured Google Mock, the build steps are standard
151-
for GNU-style OSS packages.
152-
153-
make # Standard makefile following GNU conventions
154-
make check # Builds and runs all tests - all should pass.
155-
156-
Note that when building your project against Google Mock, you are building
157-
against Google Test as well. There is no need to configure Google Test
158-
separately.

WORKSPACE

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,16 @@ http_archive(
88
urls = ["https://github.com/abseil/abseil-cpp/archive/master.zip"],
99
strip_prefix = "abseil-cpp-master",
1010
)
11+
12+
http_archive(
13+
name = "rules_cc",
14+
strip_prefix = "rules_cc-master",
15+
urls = ["https://github.com/bazelbuild/rules_cc/archive/master.zip"],
16+
)
17+
18+
http_archive(
19+
name = "rules_python",
20+
strip_prefix = "rules_python-master",
21+
urls = ["https://github.com/bazelbuild/rules_python/archive/master.zip"],
22+
)
23+

appveyor.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ install:
5858
5959
# install Bazel
6060
if ($env:build_system -eq "bazel") {
61-
appveyor DownloadFile https://github.com/bazelbuild/bazel/releases/download/0.21.0/bazel-0.21.0-windows-x86_64.exe -FileName bazel.exe
61+
appveyor DownloadFile https://github.com/bazelbuild/bazel/releases/download/0.28.1/bazel-0.28.1-windows-x86_64.exe -FileName bazel.exe
6262
}
6363
6464
if ($env:build_system -eq "cmake") {

ci/build-linux-bazel.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131

3232
set -e
3333

34+
bazel version
3435
bazel build --curses=no //...:all
3536
bazel test --curses=no //...:all
3637
bazel test --curses=no //...:all --define absl=1

googlemock/CMakeLists.txt

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,14 @@ $env:Path = \"$project_bin;$env:Path\"
150150
& $args")
151151
endif()
152152

153+
if (MINGW OR CYGWIN)
154+
if (CMAKE_VERSION VERSION_LESS "2.8.12")
155+
add_compile_options("-Wa,-mbig-obj")
156+
else()
157+
add_definitions("-Wa,-mbig-obj")
158+
endif()
159+
endif()
160+
153161
############################################################
154162
# C++ tests built with standard compiler flags.
155163

@@ -162,9 +170,6 @@ $env:Path = \"$project_bin;$env:Path\"
162170
cxx_test(gmock-generated-matchers_test gmock_main)
163171
cxx_test(gmock-internal-utils_test gmock_main)
164172
cxx_test(gmock-matchers_test gmock_main)
165-
if (MINGW OR CYGWIN)
166-
target_compile_options(gmock-matchers_test PRIVATE "-Wa,-mbig-obj")
167-
endif()
168173
cxx_test(gmock-more-actions_test gmock_main)
169174
cxx_test(gmock-nice-strict_test gmock_main)
170175
cxx_test(gmock-port_test gmock_main)

googlemock/docs/cheat_sheet.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -312,8 +312,9 @@ The `argument` can be either a C string or a C++ string object:
312312
313313
`ContainsRegex()` and `MatchesRegex()` take ownership of the `RE` object. They
314314
use the regular expression syntax defined
315-
[here](advanced.md#regular-expression-syntax). `StrCaseEq()`, `StrCaseNe()`,
316-
`StrEq()`, and `StrNe()` work for wide strings as well.
315+
[here](../../googletest/docs/advanced.md#regular-expression-syntax).
316+
`StrCaseEq()`, `StrCaseNe()`, `StrEq()`, and `StrNe()` work for wide strings as
317+
well.
317318
318319
#### Container Matchers
319320

googlemock/docs/cook_book.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ class MockStack : public StackInterface<Elem> {
178178
#### Mocking Non-virtual Methods {#MockingNonVirtualMethods}
179179

180180
gMock can mock non-virtual functions to be used in Hi-perf dependency
181-
injection.[See this](http://go/tott/33).
181+
injection.<!-- GOOGLETEST_CM0017 DO NOT DELETE -->
182182

183183
In this case, instead of sharing a common base class with the real class, your
184184
mock class will be *unrelated* to the real class, but contain methods with the

googlemock/docs/for_dummies.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,8 @@ EXPECT_CALL(turtle, GoTo);
396396
397397
This works for all non-overloaded methods; if a method is overloaded, you need
398398
to help gMock resolve which overload is expected by specifying the number of
399-
arguments and possibly also the [types of the arguments](#SelectOverload).
399+
arguments and possibly also the
400+
[types of the arguments](cook_book.md#SelectOverload).
400401
401402
#### Cardinalities: How Many Times Will It Be Called?
402403
@@ -482,7 +483,7 @@ the *default* action for the function every time (unless, of course, you have a
482483
483484
What can we do inside `WillOnce()` besides `Return()`? You can return a
484485
reference using `ReturnRef(*variable*)`, or invoke a pre-defined function, among
485-
[others](#ActionList).
486+
[others](cook_book.md#using-actions).
486487
487488
**Important note:** The `EXPECT_CALL()` statement evaluates the action clause
488489
only once, even though the action may be performed many times. Therefore you
@@ -560,7 +561,7 @@ overloaded). This makes any calls to the method expected. This is not necessary
560561
for methods that are not mentioned at all (these are "uninteresting"), but is
561562
useful for methods that have some expectations, but for which other calls are
562563
ok. See
563-
[Understanding Uninteresting vs Unexpected Calls](#uninteresting-vs-unexpected).
564+
[Understanding Uninteresting vs Unexpected Calls](cook_book.md#uninteresting-vs-unexpected).
564565

565566
#### Ordered vs Unordered Calls {#OrderedCalls}
566567

googlemock/include/gmock/gmock-actions.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -532,7 +532,7 @@ class ReturnAction {
532532
// in the Impl class. But both definitions must be the same.
533533
typedef typename Function<F>::Result Result;
534534
GTEST_COMPILE_ASSERT_(
535-
!is_reference<Result>::value,
535+
!std::is_reference<Result>::value,
536536
use_ReturnRef_instead_of_Return_to_return_a_reference);
537537
static_assert(!std::is_void<Result>::value,
538538
"Can't use Return() on an action expected to return `void`.");
@@ -561,7 +561,7 @@ class ReturnAction {
561561
Result Perform(const ArgumentTuple&) override { return value_; }
562562

563563
private:
564-
GTEST_COMPILE_ASSERT_(!is_reference<Result>::value,
564+
GTEST_COMPILE_ASSERT_(!std::is_reference<Result>::value,
565565
Result_cannot_be_a_reference_type);
566566
// We save the value before casting just in case it is being cast to a
567567
// wrapper type.
@@ -640,7 +640,7 @@ class ReturnRefAction {
640640
// Asserts that the function return type is a reference. This
641641
// catches the user error of using ReturnRef(x) when Return(x)
642642
// should be used, and generates some helpful error message.
643-
GTEST_COMPILE_ASSERT_(internal::is_reference<Result>::value,
643+
GTEST_COMPILE_ASSERT_(std::is_reference<Result>::value,
644644
use_Return_instead_of_ReturnRef_to_return_a_value);
645645
return Action<F>(new Impl<F>(ref_));
646646
}
@@ -687,7 +687,7 @@ class ReturnRefOfCopyAction {
687687
// catches the user error of using ReturnRefOfCopy(x) when Return(x)
688688
// should be used, and generates some helpful error message.
689689
GTEST_COMPILE_ASSERT_(
690-
internal::is_reference<Result>::value,
690+
std::is_reference<Result>::value,
691691
use_Return_instead_of_ReturnRefOfCopy_to_return_a_value);
692692
return Action<F>(new Impl<F>(value_));
693693
}

0 commit comments

Comments
 (0)