You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by an...@apache.org on 2017/12/06 23:44:30 UTC

[1/3] mesos git commit: Windows: Enabled HTTP health checks.

Repository: mesos
Updated Branches:
  refs/heads/master f031e031f -> 20a877747


Windows: Enabled HTTP health checks.

This required an additional dependency on `curl` for Windows, which is
an imported target that is deployed next to the other executables by
CMake. With it in place, the HTTP health check unit tests were enabled
for Windows.

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


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

Branch: refs/heads/master
Commit: 20a8777471f7719e76a69a0d525acd81322e17fb
Parents: 9e9de11
Author: John Kordich <jo...@microsoft.com>
Authored: Wed Dec 6 12:14:47 2017 -0800
Committer: Andrew Schwartzmeyer <an...@schwartzmeyer.com>
Committed: Wed Dec 6 14:09:52 2017 -0800

----------------------------------------------------------------------
 src/slave/CMakeLists.txt         |  7 ++++++-
 src/tests/health_check_tests.cpp | 14 +++-----------
 2 files changed, 9 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/20a87774/src/slave/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/src/slave/CMakeLists.txt b/src/slave/CMakeLists.txt
index 638d602..5782ddc 100644
--- a/src/slave/CMakeLists.txt
+++ b/src/slave/CMakeLists.txt
@@ -34,7 +34,12 @@ add_dependencies(
   mesos-tcp-connect
   mesos-usage)
 
