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

[1/4] mesos git commit: Windows: Disambiguated `os::write` by adding another overload.

Repository: mesos
Updated Branches:
  refs/heads/master 961e80107 -> c1578bb74


Windows: Disambiguated `os::write` by adding another overload.

This commit will address test failures on Windows in `files_tests.cpp`.
On Windows, calling `os::write` with a `char *` literal (e.g.,
`os::write("your_file", ...)` will erroneously dispatch to the overload
of `os::write(HANDLE)` instead of `os::write(const string&)`, because
`HANDLE` is a typedef'd `void *`.

In this commit, we simply add an overload for `char *`, which resolves
the ambiguity and causes most tests in `files_tests.cpp` to pass.

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


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

Branch: refs/heads/master
Commit: c1578bb74929440c37bd9f393af5e55efee3c67d
Parents: 75feb89
Author: Alex Clemmer <cl...@gmail.com>
Authored: Thu Dec 15 15:08:14 2016 -0800
Committer: Joseph Wu <jo...@apache.org>
Committed: Thu Dec 15 15:13:05 2016 -0800

----------------------------------------------------------------------
 3rdparty/stout/include/stout/os/write.hpp | 8 ++++++++
 1 file changed, 8 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/c1578bb7/3rdparty/stout/include/stout/os/write.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/stout/include/stout/os/write.hpp b/3rdparty/stout/include/stout/os/write.hpp
index 24a69d8..9bb9fbd 100644
--- a/3rdparty/stout/include/stout/os/write.hpp
+++ b/3rdparty/stout/include/stout/os/write.hpp
@@ -82,6 +82,14 @@ inline Try<Nothing> write(const std::string& path, const std::string& message)
   return result;
 }
 
+
+// NOTE: This overload is necessary to disambiguate between arguments
+// of type `HANDLE` (`typedef void*`) and `char*` on Windows.
+inline Try<Nothing> write(const char* path, const std::string& message)
+{
+  return write(std::string(path), message);
+}
+
 } // namespace os {
 
 


[3/4] mesos git commit: Windows: Added Mesos tests to the build helper.

Posted by jo...@apache.org.
Windows: Added Mesos tests to the build helper.

This adds an extra step to `support/windows-build.bat` to run the
Mesos tests after building them.


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

Branch: refs/heads/master
Commit: 75feb8947cc9f0581ef744fb8822a2fadc487a66
Parents: 182feb2
Author: Joseph Wu <jo...@apache.org>
Authored: Thu Dec 15 12:36:08 2016 -0800
Committer: Joseph Wu <jo...@apache.org>
Committed: Thu Dec 15 15:13:05 2016 -0800

----------------------------------------------------------------------
 support/windows-build.bat | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/75feb894/support/windows-build.bat
----------------------------------------------------------------------
diff --git a/support/windows-build.bat b/support/windows-build.bat
index 14a89c7..4d1d8cd 100644
--- a/support/windows-build.bat
+++ b/support/windows-build.bat
@@ -66,7 +66,6 @@ REM Build and run the stout tests.
 msbuild Mesos.sln /p:PreferredToolArchitecture=x64 /m /t:stout_tests
 if %errorlevel% neq 0 exit /b %errorlevel%
 
-REM TODO(josephw): Uncomment this after fixing the tests on Windows.
 "3rdparty/stout/tests/Debug/stout_tests.exe"
 if %errorlevel% neq 0 exit /b %errorlevel%
 
@@ -74,7 +73,6 @@ REM Build and run the libprocess tests.
 msbuild Mesos.sln /p:PreferredToolArchitecture=x64 /m /t:process_tests
 if %errorlevel% neq 0 exit /b %errorlevel%
 
-REM TODO(josephw): Uncomment this after fixing the tests on Windows.
 "3rdparty/libprocess/src/tests/Debug/process_tests.exe"
 if %errorlevel% neq 0 exit /b %errorlevel%
 
@@ -82,7 +80,9 @@ REM Build everything else.
 msbuild Mesos.sln /p:PreferredToolArchitecture=x64 /m
 if %errorlevel% neq 0 exit /b %errorlevel%
 
-REM TODO(josephw): Run mesos tests.
+REM Run mesos tests.
+"src/mesos-tests.exe" --verbose
+if %errorlevel% neq 0 exit /b %errorlevel%
 
 goto :eof
 


