summaryrefslogtreecommitdiff
path: root/lib/googletest
diff options
context:
space:
mode:
authorEnji Cooper <ngie@FreeBSD.org>2019-04-01 18:07:48 +0000
committerEnji Cooper <ngie@FreeBSD.org>2019-04-01 18:07:48 +0000
commite9e2022e744c124adbe0372e0822c32d23dac8db (patch)
treee82e708aef96fad1f21efda274e33ca7f2fcffff /lib/googletest
parente1ee62302a50aff33edfd3f8487baee199cab9ec (diff)
downloadsrc-test2-e9e2022e744c124adbe0372e0822c32d23dac8db.tar.gz
src-test2-e9e2022e744c124adbe0372e0822c32d23dac8db.zip
Import proof-of-concept for handling `GTEST_SKIP()` in `Environment::SetUp`
Per the upstream pull-request [1]: ``` gtest prior to this change would completely ignore `GTEST_SKIP()` if called in `Environment::SetUp()`, instead of bailing out early, unlike `Test::SetUp()`, which would cause the tests themselves to be skipped. The only way (prior to this change) to skip the tests would be to trigger a fatal error via `GTEST_FAIL()`. Desirable behavior, in this case, when dealing with `Environment::SetUp()` is to check for prerequisites on a system (example, kernel supports a particular featureset, e.g., capsicum), and skip the tests. The alternatives prior to this change would be undesirable: - Failing sends the wrong message to the test user, as the result of the tests is indeterminate, not failed. - Having to add per-test class abstractions that override `SetUp()` to test for the capsicum feature set, then skip all of the tests in their respective SetUp fixtures, would be a lot of human and computational work; checking for the feature would need to be done for all of the tests, instead of once for all of the tests. For those reasons, making `Environment::SetUp()` handle `GTEST_SKIP()`, by not executing the testcases, is the most desirable solution. In order to properly diagnose what happened when running the tests if they are skipped, print out the diagnostics in an ad hoc manner. Update the documentation to note this change and integrate a new test, gtest_skip_in_environment_setup_test, into the test suite. This change addresses #2189. Signed-off-by: Enji Cooper <yaneurabeya@gmail.com> ``` The goal with my merging in this change is to avoid requiring extensive refactoring/retesting of test suites when ensuring prerequisites are met, e.g., checking for a CAPABILITIES-enabled kernel before running capsicum-test (see D19758 for more details). The proof-of-concept is being imported before accepted by the upstream project due to the fact that the upstream project is undergoing a potential development freeze and the maintainers aren't responding to my PR. 1. https://github.com/google/googletest/pull/2203 Reported by: asomers (https://github.com/google/googletest/issues/2189) Reviewed by: asomers Approved by: emaste (mentor) MFC after: 2 months Differential Revision: https://reviews.freebsd.org/D19765
Notes
Notes: svn path=/head/; revision=345770
Diffstat (limited to 'lib/googletest')
-rw-r--r--lib/googletest/gtest_main/tests/Makefile1
1 files changed, 1 insertions, 0 deletions
diff --git a/lib/googletest/gtest_main/tests/Makefile b/lib/googletest/gtest_main/tests/Makefile
index d7399ebaad4d..8d2e9e68d5e1 100644
--- a/lib/googletest/gtest_main/tests/Makefile
+++ b/lib/googletest/gtest_main/tests/Makefile
@@ -19,6 +19,7 @@ GTESTS+= gtest_sole_header_test
GTESTS+= googletest-test-part-test
GTESTS+= gtest-typed-test_test
GTESTS+= gtest_skip_test
+GTESTS+= gtest_skip_in_environment_setup_test
GTESTS+= gtest_unittest
CXXFLAGS+= -I${GOOGLETEST_SRCROOT}/include