Allow clients to un-suppress output from gUnit EXPECT_EXIT tests.
This is useful for running individual tests in a separate process, which is useful for testing e.g. flag changes which have a process-global effect. PiperOrigin-RevId: 540580573 Change-Id: I18a5d24d79425a9d595be3369efc44e2f655f6f8
This commit is contained in:
parent
4c7aee827e
commit
18fa6a4db3
@ -1055,6 +1055,10 @@ class GTEST_API_ TestEventListeners {
|
|||||||
return default_xml_generator_;
|
return default_xml_generator_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Controls whether events will be forwarded by the repeater to the
|
||||||
|
// listeners in the list.
|
||||||
|
void SuppressEventForwarding(bool);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
friend class TestSuite;
|
friend class TestSuite;
|
||||||
friend class TestInfo;
|
friend class TestInfo;
|
||||||
@ -1084,7 +1088,6 @@ class GTEST_API_ TestEventListeners {
|
|||||||
// Controls whether events will be forwarded by the repeater to the
|
// Controls whether events will be forwarded by the repeater to the
|
||||||
// listeners in the list.
|
// listeners in the list.
|
||||||
bool EventForwardingEnabled() const;
|
bool EventForwardingEnabled() const;
|
||||||
void SuppressEventForwarding();
|
|
||||||
|
|
||||||
// The actual list of listeners.
|
// The actual list of listeners.
|
||||||
internal::TestEventRepeater* repeater_;
|
internal::TestEventRepeater* repeater_;
|
||||||
|
@ -1128,7 +1128,7 @@ DeathTest::TestRole NoExecDeathTest::AssumeRole() {
|
|||||||
LogToStderr();
|
LogToStderr();
|
||||||
// Event forwarding to the listeners of event listener API mush be shut
|
// Event forwarding to the listeners of event listener API mush be shut
|
||||||
// down in death test subprocesses.
|
// down in death test subprocesses.
|
||||||
GetUnitTestImpl()->listeners()->SuppressEventForwarding();
|
GetUnitTestImpl()->listeners()->SuppressEventForwarding(true);
|
||||||
g_in_fast_death_test_child = true;
|
g_in_fast_death_test_child = true;
|
||||||
return EXECUTE_TEST;
|
return EXECUTE_TEST;
|
||||||
} else {
|
} else {
|
||||||
|
@ -5156,8 +5156,8 @@ bool TestEventListeners::EventForwardingEnabled() const {
|
|||||||
return repeater_->forwarding_enabled();
|
return repeater_->forwarding_enabled();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TestEventListeners::SuppressEventForwarding() {
|
void TestEventListeners::SuppressEventForwarding(bool suppress) {
|
||||||
repeater_->set_forwarding_enabled(false);
|
repeater_->set_forwarding_enabled(!suppress);
|
||||||
}
|
}
|
||||||
|
|
||||||
// class UnitTest
|
// class UnitTest
|
||||||
@ -5635,7 +5635,7 @@ void UnitTestImpl::RecordProperty(const TestProperty& test_property) {
|
|||||||
// subprocess. Must not be called before InitGoogleTest.
|
// subprocess. Must not be called before InitGoogleTest.
|
||||||
void UnitTestImpl::SuppressTestEventsIfInSubprocess() {
|
void UnitTestImpl::SuppressTestEventsIfInSubprocess() {
|
||||||
if (internal_run_death_test_flag_ != nullptr)
|
if (internal_run_death_test_flag_ != nullptr)
|
||||||
listeners()->SuppressEventForwarding();
|
listeners()->SuppressEventForwarding(true);
|
||||||
}
|
}
|
||||||
#endif // GTEST_HAS_DEATH_TEST
|
#endif // GTEST_HAS_DEATH_TEST
|
||||||
|
|
||||||
|
@ -173,7 +173,7 @@ class TestEventListenersAccessor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void SuppressEventForwarding(TestEventListeners* listeners) {
|
static void SuppressEventForwarding(TestEventListeners* listeners) {
|
||||||
listeners->SuppressEventForwarding();
|
listeners->SuppressEventForwarding(true);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user