Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use a reliable failure mechanism in test enclosure #465

Merged
merged 1 commit into from Mar 25, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 4 additions & 5 deletions autowiring/AutowiringEnclosure.h
Expand Up @@ -102,11 +102,10 @@ class AutowiringEnclosure:
auto ctxt = ecef ? ecef->GetContext() : nullptr;
ctxt->SignalShutdown();

// Do not allow teardown to take more than 250 milliseconds or so
if(!ctxt->Wait(std::chrono::milliseconds(250))) {
// Critical error--took too long to tear down
assert(false);
}
// Do not allow teardown to take more than 5 seconds. This is considered a "timely teardown" limit.
// If it takes more than this amount of time to tear down, the test case itself should invoke SignalShutdown
// and Wait itself with the extended teardown period specified.
ASSERT_TRUE(ctxt->Wait(std::chrono::seconds(5))) << "Test case took too long to tear down, unit tests running after this point are untrustworthy";

static const char sc_autothrow [] = "AUTOTHROW_";
if(!strncmp(sc_autothrow, info.name(), sizeof(sc_autothrow) - 1))
Expand Down