summaryrefslogtreecommitdiffstats
path: root/googletest/src/gtest.cc
diff options
context:
space:
mode:
authorAbseil Team <absl-team@google.com>2021-02-17 21:57:09 (GMT)
committerDerek Mauro <dmauro@google.com>2021-02-18 18:27:15 (GMT)
commitdaa0df7b410cfed62ef474446eff22148a272a8d (patch)
tree296a326bdc165b3124371c79331768010eb2fed1 /googletest/src/gtest.cc
parent7fb047bca335375a47ee0c4cddf4ffd92ac02673 (diff)
downloadgoogletest-daa0df7b410cfed62ef474446eff22148a272a8d.zip
googletest-daa0df7b410cfed62ef474446eff22148a272a8d.tar.gz
googletest-daa0df7b410cfed62ef474446eff22148a272a8d.tar.bz2
Googletest export
Explicitly skip tests after fatal global environment setup errors Previously the tests were all skipped, but the resulting output claimed all tests passed. Before: ``` [----------] Global test environment set-up. <failure message> [----------] Global test environment tear-down [==========] 1 test from 1 test suite ran. (83 ms total) [ PASSED ] 1 test. [ FAILED ] 0 tests, listed below: ``` After: ``` [==========] Running 1 test from 1 test suite. [----------] Global test environment set-up. <failure message> [----------] 1 test from SomeTest [ RUN ] SomeTest.DoesFoo <...>: Skipped [ SKIPPED ] SomeTest.DoesFoo (0 ms) [----------] 1 test from SomeTest (0 ms total) [----------] Global test environment tear-down [==========] 1 test from 1 test suite ran. (68 ms total) [ PASSED ] 0 tests. [ SKIPPED ] 1 test, listed below: [ SKIPPED ] SomeTest.DoesFoo [ FAILED ] 0 tests, listed below: ``` PiperOrigin-RevId: 358026389
Diffstat (limited to 'googletest/src/gtest.cc')
-rw-r--r--googletest/src/gtest.cc8
1 files changed, 8 insertions, 0 deletions
diff --git a/googletest/src/gtest.cc b/googletest/src/gtest.cc
index 30e2071..d659e7d 100644
--- a/googletest/src/gtest.cc
+++ b/googletest/src/gtest.cc
@@ -5714,6 +5714,14 @@ bool UnitTestImpl::RunAllTests() {
break;
}
}
+ } else if (Test::HasFatalFailure()) {
+ // If there was a fatal failure during the global setup then we know we
+ // aren't going to run any tests. Explicitly mark all of the tests as
+ // skipped to make this obvious in the output.
+ for (int test_index = 0; test_index < total_test_suite_count();
+ test_index++) {
+ GetMutableSuiteCase(test_index)->Skip();
+ }
}
// Tears down all environments in reverse order afterwards.