[4/4] mesos git commit: Fixed builds with HAS_AUTHENTICATION=false.

Posted by jo...@apache.org.
Fixed builds with HAS_AUTHENTICATION=false.

The HAS_AUTHENTICATION configuration flag exists for systems or
platforms that do not support certain authentication libraries.
However, this option is not widely exercised (either by developers
or in existing CIs), and has broken over time.  Windows, for example,
will temporarily not have agent-to-master authentication support.

This commit will add the `HAS_AUTHENTICATION` option to the CMake build
and simultaneously `#ifdef` out some test code which depends on
authentication support.

On Windows, the option for `HAS_AUTHENTICATION` will be set to FALSE
by default.

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


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

Branch: refs/heads/master
Commit: c703e0fadcd6c1e01d109b71def9058e250592af
Parents: 961e801
Author: Alex Clemmer <cl...@gmail.com>
Authored: Thu Dec 15 10:55:21 2016 -0800
Committer: Joseph Wu <jo...@apache.org>
Committed: Thu Dec 15 15:13:05 2016 -0800

----------------------------------------------------------------------
 cmake/CompilationConfigure.cmake | 31 +++++++++++++++++++++----------
 src/Makefile.am                  |  8 --------
 src/tests/mesos.cpp              |  4 ++++
 support/windows-build.bat        |  2 +-
 4 files changed, 26 insertions(+), 19 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/c703e0fa/cmake/CompilationConfigure.cmake
----------------------------------------------------------------------
diff --git a/cmake/CompilationConfigure.cmake b/cmake/CompilationConfigure.cmake
index 6bd07e0..d857587 100644
--- a/cmake/CompilationConfigure.cmake
+++ b/cmake/CompilationConfigure.cmake
@@ -49,6 +49,19 @@ option(
   "Use libevent instead of libev as the core event loop implementation"
   FALSE)
 
+option(
+  HAS_AUTHENTICATION
+  "Build Mesos against authentication libraries"
+  TRUE)
+
+if (WIN32 AND HAS_AUTHENTICATION)
+  message(
+    FATAL_ERROR
+    "Windows builds of Mesos currently do not support agent to master "
+    "authentication. To build without this capability, pass "
+    "`-HAS_AUTHENTICATION=0` as an argument when you run CMake.")
+endif (WIN32 AND HAS_AUTHENTICATION)
+
 # If 'REBUNDLED' is set to FALSE, this will cause Mesos to build against
 # the specified dependency repository.  This is especially useful for
 # Windows builds, because building on MSVC 1900 requires newer versions
@@ -148,16 +161,6 @@ if (NOT WIN32)
   set(LIBEXEC_INSTALL_DIR     ${EXEC_INSTALL_PREFIX}/libexec)
   set(PKG_LIBEXEC_INSTALL_DIR ${LIBEXEC_INSTALL_DIR}/mesos)
   set(LIB_INSTALL_DIR         ${EXEC_INSTALL_PREFIX}/libmesos)
-
-  # TODO(hausdorff): Remove our hard dependency on SASL, as some platforms
-  # (namely Windows) will not support it in the forseeable future. As a
-  # stop-gap, we conditionally compile the code in libmesos that depends on
-  # SASL, by always setting `HAS_AUTHENTICATION` on non-Windows platforms, and
-  # never setting it on Windows platforms. This means that non-Windows builds
-  # of libmesos will still take a hard dependency on SASL, while Windows builds
-  # won't. Currently, the dependency is still assumed throughout the tests,
-  # though the plan is to remove this hard dependency as well. See MESOS-5450.
-  add_definitions(-DHAS_AUTHENTICATION=1)
 endif (NOT WIN32)
 
 
@@ -224,6 +227,14 @@ endif (WIN32)
 
 # GLOBAL CONFIGURATION.
 #######################
+if (HAS_AUTHENTICATION)
+  # NOTE: This conditional is required. It is not sufficient to set
+  # `-DHAS_AUTHENTICATION=${HAS_AUTHENTICATION}`, as this will define the
+  # symbol, and our intention is to only define it if the CMake variable
+  # `HAS_AUTHENTICATION` is set.
+  add_definitions(-DHAS_AUTHENTICATION=1)
+endif (HAS_AUTHENTICATION)
+
 # Enable the INT64 support for PicoJSON.
 add_definitions(-DPICOJSON_USE_INT64)
 

