diff options
author | Nat Goodspeed <nat@lindenlab.com> | 2024-02-29 12:00:58 -0500 |
---|---|---|
committer | Nat Goodspeed <nat@lindenlab.com> | 2024-02-29 12:00:58 -0500 |
commit | 0df7936ea50db2ee5680f75fa285f96fedf1f341 (patch) | |
tree | 9b1f03a5454f0b979561636bd867f18123d4d1b6 /indra/llcommon | |
parent | 777586a1865b496f8bfea9651afbd481ea23b4f7 (diff) |
Improve Debug class (indra/test/debug.h).
Disable copy assignment operator as well as copy constructor.
Use std::uncaught_exceptions() in destructor to report whether there's an
in-flight exception at block exit. Since that was the whole point of the
DEBUGIN / DEBUGEND macros, those become obsolete. Ditch them and their
existing invocations.
Diffstat (limited to 'indra/llcommon')
-rw-r--r-- | indra/llcommon/tests/lleventcoro_test.cpp | 95 |
1 files changed, 38 insertions, 57 deletions
diff --git a/indra/llcommon/tests/lleventcoro_test.cpp b/indra/llcommon/tests/lleventcoro_test.cpp index c7a958da49..6ff895c1c1 100644 --- a/indra/llcommon/tests/lleventcoro_test.cpp +++ b/indra/llcommon/tests/lleventcoro_test.cpp @@ -113,30 +113,27 @@ namespace tut void test_data::explicit_wait(boost::shared_ptr<LLCoros::Promise<std::string>>& cbp) { - DEBUGIN - { - mSync.bump(); - // The point of this test is to verify / illustrate suspending a - // coroutine for something other than an LLEventPump. In other - // words, this shows how to adapt to any async operation that - // provides a callback-style notification (and prove that it - // works). + DEBUG; + mSync.bump(); + // The point of this test is to verify / illustrate suspending a + // coroutine for something other than an LLEventPump. In other + // words, this shows how to adapt to any async operation that + // provides a callback-style notification (and prove that it + // works). - // Perhaps we would send a request to a remote server and arrange - // for cbp->set_value() to be called on response. - // For test purposes, instead of handing 'callback' (or an - // adapter) off to some I/O subsystem, we'll just pass it back to - // our caller. - cbp = boost::make_shared<LLCoros::Promise<std::string>>(); - LLCoros::Future<std::string> future = LLCoros::getFuture(*cbp); + // Perhaps we would send a request to a remote server and arrange + // for cbp->set_value() to be called on response. + // For test purposes, instead of handing 'callback' (or an + // adapter) off to some I/O subsystem, we'll just pass it back to + // our caller. + cbp = boost::make_shared<LLCoros::Promise<std::string>>(); + LLCoros::Future<std::string> future = LLCoros::getFuture(*cbp); - // calling get() on the future causes us to suspend - debug("about to suspend"); - stringdata = future.get(); - mSync.bump(); - ensure_equals("Got it", stringdata, "received"); - } - DEBUGEND + // calling get() on the future causes us to suspend + debug("about to suspend"); + stringdata = future.get(); + mSync.bump(); + ensure_equals("Got it", stringdata, "received"); } template<> template<> @@ -163,13 +160,9 @@ namespace tut void test_data::waitForEventOn1() { - DEBUGIN - { - mSync.bump(); - result = suspendUntilEventOn("source"); - mSync.bump(); - } - DEBUGEND + mSync.bump(); + result = suspendUntilEventOn("source"); + mSync.bump(); } template<> template<> @@ -189,15 +182,11 @@ namespace tut void test_data::coroPump() { - DEBUGIN - { - mSync.bump(); - LLCoroEventPump waiter; - replyName = waiter.getName(); - result = waiter.suspend(); - mSync.bump(); - } - DEBUGEND + mSync.bump(); + LLCoroEventPump waiter; + replyName = waiter.getName(); + result = waiter.suspend(); + mSync.bump(); } template<> template<> @@ -217,16 +206,12 @@ namespace tut void test_data::postAndWait1() { - DEBUGIN - { - mSync.bump(); - result = postAndSuspend(LLSDMap("value", 17), // request event - immediateAPI.getPump(), // requestPump - "reply1", // replyPump - "reply"); // request["reply"] = name - mSync.bump(); - } - DEBUGEND + mSync.bump(); + result = postAndSuspend(LLSDMap("value", 17), // request event + immediateAPI.getPump(), // requestPump + "reply1", // replyPump + "reply"); // request["reply"] = name + mSync.bump(); } template<> template<> @@ -240,15 +225,11 @@ namespace tut void test_data::coroPumpPost() { - DEBUGIN - { - mSync.bump(); - LLCoroEventPump waiter; - result = waiter.postAndSuspend(LLSDMap("value", 17), - immediateAPI.getPump(), "reply"); - mSync.bump(); - } - DEBUGEND + mSync.bump(); + LLCoroEventPump waiter; + result = waiter.postAndSuspend(LLSDMap("value", 17), + immediateAPI.getPump(), "reply"); + mSync.bump(); } template<> template<> |