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 2015/07/19 20:28:37 UTC

[4/4] mesos git commit: Cleaned up 'perf' related tests to work on Ubuntu 14.04.

Cleaned up 'perf' related tests to work on Ubuntu 14.04.

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


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

Branch: refs/heads/master
Commit: ec6f9f8c4663f18055c01a118f3e4934107bf3bc
Parents: 4abb59e
Author: Benjamin Hindman <be...@gmail.com>
Authored: Sun Jul 19 06:14:20 2015 +0000
Committer: Benjamin Hindman <be...@gmail.com>
Committed: Sun Jul 19 11:13:16 2015 -0700

----------------------------------------------------------------------
 src/tests/cgroups_tests.cpp | 15 ++++++++++++---
 src/tests/perf_tests.cpp    |  6 +++++-
 2 files changed, 17 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/ec6f9f8c/src/tests/cgroups_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/cgroups_tests.cpp b/src/tests/cgroups_tests.cpp
index ac431be..3924a4a 100644
--- a/src/tests/cgroups_tests.cpp
+++ b/src/tests/cgroups_tests.cpp
@@ -954,7 +954,9 @@ TEST_F(CgroupsAnyHierarchyWithPerfEventTest, ROOT_CGROUPS_Perf)
     ASSERT_EQ((ssize_t) sizeof(dummy), len);
     ::close(pipes[0]);
 
-    while (true) { sleep(1); }
+    while (true) {
+      // Don't sleep so 'perf' can actually sample something.
+    }
 
     ABORT("Child should not reach here");
   }
@@ -977,12 +979,19 @@ TEST_F(CgroupsAnyHierarchyWithPerfEventTest, ROOT_CGROUPS_Perf)
   // Software event.
   events.insert("task-clock");
 
+  // NOTE: Wait at least 2 seconds as we've seen some variance in how
+  // well 'perf' does across Linux distributions (e.g., Ubuntu 14.04)
+  // and we want to make sure that we collect some non-zero values.
   Future<mesos::PerfStatistics> statistics =
-    perf::sample(events, TEST_CGROUPS_ROOT, Seconds(1));
+    perf::sample(events, TEST_CGROUPS_ROOT, Seconds(2));
   AWAIT_READY(statistics);
 
   ASSERT_TRUE(statistics.get().has_cycles());
-  EXPECT_LT(0u, statistics.get().cycles());
+
+  // TODO(benh): Some Linux distributions (Ubuntu 14.04) fail to
+  // properly sample 'cycles' with 'perf', so we don't explicitly
+  // check the value here. See MESOS-3082.
+  // EXPECT_LT(0u, statistics.get().cycles());
 
   ASSERT_TRUE(statistics.get().has_task_clock());
   EXPECT_LT(0.0, statistics.get().task_clock());

http://git-wip-us.apache.org/repos/asf/mesos/blob/ec6f9f8c/src/tests/perf_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/perf_tests.cpp b/src/tests/perf_tests.cpp
index 281eed0..6b3d70f 100644
--- a/src/tests/perf_tests.cpp
+++ b/src/tests/perf_tests.cpp
@@ -168,7 +168,11 @@ TEST_F(PerfTest, ROOT_SamplePid)
   EXPECT_EQ(duration.secs(), statistics.get().duration());
 
   ASSERT_TRUE(statistics.get().has_cycles());
-  EXPECT_LT(0u, statistics.get().cycles());
+
+  // TODO(benh): Some Linux distributions (Ubuntu 14.04) fail to
+  // properly sample 'cycles' with 'perf', so we don't explicitly
+  // check the value here. See MESOS-3082.
+  // EXPECT_LT(0u, statistics.get().cycles());
 
   ASSERT_TRUE(statistics.get().has_task_clock());
   EXPECT_LT(0.0, statistics.get().task_clock());