-if (NOT WIN32)
+if (WIN32)
+  # NOTE: The agent depends on `curl` on non-Windows platforms too, but not as
+  # part of the build. This is necessary because we use CMake to deploy
+  # `curl.exe` on Windows for use in the HTTP health checks.
+  add_dependencies(mesos-agent curl)
+else ()
   add_dependencies(
     mesos-agent
     mesos-cni-port-mapper

http://git-wip-us.apache.org/repos/asf/mesos/blob/20a87774/src/tests/health_check_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/health_check_tests.cpp b/src/tests/health_check_tests.cpp
index 56721fa..c716ad9 100644
--- a/src/tests/health_check_tests.cpp
+++ b/src/tests/health_check_tests.cpp
@@ -761,7 +761,7 @@ TEST_F(HealthCheckTest, HealthyTaskNonShell)
 
 // This test creates a task whose health flaps, and verifies that the
 // health status updates are sent to the framework scheduler.
-TEST_F_TEMP_DISABLED_ON_WINDOWS(HealthCheckTest, HealthStatusChange)
+TEST_F(HealthCheckTest, HealthStatusChange)
 {
   Try<Owned<cluster::Master>> master = StartMaster();
   ASSERT_SOME(master);
@@ -1392,11 +1392,7 @@ TEST_F(HealthCheckTest, HealthyToUnhealthyTransitionWithinGracePeriod)
 
 
 // Tests a healthy non-contained task via HTTP.
-//
-// TODO(josephw): Enable this. Mesos builds its own `curl.exe`, since it
-// can't rely on a package manager to get it. We need to make this test use
-// that executable.
-TEST_F_TEMP_DISABLED_ON_WINDOWS(HealthCheckTest, HealthyTaskViaHTTP)
+TEST_F(HealthCheckTest, HealthyTaskViaHTTP)
 {
   master::Flags masterFlags = CreateMasterFlags();
   masterFlags.allocation_interval = Milliseconds(50);
@@ -1486,11 +1482,7 @@ TEST_F_TEMP_DISABLED_ON_WINDOWS(HealthCheckTest, HealthyTaskViaHTTP)
 // with the difference being the health check type is not set.
 //
 // TODO(haosdent): Remove this after the deprecation cycle which starts in 2.0.
-//
-// TODO(josephw): Enable this. Mesos builds its own `curl.exe`, since it
-// can't rely on a package manager to get it. We need to make this test use
-// that executable.
-TEST_F_TEMP_DISABLED_ON_WINDOWS(HealthCheckTest, HealthyTaskViaHTTPWithoutType)
+TEST_F(HealthCheckTest, HealthyTaskViaHTTPWithoutType)
 {
   master::Flags masterFlags = CreateMasterFlags();
   masterFlags.allocation_interval = Milliseconds(50);


[2/3] mesos git commit: Renamed CMake `curl` target to `libcurl`.

Posted by an...@apache.org.
Renamed CMake `curl` target to `libcurl`.

This target was renamed where it is imported, and so this change
reflects that.

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


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

Branch: refs/heads/master
Commit: 9e9de115be0e83767e4fe0075a8ce7923188c2d1
Parents: b464f49
Author: John Kordich <jo...@microsoft.com>
Authored: Wed Dec 6 12:13:02 2017 -0800
Committer: Andrew Schwartzmeyer <an...@schwartzmeyer.com>
Committed: Wed Dec 6 14:09:52 2017 -0800

----------------------------------------------------------------------
 3rdparty/stout/CMakeLists.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/9e9de115/3rdparty/stout/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/3rdparty/stout/CMakeLists.txt b/3rdparty/stout/CMakeLists.txt
index 145b772..5d787d8 100644
--- a/3rdparty/stout/CMakeLists.txt
+++ b/3rdparty/stout/CMakeLists.txt
@@ -23,7 +23,7 @@ target_link_libraries(
   stout INTERFACE
   apr
   boost
-  curl
+  libcurl
   elfio
   glog
   picojson


[3/3] mesos git commit: Added `curl` executable to Windows build.

Posted by an...@apache.org.
Added `curl` executable to Windows build.

Some Mesos health checks use the `curl` executable, which is a required
component on Linux, but also shipped on the system. On Windows,
`curl.exe` is not normally available. However, we already build `curl`
for other components which link to `libcurl`. Part of this build also
builds `curl.exe`, so we renamed the `curl` target to
`libcurl` (explicitly meaning the library), and added `curl` as an
imported executable target on Windows.

Note that this uses `add_custom_command(... POST_BUILD)` to inject a
copy step as a post-build side effect of the `ExternalProject_Add`
target which builds cURL. There is no cleaner way to accomplish this as
CMake does not otherwise have an easy way to copy a file as part of an
_imported_ target at build time. The `add_custom_target` command does
not work because it adds a target that will always be built (not what
we're trying to accomplish here), and the other signature of
`add_custom_command` does not produce a target dependency. While the
`OUTPUT` argument would let us use file dependencies, `curl.exe` isn't a
source file that another target can depend on.

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


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

Branch: refs/heads/master
Commit: b464f49cb79c4921f83cb4bf0f12c47a5d8fa4ed
Parents: f031e03
Author: John Kordich <jo...@microsoft.com>
Authored: Wed Dec 6 12:08:32 2017 -0800
Committer: Andrew Schwartzmeyer <an...@schwartzmeyer.com>
Committed: Wed Dec 6 14:09:52 2017 -0800

----------------------------------------------------------------------
 3rdparty/CMakeLists.txt | 37 +++++++++++++++++++++++++++++--------
 1 file changed, 29 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/b464f49c/3rdparty/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/3rdparty/CMakeLists.txt b/3rdparty/CMakeLists.txt
index c34b65d..e2370fd 100755
--- a/3rdparty/CMakeLists.txt
+++ b/3rdparty/CMakeLists.txt
@@ -564,8 +564,17 @@ endif ()
 ######################################################################
 if (WIN32)
   EXTERNAL(curl ${CURL_VERSION} ${CMAKE_CURRENT_BINARY_DIR})
-  add_library(curl ${LIBRARY_LINKAGE} IMPORTED GLOBAL)
-  add_dependencies(curl ${CURL_TARGET})
+
+  # This is named `libcurl` to not conflict with the executable.
+  add_library(libcurl ${LIBRARY_LINKAGE} IMPORTED GLOBAL)
+  add_dependencies(libcurl ${CURL_TARGET})
+
+  # Contrary to Linux, the CMake build deploys `curl.exe` on Windows.
+  #
+  # NOTE: The dependency on `CURL_TARGET` is introduced by the generator
+  # expression in `add_custom_command` below. Introducing it here via
+  # `add_dependencies` creates a cycle.
+  add_executable(curl IMPORTED GLOBAL)
 
   set(CURL_CMAKE_ARGS
     ${CMAKE_FORWARD_ARGS}
@@ -579,36 +588,48 @@ if (WIN32)
     list(APPEND CURL_CMAKE_ARGS -DCURL_STATICLIB=ON)
 
     set_target_properties(
-      curl PROPERTIES
+      libcurl PROPERTIES
       INTERFACE_COMPILE_DEFINITIONS CURL_STATICLIB)
   endif ()
 
   set_target_properties(
-    curl PROPERTIES
+    libcurl PROPERTIES
     IMPORTED_LOCATION_DEBUG ${CURL_ROOT}-build/lib/Debug/libcurl${LIBRARY_SUFFIX}
     IMPORTED_LOCATION_RELEASE ${CURL_ROOT}-build/lib/Release/libcurl${LIBRARY_SUFFIX}
     IMPORTED_IMPLIB_DEBUG ${CURL_ROOT}-build/lib/Debug/libcurl_imp${CMAKE_IMPORT_LIBRARY_SUFFIX}
     IMPORTED_IMPLIB_RELEASE ${CURL_ROOT}-build/lib/Release/libcurl_imp${CMAKE_IMPORT_LIBRARY_SUFFIX}
     INTERFACE_INCLUDE_DIRECTORIES ${CURL_ROOT}/include)
 
-  MAKE_INCLUDE_DIR(curl)
+  set_target_properties(
+    curl PROPERTIES
+    IMPORTED_LOCATION_DEBUG ${CURL_ROOT}-build/src/Debug/curl.exe
+    IMPORTED_LOCATION_RELEASE ${CURL_ROOT}-build/src/Release/curl.exe)
+
+  MAKE_INCLUDE_DIR(libcurl)
+  GET_BYPRODUCTS(libcurl)
   GET_BYPRODUCTS(curl)
 
   ExternalProject_Add(
     ${CURL_TARGET}
     PREFIX            ${CURL_CMAKE_ROOT}
-    BUILD_BYPRODUCTS  ${CURL_BYPRODUCTS}
+    BUILD_BYPRODUCTS  ${LIBCURL_BYPRODUCTS};${CURL_BYPRODUCTS}
     PATCH_COMMAND     ${CMAKE_NOOP}
     CMAKE_ARGS        ${CURL_CMAKE_ARGS}
     INSTALL_COMMAND   ${CMAKE_NOOP}
     URL               ${CURL_URL}
     URL_HASH          ${CURL_HASH})
+
+  # This copies the file `curl.exe` from the `3rdparty` build folder to
+  # `build/src`, next to the other produced executables. This is necessary for
+  # code that shells out to cURL on Windows.
+  add_custom_command(TARGET ${CURL_TARGET} POST_BUILD
+    COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:curl> ${CMAKE_BINARY_DIR}/src)
 else ()
   find_package(CURL REQUIRED)
-  add_library(curl SHARED IMPORTED)
+  add_library(libcurl SHARED IMPORTED)
 
   set_target_properties(
-    curl PROPERTIES
+    libcurl PROPERTIES
     IMPORTED_LOCATION ${CURL_LIBRARIES}
     INTERFACE_INCLUDE_DIRECTORIES ${CURL_INCLUDE_DIRS})
 endif ()