Test fails with buggify on sometimes because of injected delays in run loop, so test now waits for each future to become ready regardless of delay.

This commit is contained in:
Steve Atherton 2021-06-21 11:34:57 -07:00
parent 09b0c1c419
commit 765d94c6b3
1 changed files with 7 additions and 15 deletions

View File

@ -1581,26 +1581,18 @@ TEST_CASE("/flow/flow/FlowMutex") {
}
error = e;
// Wait for all actors still running to finish their waits and try to take the mutex
// Some actors can still be running, waiting while locked or unlocked,
// but all should become ready, some with errors.
state int i;
if (verbose) {
printf("Waiting for completions\n");
printf("Waiting for completions. Future end states:\n");
}
wait(delay(2 * mutexTestDelay));
if (verbose) {
printf("Future end states:\n");
}
// All futures should be ready, some with errors.
bool allReady = true;
for (int i = 0; i < tests.size(); ++i) {
auto f = tests[i];
for (i = 0; i < tests.size(); ++i) {
ErrorOr<Void> f = wait(errorOr(tests[i]));
if (verbose) {
printf(
" %d: %s\n", i, f.isReady() ? (f.isError() ? f.getError().what() : "done") : "not ready");
printf(" %d: %s\n", i, f.isError() ? f.getError().what() : "done");
}
allReady = allReady && f.isReady();
}
ASSERT(allReady);
}
// If an error was caused, one should have been detected.