You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by jp...@apache.org on 2018/02/16 20:11:47 UTC

[1/4] mesos git commit: Added a global `TEST_AWAIT_TIMEOUT` variable.

Repository: mesos
Updated Branches:
  refs/heads/master 5940641f6 -> 3def7fea5


Added a global `TEST_AWAIT_TIMEOUT` variable.

Added a global `TEST_AWAIT_TIMEOUT` variable that applications
can use to globally tune the default timeout in the `AWAIT_READY`
family of test macros. The default remains 15sec.

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


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

Branch: refs/heads/master
Commit: 4261077f98e79b1f1d45ab878f1e16906ff68eab
Parents: 5940641
Author: James Peach <jp...@apache.org>
Authored: Fri Feb 16 11:37:13 2018 -0800
Committer: James Peach <jp...@apache.org>
Committed: Fri Feb 16 11:37:13 2018 -0800

----------------------------------------------------------------------
 3rdparty/libprocess/Makefile.am                 |   7 +-
 3rdparty/libprocess/include/Makefile.am         |   1 +
 3rdparty/libprocess/include/process/gtest.hpp   | 149 +++++++++++++------
 .../include/process/gtest_constants.hpp         |  24 +++
 3rdparty/libprocess/src/CMakeLists.txt          |   5 +-
 3rdparty/libprocess/src/gtest_constants.cpp     |  19 +++
 6 files changed, 153 insertions(+), 52 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/4261077f/3rdparty/libprocess/Makefile.am
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/Makefile.am b/3rdparty/libprocess/Makefile.am
index 3071b7c..c895d3a 100644
--- a/3rdparty/libprocess/Makefile.am
+++ b/3rdparty/libprocess/Makefile.am
@@ -186,9 +186,9 @@ endif
 noinst_LTLIBRARIES = libprocess.la
 
 libprocess_la_SOURCES =		\
-  src/authenticator_manager.hpp	\
-  src/authenticator_manager.cpp	\
   src/authenticator.cpp		\
+  src/authenticator_manager.cpp	\
+  src/authenticator_manager.hpp	\
   src/clock.cpp			\
   src/config.hpp		\
   src/decoder.hpp		\
@@ -197,6 +197,7 @@ libprocess_la_SOURCES =		\
   src/event_queue.hpp		\
   src/firewall.cpp		\
   src/gate.hpp			\
+  src/gtest_constants.cpp	\
   src/help.cpp			\
   src/http.cpp			\
   src/http_proxy.cpp		\
@@ -209,9 +210,9 @@ libprocess_la_SOURCES =		\
   src/pid.cpp			\
   src/poll_socket.cpp		\
   src/poll_socket.hpp		\
-  src/profiler.cpp		\
   src/process.cpp		\
   src/process_reference.hpp	\
+  src/profiler.cpp		\
   src/reap.cpp			\
   src/run_queue.hpp		\
   src/semaphore.hpp		\

http://git-wip-us.apache.org/repos/asf/mesos/blob/4261077f/3rdparty/libprocess/include/Makefile.am
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/include/Makefile.am b/3rdparty/libprocess/include/Makefile.am
index 84877a2..cd2c3bc 100644
--- a/3rdparty/libprocess/include/Makefile.am
+++ b/3rdparty/libprocess/include/Makefile.am
@@ -32,6 +32,7 @@ nobase_include_HEADERS =		\
   process/gmock.hpp			\
   process/grpc.hpp			\
   process/gtest.hpp			\
+  process/gtest_constants.hpp		\
   process/help.hpp			\
   process/http.hpp			\
   process/id.hpp			\

http://git-wip-us.apache.org/repos/asf/mesos/blob/4261077f/3rdparty/libprocess/include/process/gtest.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/include/process/gtest.hpp b/3rdparty/libprocess/include/process/gtest.hpp
index eee7266..307cbfe 100644
--- a/3rdparty/libprocess/include/process/gtest.hpp
+++ b/3rdparty/libprocess/include/process/gtest.hpp
@@ -20,6 +20,7 @@
 #include <process/check.hpp>
 #include <process/clock.hpp>
 #include <process/future.hpp>
+#include <process/gtest_constants.hpp>
 #include <process/http.hpp>
 
 #include <stout/duration.hpp>
@@ -246,7 +247,7 @@ template <typename T1, typename T2>
 
 
 #define AWAIT_ASSERT_ABANDONED(actual)                  \
-  AWAIT_ASSERT_ABANDONED_FOR(actual, Seconds(15))
+  AWAIT_ASSERT_ABANDONED_FOR(actual, process::TEST_AWAIT_TIMEOUT)
 
 
 #define AWAIT_EXPECT_ABANDONED_FOR(actual, duration)            \
@@ -254,7 +255,7 @@ template <typename T1, typename T2>
 
 
 #define AWAIT_EXPECT_ABANDONED(actual)                  \
-  AWAIT_EXPECT_ABANDONED_FOR(actual, Seconds(15))
+  AWAIT_EXPECT_ABANDONED_FOR(actual, process::TEST_AWAIT_TIMEOUT)
 
 
 // TODO(bmahler): Differentiate EXPECT and ASSERT here.
@@ -263,7 +264,7 @@ template <typename T1, typename T2>
 
 
 #define AWAIT(actual)                           \
-  AWAIT_FOR(actual, Seconds(15))
+  AWAIT_FOR(actual, process::TEST_AWAIT_TIMEOUT)
 
 
 #define AWAIT_ASSERT_READY_FOR(actual, duration)                \
@@ -271,7 +272,7 @@ template <typename T1, typename T2>
 
 
 #define AWAIT_ASSERT_READY(actual)              \
-  AWAIT_ASSERT_READY_FOR(actual, Seconds(15))
+  AWAIT_ASSERT_READY_FOR(actual, process::TEST_AWAIT_TIMEOUT)
 
 
 #define AWAIT_READY_FOR(actual, duration)       \
@@ -287,7 +288,7 @@ template <typename T1, typename T2>
 
 
 #define AWAIT_EXPECT_READY(actual)              \
-  AWAIT_EXPECT_READY_FOR(actual, Seconds(15))
+  AWAIT_EXPECT_READY_FOR(actual, process::TEST_AWAIT_TIMEOUT)
 
 
 #define AWAIT_ASSERT_FAILED_FOR(actual, duration)               \
@@ -295,7 +296,7 @@ template <typename T1, typename T2>
 
 
 #define AWAIT_ASSERT_FAILED(actual)             \
-  AWAIT_ASSERT_FAILED_FOR(actual, Seconds(15))
+  AWAIT_ASSERT_FAILED_FOR(actual, process::TEST_AWAIT_TIMEOUT)
 
 
 #define AWAIT_FAILED_FOR(actual, duration)       \
@@ -311,7 +312,7 @@ template <typename T1, typename T2>
 
 
 #define AWAIT_EXPECT_FAILED(actual)             \
-  AWAIT_EXPECT_FAILED_FOR(actual, Seconds(15))
+  AWAIT_EXPECT_FAILED_FOR(actual, process::TEST_AWAIT_TIMEOUT)
 
 
 #define AWAIT_ASSERT_DISCARDED_FOR(actual, duration)            \
@@ -319,7 +320,7 @@ template <typename T1, typename T2>
 
 
 #define AWAIT_ASSERT_DISCARDED(actual)                  \
-  AWAIT_ASSERT_DISCARDED_FOR(actual, Seconds(15))
+  AWAIT_ASSERT_DISCARDED_FOR(actual, process::TEST_AWAIT_TIMEOUT)
 
 
 #define AWAIT_DISCARDED_FOR(actual, duration)       \
