summaryrefslogtreecommitdiff
path: root/indra/test/sync.h
diff options
context:
space:
mode:
authorMnikolenko Productengine <mnikolenko@productengine.com>2022-04-26 16:03:03 +0300
committerMnikolenko Productengine <mnikolenko@productengine.com>2022-04-26 16:03:03 +0300
commit79c9a8a4b79124baa06cb6630be3113906f1e342 (patch)
tree84e73c23280a42f5fff630a05e23cf914ae289bf /indra/test/sync.h
parente5e710a1e6e0f74cd60647e3dae7d037076351ff (diff)
parentbafa869c21cb8b329f94be6fa930a43d11699082 (diff)
Merge branch 'DRTVWR-546' into DRTVWR-539
Diffstat (limited to 'indra/test/sync.h')
-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();
}