simulator: spawnProcess to wait for long duration
spawnProcess was waiting for 3 seconds and terminating the child process for synchronous calls, but in the simulator, this can lead to non-determinism, because some cases the command can run in <3 or >3 seconds. The fix is to increase the wait for duration to be very long that it has to synchronously wait and get the results or the test will timeout.
This commit is contained in:
parent
31b6c86650
commit
c906da1f62
|
@ -102,12 +102,19 @@ ACTOR Future<int> spawnProcess(std::string binPath, std::vector<std::string> par
|
|||
|
||||
if (!isSync && !g_network->isSimulated()) {
|
||||
while (c.running() && runTime <= maxWaitTime) {
|
||||
wait(delay(0.1));
|
||||
runTime += 0.1;
|
||||
wait(delay(0.1));
|
||||
runTime += 0.1;
|
||||
}
|
||||
} else {
|
||||
int maxWaitTimeInt = static_cast<int>(maxWaitTime + 1.0);
|
||||
c.wait_for(std::chrono::seconds(maxWaitTimeInt));
|
||||
if (g_network->isSimulated()) {
|
||||
// to keep the simulator deterministic, wait till the process exits,
|
||||
// hence giving a large wait time
|
||||
c.wait_for(std::chrono::hours(24));
|
||||
ASSERT(!c.running());
|
||||
} else {
|
||||
int maxWaitTimeInt = static_cast<int>(maxWaitTime + 1.0);
|
||||
c.wait_for(std::chrono::seconds(maxWaitTimeInt));
|
||||
}
|
||||
}
|
||||
|
||||
if (c.running()) {
|
||||
|
|
Loading…
Reference in New Issue