@@ -335,7 +336,7 @@ template <typename T1, typename T2>
 
 
 #define AWAIT_EXPECT_DISCARDED(actual)                  \
-  AWAIT_EXPECT_DISCARDED_FOR(actual, Seconds(15))
+  AWAIT_EXPECT_DISCARDED_FOR(actual, process::TEST_AWAIT_TIMEOUT)
 
 
 #define AWAIT_ASSERT_EQ_FOR(expected, actual, duration)                 \
@@ -343,7 +344,7 @@ template <typename T1, typename T2>
 
 
 #define AWAIT_ASSERT_EQ(expected, actual)       \
-  AWAIT_ASSERT_EQ_FOR(expected, actual, Seconds(15))
+  AWAIT_ASSERT_EQ_FOR(expected, actual, process::TEST_AWAIT_TIMEOUT)
 
 
 #define AWAIT_EQ_FOR(expected, actual, duration)              \
@@ -359,7 +360,7 @@ template <typename T1, typename T2>
 
 
 #define AWAIT_EXPECT_EQ(expected, actual)               \
-  AWAIT_EXPECT_EQ_FOR(expected, actual, Seconds(15))
+  AWAIT_EXPECT_EQ_FOR(expected, actual, process::TEST_AWAIT_TIMEOUT)
 
 
 #define AWAIT_ASSERT_TRUE_FOR(actual, duration)                 \
