diff options
author | Abseil Team <absl-team@google.com> | 2021-09-20 16:34:56 (GMT) |
---|---|---|
committer | dinord <dinor@google.com> | 2021-09-23 23:31:14 (GMT) |
commit | 0570d97fb684452c96327e5e6e5ae02c14dbca29 (patch) | |
tree | aad98d73fcbca4509d33eeaf0fb847c7677a1dbd /googletest/src | |
parent | de34ef4e4c6cbfeff9310898d3a773f037ad46f0 (diff) | |
download | googletest-0570d97fb684452c96327e5e6e5ae02c14dbca29.zip googletest-0570d97fb684452c96327e5e6e5ae02c14dbca29.tar.gz googletest-0570d97fb684452c96327e5e6e5ae02c14dbca29.tar.bz2 |
Googletest export
Do not attempt to continue running a test suite if it already failed during
`SetUpTestSuite`.
The suite already failed and running the tests might just add noise to the run, or even crash the process unnecessarily.
Fixes #2187
PiperOrigin-RevId: 397770405
Diffstat (limited to 'googletest/src')
-rw-r--r-- | googletest/src/gtest.cc | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/googletest/src/gtest.cc b/googletest/src/gtest.cc index ece0881..44d5d5b 100644 --- a/googletest/src/gtest.cc +++ b/googletest/src/gtest.cc @@ -3033,10 +3033,16 @@ void TestSuite::Run() { internal::HandleExceptionsInMethodIfSupported( this, &TestSuite::RunSetUpTestSuite, "SetUpTestSuite()"); + const bool skip_all = ad_hoc_test_result().Failed(); + start_timestamp_ = internal::GetTimeInMillis(); internal::Timer timer; for (int i = 0; i < total_test_count(); i++) { - GetMutableTestInfo(i)->Run(); + if (skip_all) { + GetMutableTestInfo(i)->Skip(); + } else { + GetMutableTestInfo(i)->Run(); + } if (GTEST_FLAG_GET(fail_fast) && GetMutableTestInfo(i)->result()->Failed()) { for (int j = i + 1; j < total_test_count(); j++) { |