Skip to content

Commit 91b606a

Browse files
committed
test: Fix failing exception check in new thread busy test
New thread busy test from 1238170 (bitcoin-core#214) is checking for "Future already retrieved" error with string match which is fragile and does not work on all platforms, resulting in error: test/mp/test/test.cpp:339: error: failed: expected e.what() == std::string("Future already retrieved") [std::future_error: Future already retrieved == Future already retrieved] This change fixes the test to check for an error code instead. Separately there seems to be a problem with this KJ_EXPECT call because it prints error output without causing the test to fail. This may be happening because it is not called on the main test thread. That issue is not addressed by this change and requires more followup.
1 parent 9e2147b commit 91b606a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

test/mp/test/test.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -334,9 +334,9 @@ KJ_TEST("Make simultaneous IPC callbacks with same request_thread and callback_t
334334
{
335335
signal.get_future().get();
336336
}
337-
catch(const std::exception& e)
337+
catch (const std::future_error& e)
338338
{
339-
KJ_EXPECT(e.what() == std::string("Future already retrieved"));
339+
KJ_EXPECT(e.code() == std::make_error_code(std::future_errc::future_already_retrieved));
340340
}
341341
};
342342

0 commit comments

Comments
 (0)