You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by be...@apache.org on 2013/08/06 08:49:07 UTC
git commit: Improved robustness of some process related tests.
Updated Branches:
refs/heads/master 3b3c1497f -> 31b768292
Improved robustness of some process related tests.
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/31b76829
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/31b76829
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/31b76829
Branch: refs/heads/master
Commit: 31b7682921759cacff5735393e13de96e9123fe1
Parents: 3b3c149
Author: Benjamin Hindman <be...@gmail.com>
Authored: Mon Aug 5 23:46:53 2013 -0700
Committer: Benjamin Hindman <be...@gmail.com>
Committed: Mon Aug 5 23:48:17 2013 -0700
----------------------------------------------------------------------
.../3rdparty/stout/tests/os_tests.cpp | 22 ++++++++++++++------
1 file changed, 16 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/31b76829/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 01a6d68..61135d9 100644
--- a/3rdparty/libprocess/3rdparty/stout/tests/os_tests.cpp
+++ b/3rdparty/libprocess/3rdparty/stout/tests/os_tests.cpp
@@ -312,7 +312,12 @@ TEST_F(OsTest, children)
children = os::children(getpid());
ASSERT_SOME(children);
- EXPECT_EQ(2u, children.get().size());
+
+ // Depending on whether or not the shell has fork/exec'ed in each
+ // above 'Exec', we could have 2 or 4 children.
+ EXPECT_LE(2u, children.get().size());
+ EXPECT_GE(4u, children.get().size());
+
EXPECT_EQ(1u, children.get().count(child));
EXPECT_EQ(1u, children.get().count(grandchild));
@@ -443,15 +448,20 @@ TEST_F(OsTest, killtree)
ASSERT_SOME(trees);
- EXPECT_EQ(2u, trees.get().size());
+ EXPECT_EQ(2u, trees.get().size()) << stringify(trees.get());
foreach (const ProcessTree& tree, trees.get()) {
if (tree.process.pid == child) {
- EXPECT_TRUE(tree.contains(grandchild)); // But zombied.
- EXPECT_FALSE(tree.contains(greatGrandchild));
- EXPECT_FALSE(tree.contains(greatGreatGrandchild));
+ // The 'grandchild' should still be in the tree, just zombied.
+ EXPECT_TRUE(tree.contains(grandchild)) << tree;
+ EXPECT_FALSE(tree.contains(greatGrandchild)) << tree;
+ EXPECT_FALSE(tree.contains(greatGreatGrandchild)) << tree;
} else if (tree.process.pid == greatGrandchild) {
- EXPECT_TRUE(tree.contains(greatGreatGrandchild));
+ EXPECT_TRUE(tree.contains(greatGreatGrandchild)) << tree;
+ } else {
+ FAIL()
+ << "Not expecting a process tree rooted at "
+ << tree.process.pid << "\n" << tree;
}
}