summaryrefslogtreecommitdiff
path: root/indra/test
diff options
context:
space:
mode:
authorNat Linden <nat@lindenlab.com>2021-12-02 20:08:02 +0000
committerAndrey Lihatskiy <andreylproductengine@lindenlab.com>2021-12-02 20:08:02 +0000
commit79c6557f16f7f41104299e5b157dcd9d2932ee2a (patch)
treec99e4f064360b495ec1d8eea0cf09e963c2119ed /indra/test
parent93262cf286baba47d271ee0aa700c6c40afaa132 (diff)
Merged in DRTVWR-540-syncpatch (pull request #796)
DRTVWR-540: Make Sync test failure more informative * DRTVWR-540: Make Sync test failure more informative Approved-by: Andrey Kleshchev Approved-by: Andrey Lihatskiy
Diffstat (limited to 'indra/test')
-rw-r--r--indra/test/sync.h17
1 files changed, 9 insertions, 8 deletions
diff --git a/indra/test/sync.h b/indra/test/sync.h
index ca8b7262d6..bd837cb730 100644
--- a/indra/test/sync.h
+++ b/indra/test/sync.h
@@ -89,25 +89,26 @@ public:
/// suspend until "somebody else" has bumped mCond by n steps
void yield(int n=1)
{
- return yield_until(STRINGIZE("Sync::yield_for(" << n << ") timed out after "
- << int(mTimeout.value()) << "ms"),
- mCond.get() + n);
+ return yield_until("Sync::yield_for", n, mCond.get() + n);
}
/// suspend until "somebody else" has bumped mCond to a specific value
void yield_until(int until)
{
- return yield_until(STRINGIZE("Sync::yield_until(" << until << ") timed out after "
- << int(mTimeout.value()) << "ms"),
- until);
+ return yield_until("Sync::yield_until", until, until);
}
private:
- void yield_until(const std::string& desc, int until)
+ void yield_until(const char* func, int arg, int until)
{
std::string name(llcoro::logname());
LL_DEBUGS() << name << " yield_until(" << until << ") suspending" << LL_ENDL;
- tut::ensure(name + ' ' + desc, mCond.wait_for_equal(mTimeout, until));
+ if (! mCond.wait_for_equal(mTimeout, until))
+ {
+ tut::fail(STRINGIZE(name << ' ' << func << '(' << arg << ") timed out after "
+ << int(mTimeout.value()) << "ms (expected " << until
+ << ", actual " << mCond.get() << ')'));
+ }
// each time we wake up, bump mCond
bump();
}