Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(77)

Side by Side Diff: testing/gmock/README

Issue 1151006: Update to current gtest/gmock. (Closed)
Patch Set: rebase Created 10 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « testing/gmock/Makefile.am ('k') | testing/gmock/configure.ac » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 Google C++ Mocking Framework 1 Google C++ Mocking Framework
2 ============================ 2 ============================
3 http://code.google.com/p/googlemock/ 3 http://code.google.com/p/googlemock/
4 4
5 Overview 5 Overview
6 -------- 6 --------
7 Google's framework for writing and using C++ mock classes on Linux, 7 Google's framework for writing and using C++ mock classes on Linux,
8 Mac OS X, and Windows. Inspired by jMock, EasyMock, and Hamcrest, and 8 Mac OS X, and Windows. Inspired by jMock, EasyMock, and Hamcrest, and
9 designed with C++'s specifics in mind, it can help you derive better 9 designed with C++'s specifics in mind, it can help you derive better
10 designs of your system and write better tests. 10 designs of your system and write better tests.
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 supported. The only hard restriction is that while the build directory can be 170 supported. The only hard restriction is that while the build directory can be
171 a subdirectory of the source directory, the opposite is not possible and will 171 a subdirectory of the source directory, the opposite is not possible and will
172 result in errors. Once you have selected where you wish to build Google Mock, 172 result in errors. Once you have selected where you wish to build Google Mock,
173 create the directory if necessary, and enter it. The following steps apply for 173 create the directory if necessary, and enter it. The following steps apply for
174 either approach by simply substituting the shell variable SRCDIR with "." for 174 either approach by simply substituting the shell variable SRCDIR with "." for
175 building inside the source directory, and the relative path to the source 175 building inside the source directory, and the relative path to the source
176 directory otherwise. 176 directory otherwise.
177 177
178 ${SRCDIR}/configure # Standard GNU configure script, --help for more info 178 ${SRCDIR}/configure # Standard GNU configure script, --help for more info
179 179
180 The default behavior of the configure script with respect to locating and using
181 Google Test is to first search for a 'gtest-config' in the system path, and
182 lacking this, build an internal copy of Google Test. You may optionally specify
183 a custom Google Test you wish to build Google Mock against, provided it is
184 a new enough version.
185
186 # Configure against an installation in '/opt' with '/opt/bin/gtest-config'.
187 ${SRCDIR}/configure --with-gtest=/opt
188
189 This can also be used to specify a Google Test which hasn't yet been installed.
190 However, it must have been configured and built as described in the Google Test
191 README before you configure Google Mock. To enable this feature, simply pass
192 the directory where you configured and built Google Test (which is not
193 necessarily its source directory) to Google Mock's configure script.
194
195 # Configure against a build of Google Test in an arbitrary directory.
196 ${SRCDIR}/configure --with-gtest=../../my_gtest_build
197
198 Finally, if you have a version of Google Test installed but for some reason
199 wish to forcibly prevent it from being used, we provide a special option.
200 Typically this is not needed as we fall back to the internal Google Test
201 packaged with Google Mock if an installed version is either unavailable or too
202 old to build Google Mock. When using the internally packaged Google Test, the
203 user does *not* need to configure or build it, that is automatically handled by
204 Google Mock's build system.
205
206 # Force the use of the internally packaged Google Test, despite
207 # 'gtest-config' being in your PATH.
208 ${SRCDIR}/configure --disable-external-gtest
209
210 Once you have successfully configured Google Mock, the build steps are standard 180 Once you have successfully configured Google Mock, the build steps are standard
211 for GNU-style OSS packages. 181 for GNU-style OSS packages.
212 182
213 make # Standard makefile following GNU conventions 183 make # Standard makefile following GNU conventions
214 make check # Builds and runs all tests - all should pass 184 make check # Builds and runs all tests - all should pass
215 185
216 Other programs will only be able to use Google Mock's functionality if you
217 install it in a location which they can access, in Linux this is typically
218 under '/usr/local'. The following command will install all of the Google Mock
219 libraries, public headers, and utilities necessary for other programs and
220 libraries to leverage it. Note that if Google Mock was unable to find an
221 external Google Test to build against, it will also install the internally
222 packaged Google Test in order to allow the installed Google Mock to function
223 properly. This Google Test install will be fully functional, and if installed
224 will also be uninstalled by uninstalling Google Mock.
225
226 sudo make install # Not necessary, but allows use by other programs
227
228 Should you need to remove Google Mock from your system after having installed
229 it, run the following command, and it will back out its changes. However, note
230 carefully that you must run this command on the *same* Google Mock build that
231 you ran the install from, or the results are not predictable. If you install
232 Google Mock on your system, and are working from a VCS checkout, make sure you
233 run this *before* updating your checkout of the source in order to uninstall
234 the same version which you installed.
235
236 sudo make uninstall # Must be run against the exact same build as "install"
237
238 Your project can build against Google Mock and Google Test simply by leveraging
239 the 'gmock-config' script. This script can be invoked directly out of the
240 'scripts' subdirectory of the build tree, and it will be installed in the
241 binary directory specified during the 'configure'. Here are some examples of
242 its use, see 'gmock-config --help' for more detailed information.
243
244 gmock-config --min-version=1.0 || echo "Insufficient Google Mock version."
245
246 g++ $(gmock-config --cppflags --cxxflags) -o foo.o -c foo.cpp
247 g++ $(gmock-config --ldflags --libs) -o foo foo.o
248
249 # When using a built but not installed Google Mock:
250 g++ $(../../my_gmock_build/scripts/gmock-config ...) ...
251
252 Note that when building your project against Google Mock, you are building 186 Note that when building your project against Google Mock, you are building
253 against Google Test as well. There is no need to configure Google Test 187 against Google Test as well. There is no need to configure Google Test
254 separately. 188 separately.
255 189
256 ### Windows ### 190 ### Windows ###
257 The msvc/ directory contains VC++ 2005 projects for building Google 191 The msvc/ directory contains VC++ 2005 projects for building Google
258 Mock and selected tests. 192 Mock and selected tests.
259 193
260 If you want to use a version of Google Test other then the one bundled with 194 If you want to use a version of Google Test other then the one bundled with
261 Google Mock, change the value of the GTestDir macro in gmock_config.vsprop 195 Google Mock, change the value of the GTestDir macro in gmock_config.vsprop
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 Normally you don't need to worry about regenerating the source files, 253 Normally you don't need to worry about regenerating the source files,
320 unless you need to modify them (e.g. if you are working on a patch for 254 unless you need to modify them (e.g. if you are working on a patch for
321 Google Mock). In that case, you should modify the corresponding .pump 255 Google Mock). In that case, you should modify the corresponding .pump
322 files instead and run the 'pump' script (for Pump is Useful for Meta 256 files instead and run the 'pump' script (for Pump is Useful for Meta
323 Programming) to regenerate them. We are still working on releasing 257 Programming) to regenerate them. We are still working on releasing
324 the script and its documentation. If you need it now, please email 258 the script and its documentation. If you need it now, please email
325 googlemock@googlegroups.com such that we know to make it happen 259 googlemock@googlegroups.com such that we know to make it happen
326 sooner. 260 sooner.
327 261
328 Happy testing! 262 Happy testing!
OLDNEW
« no previous file with comments | « testing/gmock/Makefile.am ('k') | testing/gmock/configure.ac » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698