Wait up to timeout seconds for a file to be created. If timeout is zero, then wait indefinitely. Return true if file exists. TODO(pbrett): Consider generalizing this function and moving it to a common header.
| 437 | // TODO(pbrett): Consider generalizing this function and moving it to |
| 438 | // a common header. |
| 439 | static bool waitForFileCreation( |
| 440 | const string& path, |
| 441 | const Duration& duration = Seconds(60)) |
| 442 | { |
| 443 | Stopwatch timer; |
| 444 | timer.start(); |
| 445 | while (!os::exists(path)) { |
| 446 | if ((duration > Duration::zero()) && (timer.elapsed() > duration)) |
| 447 | break; |
| 448 | os::sleep(Milliseconds(50)); |
| 449 | } |
| 450 | return os::exists(path); |
| 451 | } |
| 452 | |
| 453 | |
| 454 | // This test uses two containers: one listens to 'validPort' and |