Repository: mesos
Updated Branches:
  refs/heads/master 69b8ae501 -> 2eaa20d47


Fixed ROOT_CGROUPS_Tasks and ROOT_CGROUPS_Read on Ubunu 14.04.

Review: https://reviews.apache.org/r/36618


Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/2eaa20d4
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/2eaa20d4
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/2eaa20d4

Branch: refs/heads/master
Commit: 2eaa20d471fd5c0e0e71401cc20d6bd98a7059eb
Parents: 69b8ae5
Author: Artem Harutyunyan <[email protected]>
Authored: Tue Jul 21 21:58:13 2015 -0700
Committer: Benjamin Hindman <[email protected]>
Committed: Tue Jul 21 21:58:14 2015 -0700

----------------------------------------------------------------------
 src/tests/cgroups_tests.cpp | 27 +++++++++++++++++++--------
 1 file changed, 19 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/2eaa20d4/src/tests/cgroups_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/cgroups_tests.cpp b/src/tests/cgroups_tests.cpp
index 9f5028f..b63d956 100644
--- a/src/tests/cgroups_tests.cpp
+++ b/src/tests/cgroups_tests.cpp
@@ -417,24 +417,35 @@ TEST_F(CgroupsAnyHierarchyTest, 
ROOT_CGROUPS_NestedCgroups)
 
 TEST_F(CgroupsAnyHierarchyTest, ROOT_CGROUPS_Tasks)
 {
+  pid_t pid = ::getpid();
+
+  Result<std::string> cgroup = cgroups::cpu::cgroup(pid);
+  ASSERT_SOME(cgroup);
+
   std::string hierarchy = path::join(baseHierarchy, "cpu");
-  Try<std::set<pid_t> > pids = cgroups::processes(hierarchy, "/");
+
+  Try<std::set<pid_t>> pids = cgroups::processes(hierarchy, cgroup.get());
   ASSERT_SOME(pids);
-  EXPECT_NE(0u, pids.get().count(1));
-  EXPECT_NE(0u, pids.get().count(::getpid()));
+
+  EXPECT_NE(0u, pids.get().count(pid));
 }
 
 
 TEST_F(CgroupsAnyHierarchyTest, ROOT_CGROUPS_Read)
 {
   std::string hierarchy = path::join(baseHierarchy, "cpu");
-  EXPECT_ERROR(cgroups::read(hierarchy, TEST_CGROUPS_ROOT, "invalid"));
 
-  std::string pid = stringify(::getpid());
+  EXPECT_ERROR(cgroups::read(hierarchy, TEST_CGROUPS_ROOT, "invalid42"));
 
-  Try<std::string> result = cgroups::read(hierarchy, "/", "tasks");
-  ASSERT_SOME(result);
-  EXPECT_TRUE(strings::contains(result.get(), pid));
+  pid_t pid = ::getpid();
+
+  Result<std::string> cgroup = cgroups::cpu::cgroup(pid);
+  ASSERT_SOME(cgroup);
+
+  Try<std::string> read = cgroups::read(hierarchy, cgroup.get(), "tasks");
+  ASSERT_SOME(read);
+
+  EXPECT_TRUE(strings::contains(read.get(), stringify(pid)));
 }
 
 

Reply via email to