http://git-wip-us.apache.org/repos/asf/mesos/blob/c703e0fa/src/Makefile.am
----------------------------------------------------------------------
diff --git a/src/Makefile.am b/src/Makefile.am
index a4c03c2..b9db779 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -192,14 +192,6 @@ LIB_ZOOKEEPER = -lzookeeper_mt
 LDADD += -lzookeeper_mt
 endif
 
-# TODO(hausdorff): Remove our hard dependency on SASL, as some platforms
-# (namely Windows) will not support it in the forseeable future. As a
-# stop-gap, we conditionally compile the code in libmesos that depends on
-# SASL, by always setting `HAS_AUTHENTICATION` on non-Windows platforms, and
-# never setting it on Windows platforms. This means that non-Windows builds
-# of libmesos will still take a hard dependency on SASL, while Windows builds
-# won't. Currently, the dependency is still assumed throughout the tests,
-# though the plan is to remove this hard dependency as well. See MESOS-5450.
 MESOS_CPPFLAGS += -DHAS_AUTHENTICATION=1
 
 # README: we build the Mesos library out of a collection of

http://git-wip-us.apache.org/repos/asf/mesos/blob/c703e0fa/src/tests/mesos.cpp
----------------------------------------------------------------------
diff --git a/src/tests/mesos.cpp b/src/tests/mesos.cpp
index 629872f..adbb697 100644
--- a/src/tests/mesos.cpp
+++ b/src/tests/mesos.cpp
@@ -107,8 +107,10 @@ master::Flags MesosTest::CreateMasterFlags()
 
   flags.authenticate_http_readonly = true;
   flags.authenticate_http_readwrite = true;
+#ifdef HAS_AUTHENTICATION
   flags.authenticate_frameworks = true;
   flags.authenticate_agents = true;
+#endif // HAS_AUTHENTICATION
 
   flags.authenticate_http_frameworks = true;
   flags.http_framework_authenticators = "basic";
@@ -176,6 +178,7 @@ slave::Flags MesosTest::CreateSlaveFlags()
   flags.launcher_dir = getLauncherDir();
 
   {
+#ifdef HAS_AUTHENTICATION
     // Create a default credential file for master/agent authentication.
     const string& path = path::join(directory.get(), "credential");
 
@@ -199,6 +202,7 @@ slave::Flags MesosTest::CreateSlaveFlags()
 
     // Set default (permissive) ACLs.
     flags.acls = ACLs();
+#endif // HAS_AUTHENTICATION
   }
 
   flags.authenticate_http_readonly = true;

http://git-wip-us.apache.org/repos/asf/mesos/blob/c703e0fa/support/windows-build.bat
----------------------------------------------------------------------
diff --git a/support/windows-build.bat b/support/windows-build.bat
index b3b6d0b..14a89c7 100644
--- a/support/windows-build.bat
+++ b/support/windows-build.bat
@@ -49,7 +49,7 @@ REM Generate the Visual Studio solution.
 REM You can pass in other flags by setting `OTHER_CMAKE_OPTIONS` before
 REM calling the script. For example, the ASF CI will add `-DPATCHEXE_PATH=...`
 REM because the path to GNU Patch is not the default.
-cmake .. -G "Visual Studio 14 2015 Win64" -DENABLE_LIBEVENT=1 %OTHER_CMAKE_OPTIONS%
+cmake .. -G "Visual Studio 14 2015 Win64" -DENABLE_LIBEVENT=1 -DHAS_AUTHENTICATION=0 %OTHER_CMAKE_OPTIONS%
 if %errorlevel% neq 0 exit /b %errorlevel%
 
 REM NOTE: We pass in the build option `/p:PreferredToolArchitecture=x64`


[2/4] mesos git commit: Windows: Added `recordio_tests.cpp` to test build.

Posted by jo...@apache.org.
Windows: Added `recordio_tests.cpp` to test build.

This deals with a few namespace resolution errors that only show up in
MSVC (which prevents `recordio_tests.cpp` from building) and adds the
file to the test build.

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


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

Branch: refs/heads/master
Commit: 182feb2c2cdbbf9095a7ad4083bb6fa9cfbc4d66
Parents: c703e0f
Author: Alex Clemmer <cl...@gmail.com>
Authored: Thu Dec 15 11:24:06 2016 -0800
Committer: Joseph Wu <jo...@apache.org>
Committed: Thu Dec 15 15:13:05 2016 -0800

