Skip to content

Commit

Permalink
Merge pull request #465 from leapmotion/fix-enclosureassert
Browse files Browse the repository at this point in the history
Use a reliable failure mechanism in test enclosure
  • Loading branch information
Jonathan Marsden committed Mar 25, 2015
2 parents cb9ba18 + c7d6e77 commit 5f015f3
Showing 1 changed file with 4 additions and 5 deletions.
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

0 comments on commit 5f015f3

Please sign in to comment.