Make subprocess_test reliable
The backup polling timer is set at 1 hz for looking for SIGCHLD. The
test runs for 1 second. These are racing against each other, so let's
let the test run for long enough to not race with the timer.
Change-Id: I6a776664df6c95c450d287a91c8532b77e183594
Signed-off-by: Austin Schuh <austin.linux@gmail.com>
diff --git a/aos/starter/subprocess_test.cc b/aos/starter/subprocess_test.cc
index 93fbf6a..71f701a 100644
--- a/aos/starter/subprocess_test.cc
+++ b/aos/starter/subprocess_test.cc
@@ -44,7 +44,10 @@
aos::TimerHandler *exit_timer =
event_loop.AddTimer([&event_loop]() { event_loop.Exit(); });
event_loop.OnRun([&event_loop, exit_timer]() {
- exit_timer->Setup(event_loop.monotonic_now() + std::chrono::seconds(1));
+ // Note: we are using the backup poll in this test to capture SIGCHLD. This
+ // runs at 1 hz, so make sure we let it run at least once.
+ exit_timer->Setup(event_loop.monotonic_now() +
+ std::chrono::milliseconds(1500));
});
event_loop.Run();
@@ -83,8 +86,10 @@
echo_stderr.set_capture_stderr(true);
echo_stderr.Start();
+ // Note: we are using the backup poll in this test to capture SIGCHLD. This
+ // runs at 1 hz, so make sure we let it run at least once.
event_loop.AddTimer([&event_loop]() { event_loop.Exit(); })
- ->Setup(event_loop.monotonic_now() + std::chrono::seconds(1));
+ ->Setup(event_loop.monotonic_now() + std::chrono::milliseconds(1500));
event_loop.Run();