From ef028e3b24f4755f893b89e18bef79ef407cc17d Mon Sep 17 00:00:00 2001 From: Jeff Thomas <jeffdthomas@fb.com> Date: Tue, 20 Jul 2021 16:16:50 -0700 Subject: [PATCH] Add async stack trace to CO_TEST_P Summary: Add async stack trace to `CO_TEST_P` Reviewed By: ispeters Differential Revision: D29800378 fbshipit-source-id: ce7a22f545f2a55bd02ad5535f29aea094063bfe --- folly/experimental/coro/GtestHelpers.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/folly/experimental/coro/GtestHelpers.h b/folly/experimental/coro/GtestHelpers.h index 3d93f33ce..e5e4e4814 100644 --- a/folly/experimental/coro/GtestHelpers.h +++ b/folly/experimental/coro/GtestHelpers.h @@ -133,7 +133,13 @@ test_suite_name, test_name)::gtest_registering_dummy_ = \ GTEST_TEST_CLASS_NAME_(test_suite_name, test_name)::AddToRegistry(); \ void GTEST_TEST_CLASS_NAME_(test_suite_name, test_name)::TestBody() { \ - folly::coro::blockingWait(co_TestBody()); \ + try { \ + folly::coro::blockingWait(co_TestBody()); \ + } catch (const std::exception& ex) { \ + GTEST_LOG_(ERROR) << ex.what() << ", async stack trace: " \ + << folly::exception_tracer::getAsyncTrace(ex); \ + throw; \ + } \ } \ folly::coro::Task<void> GTEST_TEST_CLASS_NAME_( \ test_suite_name, test_name)::co_TestBody() -- 2.26.2