@@ -442,16 +443,22 @@ inline ::testing::AssertionResult AwaitAssertResponseStatusEq(
   ASSERT_PRED_FORMAT3(AwaitAssertResponseStatusEq, expected, actual, duration)
 
 
-#define AWAIT_ASSERT_RESPONSE_STATUS_EQ(expected, actual)               \
-  AWAIT_ASSERT_RESPONSE_STATUS_EQ_FOR(expected, actual, Seconds(15))
+#define AWAIT_ASSERT_RESPONSE_STATUS_EQ(expected, actual) \
+  AWAIT_ASSERT_RESPONSE_STATUS_EQ_FOR(                    \
+      expected,                                           \
+      actual,                                             \
+      process::TEST_AWAIT_TIMEOUT)
 
 
 #define AWAIT_EXPECT_RESPONSE_STATUS_EQ_FOR(expected, actual, duration) \
   EXPECT_PRED_FORMAT3(AwaitAssertResponseStatusEq, expected, actual, duration)
 
 
-#define AWAIT_EXPECT_RESPONSE_STATUS_EQ(expected, actual)               \
-  AWAIT_EXPECT_RESPONSE_STATUS_EQ_FOR(expected, actual, Seconds(15))
+#define AWAIT_EXPECT_RESPONSE_STATUS_EQ(expected, actual) \
+  AWAIT_EXPECT_RESPONSE_STATUS_EQ_FOR(                    \
+      expected,                                           \
+      actual,                                             \
+      process::TEST_AWAIT_TIMEOUT)
 
 
 inline ::testing::AssertionResult AwaitAssertResponseBodyEq(
@@ -485,16 +492,22 @@ inline ::testing::AssertionResult AwaitAssertResponseBodyEq(
   ASSERT_PRED_FORMAT3(AwaitAssertResponseBodyEq, expected, actual, duration)
 
 
-#define AWAIT_ASSERT_RESPONSE_BODY_EQ(expected, actual)                 \
-  AWAIT_ASSERT_RESPONSE_BODY_EQ_FOR(expected, actual, Seconds(15))
+#define AWAIT_ASSERT_RESPONSE_BODY_EQ(expected, actual) \
+  AWAIT_ASSERT_RESPONSE_BODY_EQ_FOR(                    \
+      expected,                                         \
+      actual,                                           \
+      process::TEST_AWAIT_TIMEOUT)
 
 
 #define AWAIT_EXPECT_RESPONSE_BODY_EQ_FOR(expected, actual, duration)   \
   EXPECT_PRED_FORMAT3(AwaitAssertResponseBodyEq, expected, actual, duration)
 
 
-#define AWAIT_EXPECT_RESPONSE_BODY_EQ(expected, actual)                 \
-  AWAIT_EXPECT_RESPONSE_BODY_EQ_FOR(expected, actual, Seconds(15))
+#define AWAIT_EXPECT_RESPONSE_BODY_EQ(expected, actual) \
+  AWAIT_EXPECT_RESPONSE_BODY_EQ_FOR(                    \
+      expected,                                         \
+      actual,                                           \
+      process::TEST_AWAIT_TIMEOUT)
 
 
 inline ::testing::AssertionResult AwaitAssertResponseHeaderEq(
@@ -530,20 +543,38 @@ inline ::testing::AssertionResult AwaitAssertResponseHeaderEq(
 }
 
 
-#define AWAIT_ASSERT_RESPONSE_HEADER_EQ_FOR(expected, key, actual, duration) \
-  ASSERT_PRED_FORMAT4(AwaitAssertResponseHeaderEq, expected, key, actual, duration) // NOLINT(whitespace/line_length)
+#define AWAIT_ASSERT_RESPONSE_HEADER_EQ_FOR(expected, key, actual, duration)  \
+  ASSERT_PRED_FORMAT4(                                                        \
+      AwaitAssertResponseHeaderEq,                                            \
+      expected,                                                               \
+      key,                                                                    \
+      actual,                                                                 \
+      duration)
 
 
-#define AWAIT_ASSERT_RESPONSE_HEADER_EQ(expected, key, actual)          \
-  AWAIT_ASSERT_RESPONSE_HEADER_EQ_FOR(expected, key, actual, Seconds(15))
+#define AWAIT_ASSERT_RESPONSE_HEADER_EQ(expected, key, actual)  \
+  AWAIT_ASSERT_RESPONSE_HEADER_EQ_FOR(                          \
+      expected,                                                 \
+      key,                                                      \
+      actual,                                                   \
+      process::TEST_AWAIT_TIMEOUT)
 
 
-#define AWAIT_EXPECT_RESPONSE_HEADER_EQ_FOR(expected, key, actual, duration) \
-  EXPECT_PRED_FORMAT4(AwaitAssertResponseHeaderEq, expected, key, actual, duration) // NOLINT(whitespace/line_length)
+#define AWAIT_EXPECT_RESPONSE_HEADER_EQ_FOR(expected, key, actual, duration)  \
+  EXPECT_PRED_FORMAT4(                                                        \
+      AwaitAssertResponseHeaderEq,                                            \
+      expected,                                                               \
+      key,                                                                    \
+      actual,                                                                 \
+      duration)
 
 
-#define AWAIT_EXPECT_RESPONSE_HEADER_EQ(expected, key, actual)          \
-  AWAIT_EXPECT_RESPONSE_HEADER_EQ_FOR(expected, key, actual, Seconds(15))
+#define AWAIT_EXPECT_RESPONSE_HEADER_EQ(expected, key, actual)  \
+  AWAIT_EXPECT_RESPONSE_HEADER_EQ_FOR(                          \
+      expected,                                                 \
+      key,                                                      \
+      actual,                                                   \
+      process::TEST_AWAIT_TIMEOUT)
 
 
 inline ::testing::AssertionResult AwaitAssertExited(
@@ -576,7 +607,7 @@ inline ::testing::AssertionResult AwaitAssertExited(
 
 
 #define AWAIT_ASSERT_EXITED(expected, actual)                   \
-  AWAIT_ASSERT_EXITED_FOR(expected, actual, Seconds(15))
+  AWAIT_ASSERT_EXITED_FOR(expected, actual, process::TEST_AWAIT_TIMEOUT)
 
 
 #define AWAIT_EXPECT_EXITED_FOR(expected, actual, duration)             \
@@ -584,7 +615,7 @@ inline ::testing::AssertionResult AwaitAssertExited(
 
 
 #define AWAIT_EXPECT_EXITED(expected, actual)                   \
-  AWAIT_EXPECT_EXITED_FOR(expected, actual, Seconds(15))
+  AWAIT_EXPECT_EXITED_FOR(expected, actual, process::TEST_AWAIT_TIMEOUT)
 
 
 inline ::testing::AssertionResult AwaitAssertExitStatusEq(
@@ -616,16 +647,22 @@ inline ::testing::AssertionResult AwaitAssertExitStatusEq(
   ASSERT_PRED_FORMAT3(AwaitAssertExitStatusEq, expected, actual, duration)
 
 
-#define AWAIT_ASSERT_WEXITSTATUS_EQ(expected, actual)                   \
-  AWAIT_ASSERT_WEXITSTATUS_EQ_FOR(expected, actual, Seconds(15))
+#define AWAIT_ASSERT_WEXITSTATUS_EQ(expected, actual) \
+  AWAIT_ASSERT_WEXITSTATUS_EQ_FOR(                    \
+      expected,                                       \
+      actual,                                         \
+      process::TEST_AWAIT_TIMEOUT)
 
 
 #define AWAIT_EXPECT_WEXITSTATUS_EQ_FOR(expected, actual, duration)     \
   EXPECT_PRED_FORMAT3(AwaitAssertExitStatusEq, expected, actual, duration)
 
 
-#define AWAIT_EXPECT_WEXITSTATUS_EQ(expected, actual)                   \
-  AWAIT_EXPECT_WEXITSTATUS_EQ_FOR(expected, actual, Seconds(15))
+#define AWAIT_EXPECT_WEXITSTATUS_EQ(expected, actual) \
+  AWAIT_EXPECT_WEXITSTATUS_EQ_FOR(                    \
+      expected,                                       \
+      actual,                                         \
+      process::TEST_AWAIT_TIMEOUT)
 
 
 inline ::testing::AssertionResult AwaitAssertExitStatusNe(
@@ -657,16 +694,22 @@ inline ::testing::AssertionResult AwaitAssertExitStatusNe(
   ASSERT_PRED_FORMAT3(AwaitAssertExitStatusNe, expected, actual, duration)
 
 
-#define AWAIT_ASSERT_WEXITSTATUS_NE(expected, actual)           \
-  AWAIT_ASSERT_EXITSTATUS_NE_FOR(expected, actual, Seconds(15))
+#define AWAIT_ASSERT_WEXITSTATUS_NE(expected, actual) \
+  AWAIT_ASSERT_EXITSTATUS_NE_FOR(                     \
+      expected,                                       \
+      actual,                                         \
+      process::TEST_AWAIT_TIMEOUT)
 
 
 #define AWAIT_EXPECT_WEXITSTATUS_NE_FOR(expected, actual, duration)     \
   EXPECT_PRED_FORMAT3(AwaitAssertExitStatusNe, expected, actual, duration)
 
 
-#define AWAIT_EXPECT_WEXITSTATUS_NE(expected, actual)                   \
-  AWAIT_EXPECT_WEXITSTATUS_NE_FOR(expected, actual, Seconds(15))
+#define AWAIT_EXPECT_WEXITSTATUS_NE(expected, actual) \
+  AWAIT_EXPECT_WEXITSTATUS_NE_FOR(                    \
+      expected,                                       \
+      actual,                                         \
+      process::TEST_AWAIT_TIMEOUT)
 
 
 inline ::testing::AssertionResult AwaitAssertSignaled(
@@ -699,7 +742,7 @@ inline ::testing::AssertionResult AwaitAssertSignaled(
 
 
 #define AWAIT_ASSERT_SIGNALED(expected, actual)                 \
-  AWAIT_ASSERT_SIGNALED_FOR(expected, actual, Seconds(15))
+  AWAIT_ASSERT_SIGNALED_FOR(expected, actual, process::TEST_AWAIT_TIMEOUT)
 
 
 #define AWAIT_EXPECT_SIGNALED_FOR(expected, actual, duration)           \
@@ -707,7 +750,7 @@ inline ::testing::AssertionResult AwaitAssertSignaled(
 
 
 #define AWAIT_EXPECT_SIGNALED(expected, actual)                 \
-  AWAIT_EXPECT_SIGNALED_FOR(expected, actual, Seconds(15))
+  AWAIT_EXPECT_SIGNALED_FOR(expected, actual, process::TEST_AWAIT_TIMEOUT)
 
 
 inline ::testing::AssertionResult AwaitAssertTermSigEq(
@@ -739,16 +782,22 @@ inline ::testing::AssertionResult AwaitAssertTermSigEq(
   ASSERT_PRED_FORMAT3(AwaitAssertTermSigEq, expected, actual, duration)
 
 
-#define AWAIT_ASSERT_WTERMSIG_EQ(expected, actual)              \
-  AWAIT_ASSERT_WTERMSIG_EQ_FOR(expected, actual, Seconds(15))
+#define AWAIT_ASSERT_WTERMSIG_EQ(expected, actual)  \
+  AWAIT_ASSERT_WTERMSIG_EQ_FOR(                     \
+      expected,                                     \
+      actual,                                       \
+      process::TEST_AWAIT_TIMEOUT)
 
 
 #define AWAIT_EXPECT_WTERMSIG_EQ_FOR(expected, actual, duration)        \
   EXPECT_PRED_FORMAT3(AwaitAssertTermSigEq, expected, actual, duration)
 
 
-#define AWAIT_EXPECT_WTERMSIG_EQ(expected, actual)              \
-  AWAIT_EXPECT_WTERMSIG_EQ_FOR(expected, actual, Seconds(15))
+#define AWAIT_EXPECT_WTERMSIG_EQ(expected, actual)  \
+  AWAIT_EXPECT_WTERMSIG_EQ_FOR(                     \
+      expected,                                     \
+      actual,                                       \
+      process::TEST_AWAIT_TIMEOUT)
 
 
 inline ::testing::AssertionResult AwaitAssertTermSigNe(
@@ -780,16 +829,22 @@ inline ::testing::AssertionResult AwaitAssertTermSigNe(
   ASSERT_PRED_FORMAT3(AwaitAssertTermSigNe, expected, actual, duration)
 
 
-#define AWAIT_ASSERT_WTERMSIG_NE(expected, actual)              \
-  AWAIT_ASSERT_TERMSIG_NE_FOR(expected, actual, Seconds(15))
+#define AWAIT_ASSERT_WTERMSIG_NE(expected, actual)  \
+  AWAIT_ASSERT_TERMSIG_NE_FOR(                      \
+      expected,                                     \
+      actual,                                       \
+      process::TEST_AWAIT_TIMEOUT
 
 
 #define AWAIT_EXPECT_TERMSIG_NE_FOR(expected, actual, duration)         \
   EXPECT_PRED_FORMAT3(AwaitAssertTermSigNe, expected, actual, duration)
 
 
-#define AWAIT_EXPECT_WTERMSIG_NE(expected, actual)              \
-  AWAIT_EXPECT_WTERMSIG_NE_FOR(expected, actual, Seconds(15))
+#define AWAIT_EXPECT_WTERMSIG_NE(expected, actual)  \
+  AWAIT_EXPECT_WTERMSIG_NE_FOR(                     \
+    expected,                                       \
+    actual,                                         \
+    process::TEST_AWAIT_TIMEOUT)
 
 
 // TODO(benh):

http://git-wip-us.apache.org/repos/asf/mesos/blob/4261077f/3rdparty/libprocess/include/process/gtest_constants.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/include/process/gtest_constants.hpp b/3rdparty/libprocess/include/process/gtest_constants.hpp
new file mode 100644
index 0000000..834be40
--- /dev/null
+++ b/3rdparty/libprocess/include/process/gtest_constants.hpp
@@ -0,0 +1,24 @@
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License
+
+#ifndef __PROCESS_GTEST_CONSTANTS_HPP__
+#define __PROCESS_GTEST_CONSTANTS_HPP__
+
+#include <stout/duration.hpp>
+
+namespace process {
+
+extern Duration TEST_AWAIT_TIMEOUT;
+
+} // namespace process {
+
+#endif // __PROCESS_GTEST_CONSTANTS_HPP__

http://git-wip-us.apache.org/repos/asf/mesos/blob/4261077f/3rdparty/libprocess/src/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/src/CMakeLists.txt b/3rdparty/libprocess/src/CMakeLists.txt
index f002c15..0ce7dac 100644
--- a/3rdparty/libprocess/src/CMakeLists.txt
+++ b/3rdparty/libprocess/src/CMakeLists.txt
@@ -25,9 +25,9 @@ endif ()
 # SOURCE FILES FOR THE PROCESS LIBRARY.
 #######################################
 set(PROCESS_SRC
+  authenticator.cpp
   authenticator_manager.cpp
   authenticator_manager.hpp
-  authenticator.cpp
   clock.cpp
   config.hpp
   decoder.hpp
@@ -36,6 +36,7 @@ set(PROCESS_SRC
   event_queue.hpp
   firewall.cpp
   gate.hpp
+  gtest_constants.cpp
   help.cpp
   http.cpp
   http_proxy.cpp
@@ -48,9 +49,9 @@ set(PROCESS_SRC
   pid.cpp
   poll_socket.cpp
   poll_socket.hpp
-  profiler.cpp
   process.cpp
   process_reference.hpp
+  profiler.cpp
   reap.cpp
   run_queue.hpp
   semaphore.hpp

http://git-wip-us.apache.org/repos/asf/mesos/blob/4261077f/3rdparty/libprocess/src/gtest_constants.cpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/src/gtest_constants.cpp b/3rdparty/libprocess/src/gtest_constants.cpp
new file mode 100644
index 0000000..ba10593
--- /dev/null
+++ b/3rdparty/libprocess/src/gtest_constants.cpp
@@ -0,0 +1,19 @@
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License
+
+#include <process/gtest_constants.hpp>
+
+namespace process {
+
+Duration TEST_AWAIT_TIMEOUT = Seconds(15);
+
+} // namespace process {


[3/4] mesos git commit: Split test flags into header and source files.

Posted by jp...@apache.org.
Split test flags into header and source files.

Split the test flags into header and source files to reduce the amount
of recompilation necessary when the implementation changes.

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


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

Branch: refs/heads/master
Commit: f6eb3933798fd9738c09697627a3c75df4d4215d
Parents: cbcc903
Author: James Peach <jp...@apache.org>
Authored: Fri Feb 16 11:37:23 2018 -0800
Committer: James Peach <jp...@apache.org>
Committed: Fri Feb 16 11:37:23 2018 -0800

----------------------------------------------------------------------
 src/tests/flags.cpp | 140 ++++++++++++++++++++++++++++++++++++++++++++++
 src/tests/flags.hpp | 142 ++---------------------------------------------
 2 files changed, 144 insertions(+), 138 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/f6eb3933/src/tests/flags.cpp
----------------------------------------------------------------------
diff --git a/src/tests/flags.cpp b/src/tests/flags.cpp
index 4542f34..f09a6ad 100644
--- a/src/tests/flags.cpp
+++ b/src/tests/flags.cpp
@@ -14,7 +14,22 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
+#include <mesos/type_utils.hpp>
+
+#include <stout/check.hpp>
+#include <stout/result.hpp>
+
+#include <stout/os/realpath.hpp>
+
+#include "master/constants.hpp"
+
+#include "slave/constants.hpp"
+
 #include "tests/flags.hpp"
+#include "tests/mesos.hpp"
+
+using std::string;
+
 
 namespace mesos {
 namespace internal {
@@ -23,6 +38,131 @@ namespace tests {
 // Storage for the flags.
 Flags flags;
 
+Flags::Flags()
+{
+  // We log to stderr by default, but when running tests we'd prefer
+  // less junk to fly by, so force one to specify the verbosity.
+  add(&Flags::verbose,
+      "verbose",
+      "Log all severity levels to stderr",
+      false);
+
+  add(&Flags::benchmark,
+      "benchmark",
+      "Run the benchmark tests (and skip other tests)",
+      false);
+
+  // We determine the defaults for 'source_dir' and 'build_dir' from
+  // preprocessor definitions (at the time this comment was written
+  // these were set via '-DSOURCE_DIR=...' and '-DBUILD_DIR=...' in
+  // src/Makefile.am).
+  Result<string> path = os::realpath(SOURCE_DIR);
+  CHECK_SOME(path);
+  add(&Flags::source_dir,
+      "source_dir",
+      "Where to find the source directory",
+      path.get());
+
+  path = os::realpath(BUILD_DIR);
+  CHECK_SOME(path);
+
+  add(&Flags::build_dir,
+      "build_dir",
+      "Where to find the build directory",
+      path.get());
+
+  add(&Flags::docker,
+      "docker",
+      "Where to find docker executable",
+      "docker");
+
+  add(&Flags::docker_socket,
+      "docker_socket",
+      "Resource used by the agent and the executor to provide CLI access\n"
+      "to the Docker daemon. On Unix, this is typically a path to a\n"
+      "socket, such as '/var/run/docker.sock'. On Windows this must be a\n"
+      "named pipe, such as '//./pipe/docker_engine'. NOTE: This must be\n"
+      "the path used by the Docker image used to run the agent.\n",
+      slave::DEFAULT_DOCKER_HOST_RESOURCE);
+
+  // This help message for --modules flag is the same for
+  // {master,slave,sched,tests}/flags.[ch]pp and should always be kept in
+  // sync.
+  // TODO(karya): Remove the JSON example and add reference to the
+  // doc file explaining the --modules flag.
+  add(&Flags::modules,
+      "modules",
+      "List of modules to be loaded and be available to the internal\n"
+      "subsystems.\n"
+      "\n"
+      "Use --modules=filepath to specify the list of modules via a\n"
+      "file containing a JSON-formatted string. 'filepath' can be\n"
+      "of the form 'file:///path/to/file' or '/path/to/file'.\n"
+      "\n"
+      "Use --modules=\"{...}\" to specify the list of modules inline.\n"
+      "\n"
+      "Example:\n"
+      "{\n"
+      "  \"libraries\": [\n"
+      "    {\n"
+      "      \"file\": \"/path/to/libfoo.so\",\n"
+      "      \"modules\": [\n"
+      "        {\n"
+      "          \"name\": \"org_apache_mesos_bar\",\n"
+      "          \"parameters\": [\n"
+      "            {\n"
+      "              \"key\": \"X\",\n"
+      "              \"value\": \"Y\"\n"
+      "            }\n"
+      "          ]\n"
+      "        },\n"
+      "        {\n"
+      "          \"name\": \"org_apache_mesos_baz\"\n"
+      "        }\n"
+      "      ]\n"
+      "    },\n"
+      "    {\n"
+      "      \"name\": \"qux\",\n"
+      "      \"modules\": [\n"
+      "        {\n"
+      "          \"name\": \"org_apache_mesos_norf\"\n"
+      "        }\n"
+      "      ]\n"
+      "    }\n"
+      "  ]\n"
+      "}");
+
+  // This help message for --modules_dir flag is the same for
+  // {master,slave,sched,tests}/flags.[ch]pp and should always be kept in
+  // sync.
+  add(&Flags::modulesDir,
+      "modules_dir",
+      "Directory path of the module manifest files.\n"
+      "The manifest files are processed in alphabetical order.\n"
+      "(See --modules for more information on module manifest files).\n"
+      "Cannot be used in conjunction with --modules.\n");
+
+  // This help message is duplicated from slave/flags.hpp and
+  // should always be kept in sync with that.
+  add(&Flags::isolation,
+      "isolation",
+      "Isolation mechanisms to use, e.g., 'posix/cpu,posix/mem', or\n"
+      "'cgroups/cpu,cgroups/mem', or network/port_mapping\n"
+      "(configure with flag: --with-network-isolator to enable),\n"
+      "or 'external', or load an alternate isolator module using\n"
+      "the --modules flag.");
+
+  // This help message is duplicated from master/flags.hpp and
+  // should always be kept in sync with that.
+  add(&Flags::authenticators,
+      "authenticators",
+      "Authenticator implementation to use when authenticating frameworks\n"
+      "and/or agents. Use the default '" +
+      string(master::DEFAULT_AUTHENTICATOR) + "', or\n"
+      "load an alternate authenticator module using --modules.",
+      master::DEFAULT_AUTHENTICATOR);
+}
+
 } // namespace tests {
 } // namespace internal {
 } // namespace mesos {

http://git-wip-us.apache.org/repos/asf/mesos/blob/f6eb3933/src/tests/flags.hpp
----------------------------------------------------------------------
diff --git a/src/tests/flags.hpp b/src/tests/flags.hpp
index df4d458..2894f49 100644
--- a/src/tests/flags.hpp
+++ b/src/tests/flags.hpp
@@ -19,23 +19,12 @@
 
 #include <string>
 
-#include <mesos/type_utils.hpp>
+#include <mesos/module/module.hpp>
 
-#include <stout/check.hpp>
 #include <stout/flags.hpp>
-#include <stout/os.hpp>
+#include <stout/option.hpp>
 
-#include <stout/os/realpath.hpp>
-
-#include "common/parse.hpp"
-
-#include "logging/logging.hpp"
-
-#include "master/constants.hpp"
-
-#include "messages/messages.hpp"
-
-#include "slave/constants.hpp"
+#include "logging/flags.hpp"
 
 namespace mesos {
 namespace internal {
@@ -44,130 +33,7 @@ namespace tests {
 class Flags : public virtual logging::Flags
 {
 public:
-  Flags()
-  {
-    // We log to stderr by default, but when running tests we'd prefer
-    // less junk to fly by, so force one to specify the verbosity.
-    add(&Flags::verbose,
-        "verbose",
-        "Log all severity levels to stderr",
-        false);
-
-    add(&Flags::benchmark,
-        "benchmark",
-        "Run the benchmark tests (and skip other tests)",
-        false);
-
-    // We determine the defaults for 'source_dir' and 'build_dir' from
-    // preprocessor definitions (at the time this comment was written
-    // these were set via '-DSOURCE_DIR=...' and '-DBUILD_DIR=...' in
-    // src/Makefile.am).
-    Result<std::string> path = os::realpath(SOURCE_DIR);
-    CHECK_SOME(path);
-    add(&Flags::source_dir,
-        "source_dir",
-        "Where to find the source directory",
-        path.get());
-
-    path = os::realpath(BUILD_DIR);
-    CHECK_SOME(path);
-
-    add(&Flags::build_dir,
-        "build_dir",
-        "Where to find the build directory",
-        path.get());
-
-    add(&Flags::docker,
-        "docker",
-        "Where to find docker executable",
-        "docker");
-
-    add(&Flags::docker_socket,
-        "docker_socket",
-        "Resource used by the agent and the executor to provide CLI access\n"
-        "to the Docker daemon. On Unix, this is typically a path to a\n"
-        "socket, such as '/var/run/docker.sock'. On Windows this must be a\n"
-        "named pipe, such as '//./pipe/docker_engine'. NOTE: This must be\n"
-        "the path used by the Docker image used to run the agent.\n",
-        slave::DEFAULT_DOCKER_HOST_RESOURCE);
-
-    // This help message for --modules flag is the same for
-    // {master,slave,sched,tests}/flags.[ch]pp and should always be kept in
-    // sync.
-    // TODO(karya): Remove the JSON example and add reference to the
-    // doc file explaining the --modules flag.
-    add(&Flags::modules,
-        "modules",
-        "List of modules to be loaded and be available to the internal\n"
-        "subsystems.\n"
-        "\n"
-        "Use --modules=filepath to specify the list of modules via a\n"
-        "file containing a JSON-formatted string. 'filepath' can be\n"
-        "of the form 'file:///path/to/file' or '/path/to/file'.\n"
-        "\n"
-        "Use --modules=\"{...}\" to specify the list of modules inline.\n"
-        "\n"
-        "Example:\n"
-        "{\n"
-        "  \"libraries\": [\n"
-        "    {\n"
-        "      \"file\": \"/path/to/libfoo.so\",\n"
-        "      \"modules\": [\n"
-        "        {\n"
-        "          \"name\": \"org_apache_mesos_bar\",\n"
-        "          \"parameters\": [\n"
-        "            {\n"
-        "              \"key\": \"X\",\n"
-        "              \"value\": \"Y\"\n"
-        "            }\n"
-        "          ]\n"
-        "        },\n"
-        "        {\n"
-        "          \"name\": \"org_apache_mesos_baz\"\n"
-        "        }\n"
-        "      ]\n"
-        "    },\n"
-        "    {\n"
-        "      \"name\": \"qux\",\n"
-        "      \"modules\": [\n"
-        "        {\n"
-        "          \"name\": \"org_apache_mesos_norf\"\n"
-        "        }\n"
-        "      ]\n"
-        "    }\n"
-        "  ]\n"
-        "}");
-
-    // This help message for --modules_dir flag is the same for
-    // {master,slave,sched,tests}/flags.[ch]pp and should always be kept in
-    // sync.
-    add(&Flags::modulesDir,
-        "modules_dir",
-        "Directory path of the module manifest files.\n"
-        "The manifest files are processed in alphabetical order.\n"
-        "(See --modules for more information on module manifest files).\n"
-        "Cannot be used in conjunction with --modules.\n");
-
-    // This help message is duplicated from slave/flags.hpp and
-    // should always be kept in sync with that.
-    add(&Flags::isolation,
-        "isolation",
-        "Isolation mechanisms to use, e.g., 'posix/cpu,posix/mem', or\n"
-        "'cgroups/cpu,cgroups/mem', or network/port_mapping\n"
-        "(configure with flag: --with-network-isolator to enable),\n"
-        "or 'external', or load an alternate isolator module using\n"
-        "the --modules flag.");
-
-    // This help message is duplicated from master/flags.hpp and
-    // should always be kept in sync with that.
-    add(&Flags::authenticators,
-        "authenticators",
-        "Authenticator implementation to use when authenticating frameworks\n"
-        "and/or agents. Use the default '" +
-        std::string(master::DEFAULT_AUTHENTICATOR) + "', or\n"
-        "load an alternate authenticator module using --modules.",
-        master::DEFAULT_AUTHENTICATOR);
-  }
+  Flags();
 
   bool verbose;
   bool benchmark;


[2/4] mesos git commit: Adopted `TEST_AWAIT_TIMEOUT` in libprocess tests.

Posted by jp...@apache.org.
Adopted `TEST_AWAIT_TIMEOUT` in libprocess tests.

Rather than hard-coding a 15sec test timeout, use the libprocess
`TEST_AWAIT_TIMEOUT` variable so that this can be globally tuned.
Added a test flag `--test_await_timeout` that can be used to set
the `TEST_AWAIT_TIMEOUT` on a test run.

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


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

Branch: refs/heads/master
Commit: cbcc903d4edc2cb9b2a9c0a8f3205d6f1a547bea
Parents: 4261077
Author: James Peach <jp...@apache.org>
Authored: Fri Feb 16 11:37:17 2018 -0800
Committer: James Peach <jp...@apache.org>
Committed: Fri Feb 16 11:37:17 2018 -0800

----------------------------------------------------------------------
 3rdparty/libprocess/src/tests/main.cpp          | 48 +++++++++++++++++---
 .../libprocess/src/tests/subprocess_tests.cpp   | 28 +++++++-----
 2 files changed, 57 insertions(+), 19 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/cbcc903d/3rdparty/libprocess/src/tests/main.cpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/src/tests/main.cpp b/3rdparty/libprocess/src/tests/main.cpp
index 4633bea..db94db6 100644
--- a/3rdparty/libprocess/src/tests/main.cpp
+++ b/3rdparty/libprocess/src/tests/main.cpp
@@ -12,6 +12,7 @@
 
 #include <signal.h>
 
+#include <iostream>
 #include <memory>
 #include <string>
 #include <vector>
@@ -27,7 +28,9 @@
 #include <process/gtest.hpp>
 #include <process/process.hpp>
 
+#include <stout/duration.hpp>
 #include <stout/exit.hpp>
+#include <stout/flags.hpp>
 
 #ifndef __WINDOWS__
 #include <stout/os/signals.hpp>
@@ -35,6 +38,9 @@
 
 #include <stout/tests/environment.hpp>
 
+using std::cerr;
+using std::cout;
+using std::endl;
 using std::make_shared;
 using std::shared_ptr;
 using std::string;
@@ -46,18 +52,46 @@ using stout::internal::tests::TestFilter;
 using std::shared_ptr;
 using std::vector;
 
-// NOTE: We use RAW_LOG instead of LOG because RAW_LOG doesn't
-// allocate any memory or grab locks. And according to
-// https://code.google.com/p/google-glog/issues/detail?id=161
-// it should work in 'most' cases in signal handlers.
-inline void handler(int signal)
+namespace {
+
+class Flags : public virtual flags::FlagsBase
 {
-  RAW_LOG(FATAL, "Unexpected signal in signal handler: %d", signal);
-}
+public:
+  Flags()
+  {
+    add(&Flags::test_await_timeout,
+        "test_await_timeout",
+        "The default timeout for awaiting test events.",
+        process::TEST_AWAIT_TIMEOUT);
+  }
+
+  Duration test_await_timeout;
+};
+
+} // namespace {
 
 
 int main(int argc, char** argv)
 {
+  Flags flags;
+
+  // Load flags from environment and command line but allow unknown
+  // flags (since we might have gtest/gmock flags as well).
+  Try<flags::Warnings> load = flags.load("LIBPROCESS_", argc, argv, true);
+
+  if (flags.help) {
+    cout << flags.usage() << endl;
+    testing::InitGoogleMock(&argc, argv); // Get usage from gtest too.
+    return EXIT_SUCCESS;
+  }
+
+  if (load.isError()) {
+    cerr << flags.usage(load.error()) << endl;
+    return EXIT_FAILURE;
+  }
+
+  process::TEST_AWAIT_TIMEOUT = flags.test_await_timeout;
+
   // Initialize Google Mock/Test.
   testing::InitGoogleMock(&argc, argv);
 

http://git-wip-us.apache.org/repos/asf/mesos/blob/cbcc903d/3rdparty/libprocess/src/tests/subprocess_tests.cpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/src/tests/subprocess_tests.cpp b/3rdparty/libprocess/src/tests/subprocess_tests.cpp
index 8211ae6..ead5ded 100644
--- a/3rdparty/libprocess/src/tests/subprocess_tests.cpp
+++ b/3rdparty/libprocess/src/tests/subprocess_tests.cpp
@@ -619,18 +619,20 @@ TEST_F(SubprocessTest, Default)
 #endif // __WINDOWS__
 
 
-struct Flags : public virtual flags::FlagsBase
+namespace {
+
+struct TestFlags : public virtual flags::FlagsBase
 {
-  Flags()
+  TestFlags()
   {
-    add(&Flags::b, "b", "bool");
-    add(&Flags::i, "i", "int");
-    add(&Flags::s, "s", "string");
-    add(&Flags::s2, "s2", "string with single quote");
-    add(&Flags::s3, "s3", "string with double quote");
-    add(&Flags::d, "d", "Duration");
-    add(&Flags::y, "y", "Bytes");
-    add(&Flags::j, "j", "JSON::Object");
+    add(&TestFlags::b, "b", "bool");
+    add(&TestFlags::i, "i", "int");
+    add(&TestFlags::s, "s", "string");
+    add(&TestFlags::s2, "s2", "string with single quote");
+    add(&TestFlags::s3, "s3", "string with double quote");
+    add(&TestFlags::d, "d", "Duration");
+    add(&TestFlags::y, "y", "Bytes");
+    add(&TestFlags::j, "j", "JSON::Object");
   }
 
   Option<bool> b;
@@ -643,6 +645,8 @@ struct Flags : public virtual flags::FlagsBase
   Option<JSON::Object> j;
 };
 
+} // namespace {
+
 
 // NOTE: These tests can't be run on Windows because the rely on functionality
 // that does not exist on Windows. For example, `os::nonblock` will not work on
@@ -650,7 +654,7 @@ struct Flags : public virtual flags::FlagsBase
 #ifndef __WINDOWS__
 TEST_F(SubprocessTest, Flags)
 {
-  Flags flags;
+  TestFlags flags;
   flags.b = true;
   flags.i = 42;
   flags.s = "hello";
@@ -714,7 +718,7 @@ TEST_F(SubprocessTest, Flags)
     argv[i] = ::strdup(split[i - 1].c_str());
   }
 
-  Flags flags2;
+  TestFlags flags2;
   Try<flags::Warnings> load = flags2.load(None(), argc, argv);
   ASSERT_SOME(load);
   EXPECT_TRUE(load->warnings.empty());


[4/4] mesos git commit: Adopted `TEST_AWAIT_TIMEOUT` in Mesos tests.

Posted by jp...@apache.org.
Adopted `TEST_AWAIT_TIMEOUT` in Mesos tests.

Rather than hard-coding a 15sec test timeout, use the libprocess
`TEST_AWAIT_TIMEOUT` variable so that this can be globally tuned.
Added a test flag `--test_await_timeout` that can be used to set
the `TEST_AWAIT_TIMEOUT` on a test run.

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


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

Branch: refs/heads/master
Commit: 3def7fea56ffbe1950092c0f79c056bbc2559164
Parents: f6eb393
Author: James Peach <jp...@apache.org>
Authored: Fri Feb 16 11:37:26 2018 -0800
Committer: James Peach <jp...@apache.org>
Committed: Fri Feb 16 11:37:26 2018 -0800

----------------------------------------------------------------------
 src/tests/agent_container_api_tests.cpp            |  9 +++++----
 src/tests/containerizer/cgroups_isolator_tests.cpp |  2 +-
 src/tests/containerizer/xfs_quota_tests.cpp        |  2 +-
 src/tests/disk_quota_tests.cpp                     |  2 +-
 src/tests/fetcher_cache_tests.cpp                  | 14 ++++----------
 src/tests/flags.cpp                                |  9 +++++++++
 src/tests/flags.hpp                                |  2 ++
 src/tests/gc_tests.cpp                             |  3 ++-
 src/tests/main.cpp                                 |  3 +++
 src/tests/master_contender_detector_tests.cpp      |  3 ++-
 src/tests/registrar_tests.cpp                      |  2 +-
 src/tests/slave_recovery_tests.cpp                 |  3 ++-
 src/tests/slave_tests.cpp                          |  3 ++-
 13 files changed, 35 insertions(+), 22 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/3def7fea/src/tests/agent_container_api_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/agent_container_api_tests.cpp b/src/tests/agent_container_api_tests.cpp
index 6185692..1dcc256 100644
--- a/src/tests/agent_container_api_tests.cpp
+++ b/src/tests/agent_container_api_tests.cpp
@@ -66,6 +66,7 @@ using mesos::internal::slave::MesosContainerizer;
 using mesos::internal::slave::Slave;
 
 using process::Clock;
+using process::TEST_AWAIT_TIMEOUT;
 using process::Failure;
 using process::Future;
 using process::Owned;
@@ -179,7 +180,7 @@ public:
 
         normal->driver->start();
 
-        offers.await(Seconds(15));
+        offers.await(TEST_AWAIT_TIMEOUT);
         if (!offers.isReady() || offers->empty()) {
           return Error("Failed to get offer(s)");
         }
@@ -193,7 +194,7 @@ public:
 
         normal->driver->launchTasks(offers->front().id(), {task});
 
-        statusRunning.await(Seconds(15));
+        statusRunning.await(TEST_AWAIT_TIMEOUT);
         if (!statusRunning.isReady() &&
             statusRunning->state() != TASK_RUNNING) {
           return Error("Failed to launch parent container");
@@ -205,7 +206,7 @@ public:
 
         Future<v1::agent::Response> containers = deserialize(post(slave, call));
 
-        containers.await(Seconds(15));
+        containers.await(TEST_AWAIT_TIMEOUT);
         if (!containers.isReady() ||
             containers->get_containers().containers_size() != 1u) {
           return Error("Failed to get parent ContainerID");
@@ -220,7 +221,7 @@ public:
         Future<SlaveRegisteredMessage> slaveRegisteredMessage =
           FUTURE_PROTOBUF(SlaveRegisteredMessage(), _, _);
 
-        slaveRegisteredMessage.await(Seconds(15));
+        slaveRegisteredMessage.await(TEST_AWAIT_TIMEOUT);
         if (!slaveRegisteredMessage.isReady()) {
           return Error("Failed to register agent");
         }

http://git-wip-us.apache.org/repos/asf/mesos/blob/3def7fea/src/tests/containerizer/cgroups_isolator_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/containerizer/cgroups_isolator_tests.cpp b/src/tests/containerizer/cgroups_isolator_tests.cpp
index 5412a7e..59b23be 100644
--- a/src/tests/containerizer/cgroups_isolator_tests.cpp
+++ b/src/tests/containerizer/cgroups_isolator_tests.cpp
@@ -1728,7 +1728,7 @@ TEST_F(CgroupsIsolatorTest, ROOT_CGROUPS_BlkioUsage)
 
     os::sleep(Seconds(1));
     waited += Seconds(1);
-  } while (waited < Seconds(15));
+  } while (waited < process::TEST_AWAIT_TIMEOUT);
 
   ASSERT_SOME(fileSize);
   ASSERT_EQ(10240u, fileSize->bytes());

http://git-wip-us.apache.org/repos/asf/mesos/blob/3def7fea/src/tests/containerizer/xfs_quota_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/containerizer/xfs_quota_tests.cpp b/src/tests/containerizer/xfs_quota_tests.cpp
index d761ea4..ce69c88 100644
--- a/src/tests/containerizer/xfs_quota_tests.cpp
+++ b/src/tests/containerizer/xfs_quota_tests.cpp
@@ -158,7 +158,7 @@ public:
           Subprocess::PATH(os::DEV_NULL));
 
       if (cmdProcess.isSome()) {
-        cmdProcess->status().await(Seconds(15));
+        cmdProcess->status().await(process::TEST_AWAIT_TIMEOUT);
       }
     }
 

http://git-wip-us.apache.org/repos/asf/mesos/blob/3def7fea/src/tests/disk_quota_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/disk_quota_tests.cpp b/src/tests/disk_quota_tests.cpp
index 31cf4c4..db53108 100644
--- a/src/tests/disk_quota_tests.cpp
+++ b/src/tests/disk_quota_tests.cpp
@@ -756,7 +756,7 @@ TEST_F(DiskQuotaTest, SlaveRecovery)
       }
     }
 
-    ASSERT_LT(elapsed, Seconds(15));
+    ASSERT_LT(elapsed, process::TEST_AWAIT_TIMEOUT);
 
     os::sleep(Milliseconds(1));
     elapsed += Milliseconds(1);

http://git-wip-us.apache.org/repos/asf/mesos/blob/3def7fea/src/tests/fetcher_cache_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/fetcher_cache_tests.cpp b/src/tests/fetcher_cache_tests.cpp
index 7db7b7d..4d9e5d8 100644
--- a/src/tests/fetcher_cache_tests.cpp
+++ b/src/tests/fetcher_cache_tests.cpp
@@ -30,6 +30,7 @@
 #include <process/collect.hpp>
 #include <process/future.hpp>
 #include <process/gmock.hpp>
+#include <process/gtest.hpp>
 #include <process/latch.hpp>
 #include <process/message.hpp>
 #include <process/owned.hpp>
@@ -74,6 +75,7 @@ using mesos::internal::slave::FetcherProcess;
 
 using mesos::master::detector::MasterDetector;
 
+using process::TEST_AWAIT_TIMEOUT;
 using process::Future;
 using process::HttpEvent;
 using process::Latch;
@@ -452,11 +454,7 @@ Try<FetcherCacheTest::Task> FetcherCacheTest::launchTask(
     .WillOnce(FutureArg<1>(&offers))
     .WillRepeatedly(DeclineOffers());
 
-  // The default timeout in AWAIT_READY is 15 seconds,
-  // so we use that amount here.
-  // TODO(bernd-mesos): Make this a symbolic constant in "gtest.hpp"
-  // that we can reference here.
-  offers.await(Seconds(15));
+  offers.await(TEST_AWAIT_TIMEOUT);
   if (!offers.isReady()) {
     return Error("Failed to wait for resource offers: " +
            (offers.isFailed() ? offers.failure() : "discarded"));
@@ -565,11 +563,7 @@ Try<vector<FetcherCacheTest::Task>> FetcherCacheTest::launchTasks(
     .WillOnce(FutureArg<1>(&offers))
     .WillRepeatedly(DeclineOffers());
 
-  // The default timeout in AWAIT_READY is 15 seconds,
-  // so we use that amount here.
-  // TODO(bernd-mesos): Make this a symbolic constant in "gtest.hpp"
-  // that we can reference here.
-  offers.await(Seconds(15));
+  offers.await(TEST_AWAIT_TIMEOUT);
   if (!offers.isReady()) {
     return Error("Failed to wait for resource offers: " +
            (offers.isFailed() ? offers.failure() : "discarded"));

http://git-wip-us.apache.org/repos/asf/mesos/blob/3def7fea/src/tests/flags.cpp
----------------------------------------------------------------------
diff --git a/src/tests/flags.cpp b/src/tests/flags.cpp
index f09a6ad..5cc4660 100644
--- a/src/tests/flags.cpp
+++ b/src/tests/flags.cpp
@@ -16,6 +16,8 @@
 
 #include <mesos/type_utils.hpp>
 
+#include <process/gtest.hpp>
+
 #include <stout/check.hpp>
 #include <stout/result.hpp>
 
@@ -161,6 +163,13 @@ Flags::Flags()
       string(master::DEFAULT_AUTHENTICATOR) + "', or\n"
       "load an alternate authenticator module using --modules.",
       master::DEFAULT_AUTHENTICATOR);
+
+  // NOTE: The default await timeout matches process::TEST_AWAIT_TIMEOUT,
+  // but we can't use that value directly due to static initializer ordering.
+  add(&Flags::test_await_timeout,
+      "test_await_timeout",
+      "The default timeout for awaiting test events.",
+      Seconds(15));
 }
 
 } // namespace tests {

http://git-wip-us.apache.org/repos/asf/mesos/blob/3def7fea/src/tests/flags.hpp
----------------------------------------------------------------------
diff --git a/src/tests/flags.hpp b/src/tests/flags.hpp
index 2894f49..311b490 100644
--- a/src/tests/flags.hpp
+++ b/src/tests/flags.hpp
@@ -21,6 +21,7 @@
 
 #include <mesos/module/module.hpp>
 
+#include <stout/duration.hpp>
 #include <stout/flags.hpp>
 #include <stout/option.hpp>
 
@@ -45,6 +46,7 @@ public:
   Option<std::string> modulesDir;
   Option<std::string> isolation;
   std::string authenticators;
+  Duration test_await_timeout;
 };
 
 // Global flags for running the tests.

http://git-wip-us.apache.org/repos/asf/mesos/blob/3def7fea/src/tests/gc_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/gc_tests.cpp b/src/tests/gc_tests.cpp
index 947399e..bff3c05 100644
--- a/src/tests/gc_tests.cpp
+++ b/src/tests/gc_tests.cpp
@@ -28,6 +28,7 @@
 #include <process/dispatch.hpp>
 #include <process/future.hpp>
 #include <process/gmock.hpp>
+#include <process/gtest.hpp>
 #include <process/http.hpp>
 #include <process/owned.hpp>
 #include <process/pid.hpp>
@@ -987,7 +988,7 @@ TEST_F(GarbageCollectorIntegrationTest, ROOT_BusyMountPoint)
   EXPECT_TRUE(os::exists(sandbox));
 
   // Wait for the task to create these paths.
-  Timeout timeout = Timeout::in(Seconds(15));
+  Timeout timeout = Timeout::in(process::TEST_AWAIT_TIMEOUT);
   while (!os::exists(path::join(sandbox, mountPoint)) ||
          !os::exists(path::join(sandbox, regularFile)) ||
          !timeout.expired()) {

http://git-wip-us.apache.org/repos/asf/mesos/blob/3def7fea/src/tests/main.cpp
----------------------------------------------------------------------
diff --git a/src/tests/main.cpp b/src/tests/main.cpp
index f945ac9..e5ef73d 100644
--- a/src/tests/main.cpp
+++ b/src/tests/main.cpp
@@ -18,6 +18,7 @@
 
 #include <gtest/gtest.h>
 
+#include <process/gtest.hpp>
 #include <process/process.hpp>
 
 #include <stout/flags.hpp>
@@ -104,6 +105,8 @@ int main(int argc, char** argv)
     flags.quiet = true;
   }
 
+  process::TEST_AWAIT_TIMEOUT = flags.test_await_timeout;
+
   // Initialize logging.
   logging::initialize(argv[0], true, flags);
 

http://git-wip-us.apache.org/repos/asf/mesos/blob/3def7fea/src/tests/master_contender_detector_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/master_contender_detector_tests.cpp b/src/tests/master_contender_detector_tests.cpp
index 015d310..8802e45 100644
--- a/src/tests/master_contender_detector_tests.cpp
+++ b/src/tests/master_contender_detector_tests.cpp
@@ -28,6 +28,7 @@
 
 #include <process/clock.hpp>
 #include <process/future.hpp>
+#include <process/gtest.hpp>
 #include <process/owned.hpp>
 #include <process/pid.hpp>
 #include <process/protobuf.hpp>
@@ -469,7 +470,7 @@ TEST_F(ZooKeeperMasterContenderDetectorTest, ContenderDetectorShutdownNetwork)
 
   ASSERT_SOME(url);
 
-  Duration sessionTimeout = Seconds(15);
+  Duration sessionTimeout = process::TEST_AWAIT_TIMEOUT;
 
   ZooKeeperMasterContender contender(url.get(), sessionTimeout);
 

http://git-wip-us.apache.org/repos/asf/mesos/blob/3def7fea/src/tests/registrar_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/registrar_tests.cpp b/src/tests/registrar_tests.cpp
index cbb58c1..d3e4ee0 100644
--- a/src/tests/registrar_tests.cpp
+++ b/src/tests/registrar_tests.cpp
@@ -176,7 +176,7 @@ protected:
     state = new State(storage);
 
     // Compensate for slow CI machines / VMs.
-    flags.registry_store_timeout = Seconds(15);
+    flags.registry_store_timeout = process::TEST_AWAIT_TIMEOUT;
 
     master.CopyFrom(protobuf::createMasterInfo(UPID("master@127.0.0.1:5050")));
 

http://git-wip-us.apache.org/repos/asf/mesos/blob/3def7fea/src/tests/slave_recovery_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/slave_recovery_tests.cpp b/src/tests/slave_recovery_tests.cpp
index 898270d..5a3f19f 100644
--- a/src/tests/slave_recovery_tests.cpp
+++ b/src/tests/slave_recovery_tests.cpp
@@ -35,6 +35,7 @@
 
 #include <process/dispatch.hpp>
 #include <process/gmock.hpp>
+#include <process/gtest.hpp>
 #include <process/http.hpp>
 #include <process/owned.hpp>
 #include <process/reap.hpp>
@@ -940,7 +941,7 @@ TYPED_TEST(SlaveRecoveryTest, PingTimeoutDuringRecovery)
   // Set the executor re-register timeout to a value greater than
   // (agent_ping_timeout * (max_agent_ping_timeouts + 1)).
   slave::Flags slaveFlags = this->CreateSlaveFlags();
-  slaveFlags.executor_reregistration_timeout = Seconds(15);
+  slaveFlags.executor_reregistration_timeout = process::TEST_AWAIT_TIMEOUT;
 
   Fetcher fetcher(slaveFlags);
 

http://git-wip-us.apache.org/repos/asf/mesos/blob/3def7fea/src/tests/slave_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/slave_tests.cpp b/src/tests/slave_tests.cpp
index d2c242e..b80d864 100644
--- a/src/tests/slave_tests.cpp
+++ b/src/tests/slave_tests.cpp
@@ -40,6 +40,7 @@
 #include <process/collect.hpp>
 #include <process/future.hpp>
 #include <process/gmock.hpp>
+#include <process/gtest.hpp>
 #include <process/http.hpp>
 #include <process/owned.hpp>
 #include <process/pid.hpp>
@@ -9224,7 +9225,7 @@ TEST_F(SlaveTest, ExecutorReregistrationTimeoutFlag)
 
   // Set the executor re-register timeout to a value greater than the default.
   slave::Flags slaveFlags = CreateSlaveFlags();
-  slaveFlags.executor_reregistration_timeout = Seconds(15);
+  slaveFlags.executor_reregistration_timeout = process::TEST_AWAIT_TIMEOUT;
 
   Fetcher fetcher(slaveFlags);