| 43 | } // namespace |
| 44 | |
| 45 | TEST(Groot2PublisherTest, EnsureNoInfiniteLoopOnThrow) |
| 46 | { |
| 47 | EXPECT_EXIT( |
| 48 | { |
| 49 | auto fut = std::async(std::launch::async, throwRuntimeError); |
| 50 | auto status = fut.wait_for(1s); // shouldn't run for more than 1 second |
| 51 | if(status != std::future_status::ready) |
| 52 | { |
| 53 | std::cerr << "Test took too long. Possible infinite loop.\n"; |
| 54 | std::exit(EXIT_FAILURE); |
| 55 | } |
| 56 | std::exit(EXIT_SUCCESS); |
| 57 | }, |
| 58 | ::testing::ExitedWithCode(EXIT_SUCCESS), ".*"); |
| 59 | } |
| 60 | |
| 61 | // Test that destructor completes quickly even after exception |
| 62 | // This test runs multiple times to catch race conditions |
nothing calls this directly
no test coverage detected