----------------------------------------------------------------------
 src/tests/CMakeLists.txt            |  6 +++++-
 src/tests/common/recordio_tests.cpp | 18 +++++++++---------
 2 files changed, 14 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/182feb2c/src/tests/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/src/tests/CMakeLists.txt b/src/tests/CMakeLists.txt
index 0966b7f..6aab511 100644
--- a/src/tests/CMakeLists.txt
+++ b/src/tests/CMakeLists.txt
@@ -91,6 +91,11 @@ set(MESOS_TESTS_SRC
   authentication_tests.cpp
   )
 
+set(MESOS_TESTS_SRC
+  ${MESOS_TESTS_SRC}
+  common/recordio_tests.cpp
+  )
+
 if (NOT WIN32)
   set(MESOS_TESTS_SRC
     ${MESOS_TESTS_SRC}
@@ -168,7 +173,6 @@ if (NOT WIN32)
     ${MESOS_TESTS_SRC}
     common/command_utils_tests.cpp
     common/http_tests.cpp
-    common/recordio_tests.cpp
     common/type_utils_tests.cpp
     )
 

http://git-wip-us.apache.org/repos/asf/mesos/blob/182feb2c/src/tests/common/recordio_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/common/recordio_tests.cpp b/src/tests/common/recordio_tests.cpp
index 63e284a..5dd6880 100644
--- a/src/tests/common/recordio_tests.cpp
+++ b/src/tests/common/recordio_tests.cpp
@@ -177,8 +177,8 @@ TEST(RecordIOTransformTest, EndOfFile)
   process::http::Pipe pipeA;
   pipeA.writer().write(data);
 
-  process::Owned<internal::recordio::Reader<string>> reader(
-    new internal::recordio::Reader<string>(
+  process::Owned<mesos::internal::recordio::Reader<string>> reader(
+    new mesos::internal::recordio::Reader<string>(
         ::recordio::Decoder<string>(strings::lower),
         pipeA.reader()));
 
@@ -186,7 +186,7 @@ TEST(RecordIOTransformTest, EndOfFile)
 
   auto trim = [](const string& str) { return strings::trim(str); };
 
-  Future<Nothing> transform = internal::recordio::transform<string>(
+  Future<Nothing> transform = mesos::internal::recordio::transform<string>(
       std::move(reader), trim, pipeB.writer());
 
   Future<string> future = pipeB.reader().readAll();
@@ -217,8 +217,8 @@ TEST(RecordIOTransformTest, ReaderWriterEndFail)
   process::http::Pipe pipeA;
   pipeA.writer().write(data);
 
-  process::Owned<internal::recordio::Reader<string>> reader(
-    new internal::recordio::Reader<string>(
+  process::Owned<mesos::internal::recordio::Reader<string>> reader(
+    new mesos::internal::recordio::Reader<string>(
         ::recordio::Decoder<string>(strings::lower),
         pipeA.reader()));
 
@@ -226,7 +226,7 @@ TEST(RecordIOTransformTest, ReaderWriterEndFail)
 
   auto trim = [](const string& str) { return strings::trim(str); };
 
-  Future<Nothing> transform = internal::recordio::transform<string>(
+  Future<Nothing> transform = mesos::internal::recordio::transform<string>(
       std::move(reader), trim, pipeB.writer());
 
   Future<string> future = pipeB.reader().readAll();
@@ -254,8 +254,8 @@ TEST(RecordIOTransformTest, WriterReadEndFail)
   process::http::Pipe pipeA;
   pipeA.writer().write(data);
 
-  process::Owned<internal::recordio::Reader<string>> reader(
-    new internal::recordio::Reader<string>(
+  process::Owned<mesos::internal::recordio::Reader<string>> reader(
+    new mesos::internal::recordio::Reader<string>(
         ::recordio::Decoder<string>(strings::lower),
         pipeA.reader()));
 
@@ -265,7 +265,7 @@ TEST(RecordIOTransformTest, WriterReadEndFail)
 
   pipeB.reader().close();
 
-  Future<Nothing> transform = internal::recordio::transform<string>(
+  Future<Nothing> transform = mesos::internal::recordio::transform<string>(
       std::move(reader), trim, pipeB.writer());
 
   pipeA.writer().close();