Skip entire test suite with GTEST_SKIP()
in SetUpTestSuite
Fixes #4273 PiperOrigin-RevId: 540254167 Change-Id: I2555740d10284223539035bf73f88554fcf73f8a
This commit is contained in:
parent
e9078161e6
commit
4c7aee827e
@ -3019,7 +3019,8 @@ void TestSuite::Run() {
|
||||
internal::HandleExceptionsInMethodIfSupported(
|
||||
this, &TestSuite::RunSetUpTestSuite, "SetUpTestSuite()");
|
||||
|
||||
const bool skip_all = ad_hoc_test_result().Failed();
|
||||
const bool skip_all =
|
||||
ad_hoc_test_result().Failed() || ad_hoc_test_result().Skipped();
|
||||
|
||||
start_timestamp_ = internal::GetTimeInMillis();
|
||||
internal::Timer timer;
|
||||
|
@ -12,7 +12,7 @@ Expected equality of these values:
|
||||
3
|
||||
Stack trace: (omitted)
|
||||
|
||||
[0;32m[==========] [mRunning 89 tests from 42 test suites.
|
||||
[0;32m[==========] [mRunning 90 tests from 43 test suites.
|
||||
[0;32m[----------] [mGlobal test environment set-up.
|
||||
FooEnvironment::SetUp() called.
|
||||
BarEnvironment::SetUp() called.
|
||||
@ -967,6 +967,15 @@ Stack trace: (omitted)
|
||||
googletest-output-test_.cc:#: Skipped
|
||||
|
||||
[0;32m[ SKIPPED ] [mTestSuiteThatFailsToSetUp.ShouldNotRun
|
||||
[0;32m[----------] [m1 test from TestSuiteThatSkipsInSetUp
|
||||
googletest-output-test_.cc:#: Skipped
|
||||
Skip entire test suite
|
||||
Stack trace: (omitted)
|
||||
|
||||
[0;32m[ RUN ] [mTestSuiteThatSkipsInSetUp.ShouldNotRun
|
||||
googletest-output-test_.cc:#: Skipped
|
||||
|
||||
[0;32m[ SKIPPED ] [mTestSuiteThatSkipsInSetUp.ShouldNotRun
|
||||
[0;32m[----------] [m1 test from PrintingFailingParams/FailingParamTest
|
||||
[0;32m[ RUN ] [mPrintingFailingParams/FailingParamTest.Fails/0
|
||||
googletest-output-test_.cc:#: Failure
|
||||
@ -1043,10 +1052,11 @@ Failed
|
||||
Expected fatal failure.
|
||||
Stack trace: (omitted)
|
||||
|
||||
[0;32m[==========] [m89 tests from 42 test suites ran.
|
||||
[0;32m[==========] [m90 tests from 43 test suites ran.
|
||||
[0;32m[ PASSED ] [m31 tests.
|
||||
[0;32m[ SKIPPED ] [m1 test, listed below:
|
||||
[0;32m[ SKIPPED ] [m2 tests, listed below:
|
||||
[0;32m[ SKIPPED ] [mTestSuiteThatFailsToSetUp.ShouldNotRun
|
||||
[0;32m[ SKIPPED ] [mTestSuiteThatSkipsInSetUp.ShouldNotRun
|
||||
[0;31m[ FAILED ] [m57 tests, listed below:
|
||||
[0;31m[ FAILED ] [mNonfatalFailureTest.EscapesStringOperands
|
||||
[0;31m[ FAILED ] [mNonfatalFailureTest.DiffForLongStrings
|
||||
|
@ -1007,6 +1007,12 @@ class TestSuiteThatFailsToSetUp : public testing::Test {
|
||||
};
|
||||
TEST_F(TestSuiteThatFailsToSetUp, ShouldNotRun) { std::abort(); }
|
||||
|
||||
class TestSuiteThatSkipsInSetUp : public testing::Test {
|
||||
public:
|
||||
static void SetUpTestSuite() { GTEST_SKIP() << "Skip entire test suite"; }
|
||||
};
|
||||
TEST_F(TestSuiteThatSkipsInSetUp, ShouldNotRun) { std::abort(); }
|
||||
|
||||
// The main function.
|
||||
//
|
||||
// The idea is to use Google Test to run all the tests we have defined (some
|
||||
|
Loading…
Reference in New Issue
Block a user