How to get the googletest and googlemock version at run-time?

5,114 views
Skip to first unread message

Rob

unread,
Apr 14, 2011, 5:06:36 PM4/14/11
to googl...@googlegroups.com
Hi,

Is there a way to have googletest and googlemock print out their versions (say 1.5.0) when you run the tests?
Or read the version from the libraries and print them out yourself?

Thanks,
Rob

Keith Ray

unread,
Apr 15, 2011, 8:27:46 AM4/15/11
to googl...@googlegroups.com, Rob
I don't see any --gtest_version flag (or --gmock_version flag, though I didn't actually look for that one), but you have the source code, you can add them and submit the changes.

$ someAppUsingGTest --gtest_help
Running main() from gtest_main.cc
This program contains tests written using Google Test. You can use the
following command line flags to control its behavior:

Test Selection:
  --gtest_list_tests
      List the names of all tests instead of running them. The name of
      TEST(Foo, Bar) is "Foo.Bar".
  --gtest_filter=POSTIVE_PATTERNS[-NEGATIVE_PATTERNS]
      Run only the tests whose name matches one of the positive patterns but
      none of the negative patterns. '?' matches any single character; '*'
      matches any substring; ':' separates two patterns.
  --gtest_also_run_disabled_tests
      Run all disabled tests too.

Test Execution:
  --gtest_repeat=[COUNT]
      Run the tests repeatedly; use a negative count to repeat forever.
  --gtest_shuffle
      Randomize tests' orders on every iteration.
  --gtest_random_seed=[NUMBER]
      Random number seed to use for shuffling test orders (between 1 and
      99999, or 0 to use a seed based on the current time).

Test Output:
  --gtest_color=(yes|no|auto)
      Enable/disable colored output. The default is auto.
  --gtest_print_time=0
      Don't print the elapsed time of each test.
  --gtest_output=xml[:DIRECTORY_PATH/|:FILE_PATH]
      Generate an XML report in the given directory or with the given file
      name. FILE_PATH defaults to test_details.xml.

Assertion Behavior:
  --gtest_death_test_style=(fast|threadsafe)
      Set the default death test style.
  --gtest_break_on_failure
      Turn assertion failures into debugger break-points.
  --gtest_throw_on_failure
      Turn assertion failures into C++ exceptions.

Except for --gtest_list_tests, you can alternatively set the corresponding
environment variable of a flag (all letters in upper-case). For example, to
disable colored text output, you can either specify --gtest_color=no or set
the GTEST_COLOR environment variable to no.

For more information, please read the Google Test documentation at
http://code.google.com/p/googletest/. If you find a bug in Google Test
(not one in your own code or tests), please report it to
--
C. Keith Ray

Coach, Trainer, and Developer at Industrial logic, Inc.
http://industriallogic.com  "Amplify Your Agility"
Coaching and Live- and Web-based Training

Martin Svensson

unread,
Apr 15, 2011, 8:46:26 AM4/15/11
to Rob, googl...@googlegroups.com

On Fri, Apr 15, 2011 at 5:06 AM, Rob <robmccu...@gmail.com> wrote:
Hi,

Is there a way to have googletest and googlemock print out their versions (say 1.5.0) when you run the tests?
Or read the version from the libraries and print them out yourself?

Thanks,
Rob

I don't use googletest, but for googlemock maybe gmock-config can help you?

" Installation Queries:
  --prefix                   installation prefix
  --exec-prefix              executable installation prefix
  --libdir                   library installation directory
  --includedir               header file installation directory
  --version                  the version of the Google Mock installation"

/Martin Svensson

Reply all
Reply to author
Forward
0 new messages