You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by bm...@apache.org on 2014/01/31 22:45:20 UTC
git commit: Fixed the flaky Os.killtree test.
Updated Branches:
refs/heads/master be7e30acd -> dc4525c1f
Fixed the flaky Os.killtree test.
Review: https://reviews.apache.org/r/17558
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/dc4525c1
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/dc4525c1
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/dc4525c1
Branch: refs/heads/master
Commit: dc4525c1fdeb1b70f2b0e0ae8ddef61184a589d6
Parents: be7e30a
Author: Benjamin Mahler <bm...@twitter.com>
Authored: Thu Jan 30 12:44:32 2014 -0800
Committer: Benjamin Mahler <bm...@twitter.com>
Committed: Fri Jan 31 13:42:50 2014 -0800
----------------------------------------------------------------------
.../3rdparty/stout/tests/os_tests.cpp | 42 ++++++++++++++++++--
1 file changed, 39 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/dc4525c1/3rdparty/libprocess/3rdparty/stout/tests/os_tests.cpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/3rdparty/stout/tests/os_tests.cpp b/3rdparty/libprocess/3rdparty/stout/tests/os_tests.cpp
index c40c743..e061155 100644
--- a/3rdparty/libprocess/3rdparty/stout/tests/os_tests.cpp
+++ b/3rdparty/libprocess/3rdparty/stout/tests/os_tests.cpp
@@ -487,7 +487,24 @@ TEST_F(OsTest, killtree)
tree.get().children.front().children.front().children.front();
// Now wait for the grandchild to exit splitting the process tree.
- os::sleep(Milliseconds(50));
+ Duration elapsed = Duration::zero();
+ while (true) {
+ Result<os::Process> process = os::process(grandchild);
+
+ ASSERT_FALSE(process.isError());
+
+ if (process.isNone() || process.get().zombie) {
+ break;
+ }
+
+ if (elapsed > Seconds(10)) {
+ FAIL() << "Granchild process '" << process.get().pid << "' "
+ << "(" << process.get().command << ") did not terminate";
+ }
+
+ os::sleep(Milliseconds(5));
+ elapsed += Milliseconds(5);
+ }
// Kill the process tree and follow sessions and groups to make sure
// we cross the broken link due to the grandchild.
@@ -518,8 +535,27 @@ TEST_F(OsTest, killtree)
}
}
- // There is a delay for processes to move into the zombie state.
- os::sleep(Milliseconds(50));
+ // All processes should be reaped since we've killed everything.
+ // The direct child must be reaped by us below.
+ elapsed = Duration::zero();
+ while (true) {
+ Result<os::Process> _child = os::process(child);
+ ASSERT_SOME(_child);
+
+ if (os::process(greatGreatGrandchild).isNone() &&
+ os::process(greatGrandchild).isNone() &&
+ os::process(grandchild).isNone() &&
+ _child.get().zombie) {
+ break;
+ }
+
+ if (elapsed > Seconds(10)) {
+ FAIL() << "Processes were not reaped after killtree invocation";
+ }
+
+ os::sleep(Milliseconds(5));
+ elapsed += Milliseconds(5);
+ }
// Expect the pids to be wiped!
EXPECT_NONE(os::process(greatGreatGrandchild));