Googletest export

Internal Change

PiperOrigin-RevId: 258824657
This commit is contained in:
misterg 2019-07-18 15:41:52 -04:00 committed by Andy Getz
parent b77e5c7625
commit 0a5efc11e3

View File

@ -2,16 +2,16 @@
## Contributor License Agreements ## Contributor License Agreements
We'd love to accept your patches! Before we can take them, we We'd love to accept your patches! Before we can take them, we have to jump a
have to jump a couple of legal hurdles. couple of legal hurdles.
Please fill out either the individual or corporate Contributor License Agreement Please fill out either the individual or corporate Contributor License Agreement
(CLA). (CLA).
* If you are an individual writing original source code and you're sure you * If you are an individual writing original source code and you're sure you
own the intellectual property, then you'll need to sign an own the intellectual property, then you'll need to sign an
[individual CLA](https://developers.google.com/open-source/cla/individual). [individual CLA](https://developers.google.com/open-source/cla/individual).
* If you work for a company that wants to allow you to contribute your work, * If you work for a company that wants to allow you to contribute your work,
then you'll need to sign a then you'll need to sign a
[corporate CLA](https://developers.google.com/open-source/cla/corporate). [corporate CLA](https://developers.google.com/open-source/cla/corporate).
@ -20,144 +20,139 @@ instructions for how to sign and return it. Once we receive it, we'll be able to
accept your pull requests. accept your pull requests.
## Are you a Googler? ## Are you a Googler?
If you are a Googler, plese make an attempt to submit an internal change rather
than a GitHub Pull Request. If you are not able to submit an internal change
a PR is acceptable as an alternative.
If you are a Googler, plese make an attempt to submit an internal change rather
than a GitHub Pull Request. If you are not able to submit an internal change a
PR is acceptable as an alternative.
## Contributing A Patch ## Contributing A Patch
1. Submit an issue describing your proposed change to the 1. Submit an issue describing your proposed change to the
[issue tracker](https://github.com/google/googletest). [issue tracker](https://github.com/google/googletest).
1. Please don't mix more than one logical change per submittal, 1. Please don't mix more than one logical change per submittal, because it
because it makes the history hard to follow. If you want to make a makes the history hard to follow. If you want to make a change that doesn't
change that doesn't have a corresponding issue in the issue have a corresponding issue in the issue tracker, please create one.
tracker, please create one. 1. Also, coordinate with team members that are listed on the issue in question.
1. Also, coordinate with team members that are listed on the issue in This ensures that work isn't being duplicated and communicating your plan
question. This ensures that work isn't being duplicated and early also generally leads to better patches.
communicating your plan early also generally leads to better 1. If your proposed change is accepted, and you haven't already done so, sign a
patches. Contributor License Agreement (see details above).
1. If your proposed change is accepted, and you haven't already done so, sign a 1. Fork the desired repo, develop and test your code changes.
Contributor License Agreement (see details above). 1. Ensure that your code adheres to the existing style in the sample to which
1. Fork the desired repo, develop and test your code changes. you are contributing.
1. Ensure that your code adheres to the existing style in the sample to which 1. Ensure that your code has an appropriate set of unit tests which all pass.
you are contributing. 1. Submit a pull request.
1. Ensure that your code has an appropriate set of unit tests which all pass.
1. Submit a pull request.
## The Google Test and Google Mock Communities ## ## The Google Test and Google Mock Communities
The Google Test community exists primarily through the The Google Test community exists primarily through the
[discussion group](http://groups.google.com/group/googletestframework) [discussion group](http://groups.google.com/group/googletestframework) and the
and the GitHub repository. GitHub repository. Likewise, the Google Mock community exists primarily through
Likewise, the Google Mock community exists primarily through their own their own [discussion group](http://groups.google.com/group/googlemock). You are
[discussion group](http://groups.google.com/group/googlemock). definitely encouraged to contribute to the discussion and you can also help us
You are definitely encouraged to contribute to the to keep the effectiveness of the group high by following and promoting the
discussion and you can also help us to keep the effectiveness of the guidelines listed here.
group high by following and promoting the guidelines listed here.
### Please Be Friendly ### ### Please Be Friendly
Showing courtesy and respect to others is a vital part of the Google Showing courtesy and respect to others is a vital part of the Google culture,
culture, and we strongly encourage everyone participating in Google and we strongly encourage everyone participating in Google Test development to
Test development to join us in accepting nothing less. Of course, join us in accepting nothing less. Of course, being courteous is not the same as
being courteous is not the same as failing to constructively disagree failing to constructively disagree with each other, but it does mean that we
with each other, but it does mean that we should be respectful of each should be respectful of each other when enumerating the 42 technical reasons
other when enumerating the 42 technical reasons that a particular that a particular proposal may not be the best choice. There's never a reason to
proposal may not be the best choice. There's never a reason to be be antagonistic or dismissive toward anyone who is sincerely trying to
antagonistic or dismissive toward anyone who is sincerely trying to
contribute to a discussion. contribute to a discussion.
Sure, C++ testing is serious business and all that, but it's also Sure, C++ testing is serious business and all that, but it's also a lot of fun.
a lot of fun. Let's keep it that way. Let's strive to be one of the Let's keep it that way. Let's strive to be one of the friendliest communities in
friendliest communities in all of open source. all of open source.
As always, discuss Google Test in the official GoogleTest discussion group. As always, discuss Google Test in the official GoogleTest discussion group. You
You don't have to actually submit code in order to sign up. Your participation don't have to actually submit code in order to sign up. Your participation
itself is a valuable contribution. itself is a valuable contribution.
## Style ## Style
To keep the source consistent, readable, diffable and easy to merge, To keep the source consistent, readable, diffable and easy to merge, we use a
we use a fairly rigid coding style, as defined by the [google-styleguide](https://github.com/google/styleguide) project. All patches will be expected fairly rigid coding style, as defined by the
to conform to the style outlined [here](https://google.github.io/styleguide/cppguide.html). [google-styleguide](https://github.com/google/styleguide) project. All patches
Use [.clang-format](https://github.com/google/googletest/blob/master/.clang-format) to check your formatting will be expected to conform to the style outlined
[here](https://google.github.io/styleguide/cppguide.html). Use
[.clang-format](https://github.com/google/googletest/blob/master/.clang-format)
to check your formatting
## Requirements for Contributors ### ## Requirements for Contributors
If you plan to contribute a patch, you need to build Google Test, If you plan to contribute a patch, you need to build Google Test, Google Mock,
Google Mock, and their own tests from a git checkout, which has and their own tests from a git checkout, which has further requirements:
further requirements:
* [Python](https://www.python.org/) v2.3 or newer (for running some of * [Python](https://www.python.org/) v2.3 or newer (for running some of the
the tests and re-generating certain source files from templates) tests and re-generating certain source files from templates)
* [CMake](https://cmake.org/) v2.6.4 or newer * [CMake](https://cmake.org/) v2.6.4 or newer
* [GNU Build System](https://en.wikipedia.org/wiki/GNU_Build_System) * [GNU Build System](https://en.wikipedia.org/wiki/GNU_Build_System) including
including automake (>= 1.9), autoconf (>= 2.59), and automake (>= 1.9), autoconf (>= 2.59), and libtool / libtoolize.
libtool / libtoolize.
## Developing Google Test ## ## Developing Google Test
This section discusses how to make your own changes to Google Test. This section discusses how to make your own changes to Google Test.
### Testing Google Test Itself ### ### Testing Google Test Itself
To make sure your changes work as intended and don't break existing To make sure your changes work as intended and don't break existing
functionality, you'll want to compile and run Google Test's own tests. functionality, you'll want to compile and run Google Test's own tests. For that
For that you can use CMake: you can use CMake:
mkdir mybuild mkdir mybuild
cd mybuild cd mybuild
cmake -Dgtest_build_tests=ON ${GTEST_DIR} cmake -Dgtest_build_tests=ON ${GTEST_DIR}
Make sure you have Python installed, as some of Google Test's tests Make sure you have Python installed, as some of Google Test's tests are written
are written in Python. If the cmake command complains about not being in Python. If the cmake command complains about not being able to find Python
able to find Python (`Could NOT find PythonInterp (missing: (`Could NOT find PythonInterp (missing: PYTHON_EXECUTABLE)`), try telling it
PYTHON_EXECUTABLE)`), try telling it explicitly where your Python explicitly where your Python executable can be found:
executable can be found:
cmake -DPYTHON_EXECUTABLE=path/to/python -Dgtest_build_tests=ON ${GTEST_DIR} cmake -DPYTHON_EXECUTABLE=path/to/python -Dgtest_build_tests=ON ${GTEST_DIR}
Next, you can build Google Test and all of its own tests. On \*nix, Next, you can build Google Test and all of its own tests. On \*nix, this is
this is usually done by 'make'. To run the tests, do usually done by 'make'. To run the tests, do
make test make test
All tests should pass. All tests should pass.
### Regenerating Source Files ## ### Regenerating Source Files
Some of Google Test's source files are generated from templates (not Some of Google Test's source files are generated from templates (not in the C++
in the C++ sense) using a script. sense) using a script. For example, the file
For example, the include/gtest/internal/gtest-type-util.h.pump is used to generate
file include/gtest/internal/gtest-type-util.h.pump is used to generate
gtest-type-util.h in the same directory. gtest-type-util.h in the same directory.
You don't need to worry about regenerating the source files You don't need to worry about regenerating the source files unless you need to
unless you need to modify them. You would then modify the modify them. You would then modify the corresponding `.pump` files and run the
corresponding `.pump` files and run the '[pump.py](googletest/scripts/pump.py)' '[pump.py](googletest/scripts/pump.py)' generator script. See the
generator script. See the [Pump Manual](googletest/docs/PumpManual.md). [Pump Manual](googletest/g3doc/PumpManual.md).
## Developing Google Mock ### ## Developing Google Mock
This section discusses how to make your own changes to Google Mock. This section discusses how to make your own changes to Google Mock.
#### Testing Google Mock Itself #### #### Testing Google Mock Itself
To make sure your changes work as intended and don't break existing To make sure your changes work as intended and don't break existing
functionality, you'll want to compile and run Google Test's own tests. functionality, you'll want to compile and run Google Test's own tests. For that
For that you'll need Autotools. First, make sure you have followed you'll need Autotools. First, make sure you have followed the instructions above
the instructions above to configure Google Mock. to configure Google Mock. Then, create a build output directory and enter it.
Then, create a build output directory and enter it. Next, Next,
${GMOCK_DIR}/configure # try --help for more info ${GMOCK_DIR}/configure # try --help for more info
Once you have successfully configured Google Mock, the build steps are Once you have successfully configured Google Mock, the build steps are standard
standard for GNU-style OSS packages. for GNU-style OSS packages.
make # Standard makefile following GNU conventions make # Standard makefile following GNU conventions
make check # Builds and runs all tests - all should pass. make check # Builds and runs all tests - all should pass.
Note that when building your project against Google Mock, you are building Note that when building your project against Google Mock, you are building
against Google Test as well. There is no need to configure Google Test against Google Test as well. There is no need to configure Google Test
separately. separately.