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 2018/07/24 20:17:00 UTC

[1/8] mesos git commit: Enabled `TimeTest.Now` on Windows.

Repository: mesos
Updated Branches:
  refs/heads/master 0519403ec -> 9047fdccc


Enabled `TimeTest.Now` on Windows.

While the timer resolution on Windows does not support 10
microseconds, it does support 1000 microseconds, which is still fast
enough for a unit test.

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


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

Branch: refs/heads/master
Commit: 9047fdccc8bc10fdf42b9b2c5c0f47c760e1bb5b
Parents: 179c7ec
Author: Andrew Schwartzmeyer <an...@schwartzmeyer.com>
Authored: Thu Jul 19 16:18:23 2018 -0700
Committer: Andrew Schwartzmeyer <an...@schwartzmeyer.com>
Committed: Tue Jul 24 10:58:52 2018 -0700

----------------------------------------------------------------------
 3rdparty/libprocess/src/tests/time_tests.cpp | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/9047fdcc/3rdparty/libprocess/src/tests/time_tests.cpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/src/tests/time_tests.cpp b/3rdparty/libprocess/src/tests/time_tests.cpp
index 08ddb56..0ab4fb3 100644
--- a/3rdparty/libprocess/src/tests/time_tests.cpp
+++ b/3rdparty/libprocess/src/tests/time_tests.cpp
@@ -43,12 +43,11 @@ TEST(TimeTest, Arithmetic)
 }
 
 
-// Windows OS timers aren't high enough resolution to support this.
-TEST_TEMP_DISABLED_ON_WINDOWS(TimeTest, Now)
+TEST(TimeTest, Now)
 {
   Time t1 = Clock::now();
-  os::sleep(Microseconds(10));
-  ASSERT_LT(Microseconds(10), Clock::now() - t1);
+  os::sleep(Microseconds(1000));
+  ASSERT_LT(Microseconds(1000), Clock::now() - t1);
 }
 
 


[4/8] mesos git commit: Windows: Added `nullptr` checks when using `libwinio_loop` pointer.

Posted by an...@apache.org.
Windows: Added `nullptr` checks when using `libwinio_loop` pointer.

It was discovered that the `Socket` constructor could dereference a
null pointer (by way of `prepare_async()`) if the Windows IOCP event
loop had not yet been initialized. So now we check for its
initialization before each dereference, and return an error or fatal
log event.

In order to ensure that it is initialized in `test-linkee`, we call
`process::initialize()`. This should be fixed in the future, per
MESOS-9097.

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


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

Branch: refs/heads/master
Commit: 81597a0389db60f1d9143bf65c665cd1073339f1
Parents: 3e06a48
Author: Andrew Schwartzmeyer <an...@schwartzmeyer.com>
Authored: Wed Jul 18 14:49:56 2018 -0700
Committer: Andrew Schwartzmeyer <an...@schwartzmeyer.com>
Committed: Tue Jul 24 10:58:52 2018 -0700

----------------------------------------------------------------------
 3rdparty/libprocess/src/tests/test_linkee.cpp  |  4 ++++
 3rdparty/libprocess/src/windows/event_loop.cpp | 25 +++++++++++++++++++--
 3rdparty/libprocess/src/windows/io.cpp         |  5 +++++
 3 files changed, 32 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/81597a03/3rdparty/libprocess/src/tests/test_linkee.cpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/src/tests/test_linkee.cpp b/3rdparty/libprocess/src/tests/test_linkee.cpp
index cc48271..0ba54ea 100644
--- a/3rdparty/libprocess/src/tests/test_linkee.cpp
+++ b/3rdparty/libprocess/src/tests/test_linkee.cpp
@@ -99,6 +99,10 @@ int main(int argc, char** argv)
     EXIT(EXIT_FAILURE) << "Usage: test-linkee <UPID>";
   }
 
+  // NOTE: On Windows, this initialization must take place before creating a
+  // `Socket`, otherwise the IOCP handle will be uninitialized. See MESOS-9097.
+  process::initialize();
+
   // Create a server socket.
   Try<Socket> create = Socket::create();
   if (create.isError()) {

http://git-wip-us.apache.org/repos/asf/mesos/blob/81597a03/3rdparty/libprocess/src/windows/event_loop.cpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/src/windows/event_loop.cpp b/3rdparty/libprocess/src/windows/event_loop.cpp
index 0050ff0..33fbf36 100644
--- a/3rdparty/libprocess/src/windows/event_loop.cpp
+++ b/3rdparty/libprocess/src/windows/event_loop.cpp
@@ -48,6 +48,11 @@ void EventLoop::initialize()
 void EventLoop::delay(
     const Duration& duration, const std::function<void()>& function)
 {
+  if (!libwinio_loop) {
+    // TODO(andschwa): Remove this check, see MESOS-9097.
+    LOG(FATAL) << "Windows IOCP event loop is not initialized";
+  }
+
   libwinio_loop->launchTimer(duration, function);
 }
 
@@ -60,9 +65,25 @@ double EventLoop::time()
 }
 
 
-void EventLoop::run() { libwinio_loop->run(); }
+void EventLoop::run()
+{
+  if (!libwinio_loop) {
+    // TODO(andschwa): Remove this check, see MESOS-9097.
+    LOG(FATAL) << "Windows IOCP event loop is not initialized";
+  }
+
+  libwinio_loop->run();
+}
+
 
+void EventLoop::stop()
+{
+  if (!libwinio_loop) {
+    // TODO(andschwa): Remove this check, see MESOS-9097.
+    LOG(FATAL) << "Windows IOCP event loop is not initialized";
+  }
 
-void EventLoop::stop() { libwinio_loop->stop(); }
+  libwinio_loop->stop();
+}
 
 } // namespace process {

http://git-wip-us.apache.org/repos/asf/mesos/blob/81597a03/3rdparty/libprocess/src/windows/io.cpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/src/windows/io.cpp b/3rdparty/libprocess/src/windows/io.cpp
index 1f9adde..90e780d 100644
--- a/3rdparty/libprocess/src/windows/io.cpp
+++ b/3rdparty/libprocess/src/windows/io.cpp
@@ -79,6 +79,11 @@ Future<size_t> write(int_fd fd, const void* data, size_t size)
 Try<Nothing> prepare_async(int_fd fd)
 {
   if (fd.is_overlapped()) {
+    // TODO(andschwa): Remove this check, see MESOS-9097.
+    if (!libwinio_loop) {
+      return Error("Windows IOCP event loop is not initialized");
+    }
+
     return libwinio_loop->registerHandle(fd);
   }
 


[7/8] mesos git commit: Windows: Enabled rest of `ProcessTest` suite.

Posted by an...@apache.org.
Windows: Enabled rest of `ProcessTest` suite.

Several of these worked as-is, and the two firewall tests were fixed
by replace `path::join` (which joined with `\`) with
`strings::join("/")`.

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


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

Branch: refs/heads/master
Commit: 179c7eca9e6f41406f10f199593d846a71665c61
Parents: ac3b74e
Author: Andrew Schwartzmeyer <an...@schwartzmeyer.com>
Authored: Wed Jul 18 18:30:45 2018 -0700
Committer: Andrew Schwartzmeyer <an...@schwartzmeyer.com>
Committed: Tue Jul 24 10:58:52 2018 -0700

----------------------------------------------------------------------
 3rdparty/libprocess/src/tests/process_tests.cpp | 33 ++++++--------------
 1 file changed, 9 insertions(+), 24 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/179c7eca/3rdparty/libprocess/src/tests/process_tests.cpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/src/tests/process_tests.cpp b/3rdparty/libprocess/src/tests/process_tests.cpp
index d5d9afc..17ed2f4 100644
--- a/3rdparty/libprocess/src/tests/process_tests.cpp
+++ b/3rdparty/libprocess/src/tests/process_tests.cpp
@@ -1468,9 +1468,7 @@ TEST(ProcessTest, Http1)
 
 // Like 'http1' but uses the 'Libprocess-From' header. We can
 // also use http::post here since we expect a 202 response.
-//
-// TODO(neilc): This test currently does not work on Windows (MESOS-7527).
-TEST_TEMP_DISABLED_ON_WINDOWS(ProcessTest, Http2)
+TEST(ProcessTest, Http2)
 {
   RemoteProcess process;
   spawn(process);
@@ -1613,10 +1611,7 @@ public:
 };
 
 
-// TODO(hausdorff): Enable test when `os::rmdir` is semantically equivalent to
-// the POSIX version. In this case, it behaves poorly when we try to use it to
-// delete a file instead of a directory. See MESOS-5942.
-TEST_TEMP_DISABLED_ON_WINDOWS(ProcessTest, Provide)
+TEST(ProcessTest, Provide)
 {
   const Try<string> mkdtemp = os::mkdtemp();
   ASSERT_SOME(mkdtemp);
@@ -1655,8 +1650,6 @@ static int baz(string s) { return 42; }
 static Future<int> bam(string s) { return 42; }
 
 
-// MSVC can't compile the call to std::invoke.
-#ifndef __WINDOWS__
 TEST(ProcessTest, Defers)
 {
   {
@@ -1794,7 +1787,6 @@ TEST(ProcessTest, Defers)
   Future<int> future13 = Future<string>().then(
       defer(functor));
 }
-#endif // __WINDOWS__
 
 
 class PercentEncodedIDProcess : public Process<PercentEncodedIDProcess>
@@ -1898,18 +1890,15 @@ public:
 
 // Sets firewall rules which disable endpoints on a process and then
 // attempts to connect to those endpoints.
-// TODO(hausdorff): Routing logic is broken on Windows. Fix and enable test. In
-// this case, we fail to set up the firewall routes. See MESOS-5904.
-TEST_TEMP_DISABLED_ON_WINDOWS(ProcessTest, FirewallDisablePaths)
+TEST(ProcessTest, FirewallDisablePaths)
 {
   const string id = "testprocess";
 
   hashset<string> endpoints = {
-    path::join("", id, "handler1"),
-    path::join("", id, "handler2/nested"),
+    strings::join("/", "", id, "handler1"),
+    strings::join("/", "", id, "handler2", "nested"),
     // Patterns are not supported, so this should do nothing.
-    path::join("", id, "handler3/*")
-  };
+    strings::join("/", "", id, "handler3", "*")};
 
   process::firewall::install(
       {Owned<FirewallRule>(new DisabledEndpointsFirewallRule(endpoints))});
@@ -1985,16 +1974,12 @@ TEST_TEMP_DISABLED_ON_WINDOWS(ProcessTest, FirewallDisablePaths)
 
 // Test that firewall rules can be changed by changing the vector.
 // An empty vector should allow all paths.
-// TODO(hausdorff): Routing logic is broken on Windows. Fix and enable test. In
-// this case, we fail to set up the firewall routes. See MESOS-5904.
-TEST_TEMP_DISABLED_ON_WINDOWS(ProcessTest, FirewallUninstall)
+TEST(ProcessTest, FirewallUninstall)
 {
   const string id = "testprocess";
 
-  hashset<string> endpoints = {
-    path::join("", id, "handler1"),
-    path::join("", id, "handler2")
-  };
+  hashset<string> endpoints = {strings::join("/", "", id, "handler1"),
+                               strings::join("/", "", id, "handler2")};
 
   process::firewall::install(
       {Owned<FirewallRule>(new DisabledEndpointsFirewallRule(endpoints))});


[5/8] mesos git commit: Added optional `path_separator` parameter to `Path` constructor.

Posted by an...@apache.org.
Added optional `path_separator` parameter to `Path` constructor.

This defaults to `os::PATH_SEPARATOR` and so by default retains the
previous behavior. However, now `Path` can be arbitrarily used with,
e.g., URLs on Windows by providing `/` as the separator.

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


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

Branch: refs/heads/master
Commit: de4917a3c38c347a4fb85dc14a9fbf378ebd47ac
Parents: 0519403
Author: Andrew Schwartzmeyer <an...@schwartzmeyer.com>
Authored: Tue Jul 17 15:00:46 2018 -0700
Committer: Andrew Schwartzmeyer <an...@schwartzmeyer.com>
Committed: Tue Jul 24 10:58:52 2018 -0700

----------------------------------------------------------------------
 3rdparty/stout/include/stout/path.hpp | 30 +++++++++++++++++-------------
 1 file changed, 17 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/de4917a3/3rdparty/stout/include/stout/path.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/stout/include/stout/path.hpp b/3rdparty/stout/include/stout/path.hpp
index 27438d3..ef5a2f3 100644
--- a/3rdparty/stout/include/stout/path.hpp
+++ b/3rdparty/stout/include/stout/path.hpp
@@ -145,10 +145,13 @@ inline bool absolute(const std::string& path)
 class Path
 {
 public:
-  Path() : value() {}
+  Path() : value(), separator(os::PATH_SEPARATOR) {}
 
-  explicit Path(const std::string& path)
-    : value(strings::remove(path, "file://", strings::PREFIX)) {}
+  explicit Path(
+      const std::string& path, const char path_separator = os::PATH_SEPARATOR)
+    : value(strings::remove(path, "file://", strings::PREFIX)),
+      separator(path_separator)
+  {}
 
   // TODO(cmaloney): Add more useful operations such as 'directoryname()',
   // 'filename()', etc.
@@ -185,18 +188,18 @@ public:
     size_t end = value.size() - 1;
 
     // Remove trailing slashes.
-    if (value[end] == os::PATH_SEPARATOR) {
-      end = value.find_last_not_of(os::PATH_SEPARATOR, end);
+    if (value[end] == separator) {
+      end = value.find_last_not_of(separator, end);
 
       // Paths containing only slashes result into "/".
       if (end == std::string::npos) {
-        return stringify(os::PATH_SEPARATOR);
+        return stringify(separator);
       }
     }
 
     // 'start' should point towards the character after the last slash
     // that is non trailing.
-    size_t start = value.find_last_of(os::PATH_SEPARATOR, end);
+    size_t start = value.find_last_of(separator, end);
 
     if (start == std::string::npos) {
       start = 0;
@@ -244,12 +247,12 @@ public:
     size_t end = value.size() - 1;
 
     // Remove trailing slashes.
-    if (value[end] == os::PATH_SEPARATOR) {
-      end = value.find_last_not_of(os::PATH_SEPARATOR, end);
+    if (value[end] == separator) {
+      end = value.find_last_not_of(separator, end);
     }
 
     // Remove anything trailing the last slash.
-    end = value.find_last_of(os::PATH_SEPARATOR, end);
+    end = value.find_last_of(separator, end);
 
     // Paths containing no slashes result in ".".
     if (end == std::string::npos) {
@@ -258,16 +261,16 @@ public:
 
     // Paths containing only slashes result in "/".
     if (end == 0) {
-      return stringify(os::PATH_SEPARATOR);
+      return stringify(separator);
     }
 
     // 'end' should point towards the last non slash character
     // preceding the last slash.
-    end = value.find_last_not_of(os::PATH_SEPARATOR, end);
+    end = value.find_last_not_of(separator, end);
 
     // Paths containing no non slash characters result in "/".
     if (end == std::string::npos) {
-      return stringify(os::PATH_SEPARATOR);
+      return stringify(separator);
     }
 
     return value.substr(0, end + 1);
@@ -321,6 +324,7 @@ public:
 
 private:
   std::string value;
+  char separator;
 };
 
 


[8/8] mesos git commit: Windows: Enabled `RemoteLink` tests.

Posted by an...@apache.org.
Windows: Enabled `RemoteLink` tests.

This resolves MESOS-5941. Note that on Windows, `os::killtree()` is
only valid for processes specifically spawned in a group via a job
object, otherwise it will fail (and the failure is not being checked
here). Since the `linkee` process only ever spawns the single OS
process `test-linkee`, it is safe to switch to `os::kill()` which can
correctly kill it.

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


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

Branch: refs/heads/master
Commit: 81e49448a1c85e4364f609a552cb82d45ea60a97
Parents: cf51b23
Author: Andrew Schwartzmeyer <an...@schwartzmeyer.com>
Authored: Wed Jul 18 16:22:57 2018 -0700
Committer: Andrew Schwartzmeyer <an...@schwartzmeyer.com>
Committed: Tue Jul 24 10:58:52 2018 -0700

----------------------------------------------------------------------
 3rdparty/libprocess/src/tests/process_tests.cpp | 26 +++++++-------------
 1 file changed, 9 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/81e49448/3rdparty/libprocess/src/tests/process_tests.cpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/src/tests/process_tests.cpp b/3rdparty/libprocess/src/tests/process_tests.cpp
index 8e4135a..d124b5a 100644
--- a/3rdparty/libprocess/src/tests/process_tests.cpp
+++ b/3rdparty/libprocess/src/tests/process_tests.cpp
@@ -843,7 +843,7 @@ protected:
   void TearDown() override
   {
     if (linkee.isSome()) {
-      os::killtree(linkee->pid(), SIGKILL);
+      os::kill(linkee->pid(), SIGKILL);
       reap_linkee();
       linkee = None();
     }
@@ -857,9 +857,7 @@ public:
 
 // Verifies that linking to a remote process will correctly detect
 // the associated `ExitedEvent`.
-// TODO(hausdorff): Test fails on Windows. Fix and enable. Linkee never sends a
-// message because "no such program exists". See MESOS-5941.
-TEST_F_TEMP_DISABLED_ON_WINDOWS(ProcessRemoteLinkTest, RemoteLink)
+TEST_F(ProcessRemoteLinkTest, RemoteLink)
 {
   // Link to the remote subprocess.
   ExitedProcess process(pid);
@@ -871,7 +869,7 @@ TEST_F_TEMP_DISABLED_ON_WINDOWS(ProcessRemoteLinkTest, RemoteLink)
 
   spawn(process);
 
-  os::killtree(linkee->pid(), SIGKILL);
+  os::kill(linkee->pid(), SIGKILL);
   reap_linkee();
   linkee = None();
 
@@ -912,9 +910,7 @@ private:
 // Verifies that calling `link` with "relink" semantics will have the
 // same behavior as `link` with "normal" semantics, when there is no
 // existing persistent connection.
-// TODO(hausdorff): Test fails on Windows. Fix and enable. Linkee never sends a
-// message because "no such program exists". See MESOS-5941.
-TEST_F_TEMP_DISABLED_ON_WINDOWS(ProcessRemoteLinkTest, RemoteRelink)
+TEST_F(ProcessRemoteLinkTest, RemoteRelink)
 {
   RemoteLinkTestProcess process(pid);
 
@@ -926,7 +922,7 @@ TEST_F_TEMP_DISABLED_ON_WINDOWS(ProcessRemoteLinkTest, RemoteRelink)
   spawn(process);
   process.relink();
 
-  os::killtree(linkee->pid(), SIGKILL);
+  os::kill(linkee->pid(), SIGKILL);
   reap_linkee();
   linkee = None();
 
@@ -939,9 +935,7 @@ TEST_F_TEMP_DISABLED_ON_WINDOWS(ProcessRemoteLinkTest, RemoteRelink)
 
 // Verifies that linking and relinking a process will retain monitoring
 // on the linkee.
-// TODO(hausdorff): Test fails on Windows. Fix and enable. Linkee never sends a
-// message because "no such program exists". See MESOS-5941.
-TEST_F_TEMP_DISABLED_ON_WINDOWS(ProcessRemoteLinkTest, RemoteLinkRelink)
+TEST_F(ProcessRemoteLinkTest, RemoteLinkRelink)
 {
   RemoteLinkTestProcess process(pid);
 
@@ -954,7 +948,7 @@ TEST_F_TEMP_DISABLED_ON_WINDOWS(ProcessRemoteLinkTest, RemoteLinkRelink)
   process.linkup();
   process.relink();
 
-  os::killtree(linkee->pid(), SIGKILL);
+  os::kill(linkee->pid(), SIGKILL);
   reap_linkee();
   linkee = None();
 
@@ -967,9 +961,7 @@ TEST_F_TEMP_DISABLED_ON_WINDOWS(ProcessRemoteLinkTest, RemoteLinkRelink)
 
 // Verifies that relinking a remote process will not affect the
 // monitoring of the process by other linkers.
-// TODO(hausdorff): Test fails on Windows. Fix and enable. Linkee never sends a
-// message because "no such program exists". See MESOS-5941.
-TEST_F_TEMP_DISABLED_ON_WINDOWS(ProcessRemoteLinkTest, RemoteDoubleLinkRelink)
+TEST_F(ProcessRemoteLinkTest, RemoteDoubleLinkRelink)
 {
   ExitedProcess linker(pid);
   RemoteLinkTestProcess relinker(pid);
@@ -988,7 +980,7 @@ TEST_F_TEMP_DISABLED_ON_WINDOWS(ProcessRemoteLinkTest, RemoteDoubleLinkRelink)
   relinker.linkup();
   relinker.relink();
 
-  os::killtree(linkee->pid(), SIGKILL);
+  os::kill(linkee->pid(), SIGKILL);
   reap_linkee();
   linkee = None();
 


[3/8] mesos git commit: Windows: Ported remaining tests in the `HTTPTest` suite.

Posted by an...@apache.org.
Windows: Ported remaining tests in the `HTTPTest` suite.

These were enabled by fixing the use of `Path()` in `process.cpp` to
explicitly use '/' as the separator, as it's being used to manipulate
URLs, not filesystem paths, and previously this failed due the Windows
path separator being '\'.

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


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

Branch: refs/heads/master
Commit: 3e06a486620bc5a91446844234b4717d1b2afb24
Parents: de4917a
Author: Andrew Schwartzmeyer <an...@schwartzmeyer.com>
Authored: Tue Jul 17 15:16:09 2018 -0700
Committer: Andrew Schwartzmeyer <an...@schwartzmeyer.com>
Committed: Tue Jul 24 10:58:52 2018 -0700

----------------------------------------------------------------------
 3rdparty/libprocess/src/process.cpp          |  6 +++---
 3rdparty/libprocess/src/tests/http_tests.cpp | 15 +++------------
 2 files changed, 6 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/3e06a486/3rdparty/libprocess/src/process.cpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/src/process.cpp b/3rdparty/libprocess/src/process.cpp
index 7c0a0bc..23f7ce8 100644
--- a/3rdparty/libprocess/src/process.cpp
+++ b/3rdparty/libprocess/src/process.cpp
@@ -3603,9 +3603,9 @@ void ProcessBase::consume(HttpEvent&& event)
   // but if no handler is found and the path is nested, we shorten it and look
   // again. For example: if the request is for '/a/b/c' and no handler is found,
   // we will then check for '/a/b', and finally for '/a'.
-  while (Path(name).dirname() != name) {
+  while (Path(name, '/').dirname() != name) {
     if (handlers.http.count(name) == 0) {
-      name = Path(name).dirname();
+      name = Path(name, '/').dirname();
       continue;
     }
 
@@ -3658,7 +3658,7 @@ void ProcessBase::consume(HttpEvent&& event)
     }
 
     // Try and determine the Content-Type from an extension.
-    Option<string> extension = Path(response.path).extension();
+    Option<string> extension = Path(response.path, '/').extension();
 
     if (extension.isSome() && assets[name].types.count(extension.get()) > 0) {
       response.headers["Content-Type"] = assets[name].types[extension.get()];

http://git-wip-us.apache.org/repos/asf/mesos/blob/3e06a486/3rdparty/libprocess/src/tests/http_tests.cpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/src/tests/http_tests.cpp b/3rdparty/libprocess/src/tests/http_tests.cpp
index ac86ef9..89d3bb2 100644
--- a/3rdparty/libprocess/src/tests/http_tests.cpp
+++ b/3rdparty/libprocess/src/tests/http_tests.cpp
@@ -325,10 +325,7 @@ TEST_P(HTTPTest, Endpoints)
 }
 
 
-// TODO(hausdorff): Routing logic is broken on Windows. Fix and enable test. In
-// this case, the '/help/(14)/body' route is missing, but the /help/(14) route
-// exists. See MESOS-5904.
-TEST_P_TEMP_DISABLED_ON_WINDOWS(HTTPTest, EndpointsHelp)
+TEST_P(HTTPTest, EndpointsHelp)
 {
   Http http;
   PID<HttpProcess> pid = http.process->self();
@@ -397,10 +394,7 @@ TEST_P_TEMP_DISABLED_ON_WINDOWS(HTTPTest, EndpointsHelp)
 }
 
 
-// TODO(hausdorff): Routing logic is broken on Windows. Fix and enable test. In
-// this case, the '/help/(14)/body' route is missing, but the /help/(14) route
-// exists. See MESOS-5904.
-TEST_P_TEMP_DISABLED_ON_WINDOWS(HTTPTest, EndpointsHelpRemoval)
+TEST_P(HTTPTest, EndpointsHelpRemoval)
 {
   // Start up a new HttpProcess;
   Owned<Http> http(new Http());
@@ -732,10 +726,7 @@ TEST_P(HTTPTest, Get)
 }
 
 
-// TODO(hausdorff): Routing logic is broken on Windows. Fix and enable test. In
-// this case, the route '/a/b/c' exists and returns 200 ok, but '/a/b' does
-// not. See MESOS-5904.
-TEST_P_TEMP_DISABLED_ON_WINDOWS(HTTPTest, NestedGet)
+TEST_P(HTTPTest, NestedGet)
 {
   Http http;
 


[2/8] mesos git commit: Windows: Documented why the `RemoteLinkLeak` test is not enabled.

Posted by an...@apache.org.
Windows: Documented why the `RemoteLinkLeak` test is not enabled.

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


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

Branch: refs/heads/master
Commit: ac3b74e9f29c2bdd5feb9d679f15405643d61edb
Parents: 81e4944
Author: Andrew Schwartzmeyer <an...@schwartzmeyer.com>
Authored: Wed Jul 18 17:11:49 2018 -0700
Committer: Andrew Schwartzmeyer <an...@schwartzmeyer.com>
Committed: Tue Jul 24 10:58:52 2018 -0700

----------------------------------------------------------------------
 3rdparty/libprocess/src/tests/process_tests.cpp | 6 ++++++
 1 file changed, 6 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/ac3b74e9/3rdparty/libprocess/src/tests/process_tests.cpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/src/tests/process_tests.cpp b/3rdparty/libprocess/src/tests/process_tests.cpp
index d124b5a..d5d9afc 100644
--- a/3rdparty/libprocess/src/tests/process_tests.cpp
+++ b/3rdparty/libprocess/src/tests/process_tests.cpp
@@ -998,6 +998,12 @@ TEST_F(ProcessRemoteLinkTest, RemoteDoubleLinkRelink)
 // Verifies that remote links will trigger an `ExitedEvent` if the link
 // fails during socket creation. The test instigates a socket creation
 // failure by hogging all available file descriptors.
+//
+// TODO(andschwa): Enable this test. The current logic will not work on Windows
+// as " The Microsoft Winsock provider limits the maximum number of sockets
+// supported only by available memory on the local computer." See MESOS-9093.
+//
+// https://docs.microsoft.com/en-us/windows/desktop/WinSock/maximum-number-of-sockets-supported-2 // NOLINT(whitespace/line_length)
 TEST_F_TEMP_DISABLED_ON_WINDOWS(ProcessRemoteLinkTest, RemoteLinkLeak)
 {
   RemoteLinkTestProcess relinker(pid);


[6/8] mesos git commit: Fixed `test-linkee` logic in `ProcessRemoteLinkTest::SetUp()`.

Posted by an...@apache.org.
Fixed `test-linkee` logic in `ProcessRemoteLinkTest::SetUp()`.

Several problems existed on Windows here:

* The `BUILD_DIR` path has forward slashes (probably fine, but wrong).
* The executable must be named correctly, `.exe` and all.
* We should assert that `test-linkee` exists.
* The shell should not be used, otherwise `'(62)'` will resolve to an
  unknown UPID inside `test-linkee` because of the single quotes.

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


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

Branch: refs/heads/master
Commit: cf51b2360b64ef9bfc42ebdc19ebbd2b31b81021
Parents: 81597a0
Author: Andrew Schwartzmeyer <an...@schwartzmeyer.com>
Authored: Wed Jul 18 15:48:43 2018 -0700
Committer: Andrew Schwartzmeyer <an...@schwartzmeyer.com>
Committed: Tue Jul 24 10:58:52 2018 -0700

----------------------------------------------------------------------
 3rdparty/libprocess/src/tests/process_tests.cpp | 24 ++++++++++++++++++--
 1 file changed, 22 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/cf51b236/3rdparty/libprocess/src/tests/process_tests.cpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/src/tests/process_tests.cpp b/3rdparty/libprocess/src/tests/process_tests.cpp
index 8baf60d..8e4135a 100644
--- a/3rdparty/libprocess/src/tests/process_tests.cpp
+++ b/3rdparty/libprocess/src/tests/process_tests.cpp
@@ -783,9 +783,29 @@ protected:
     EXPECT_CALL(coordinator, consume_(_))
       .WillOnce(FutureArg<0>(&message));
 
+    // TODO(andschwa): Clean this up so that `BUILD_DIR` has the correct
+    // separator at compilation time.
+#ifdef __WINDOWS__
+    const std::string buildDir = strings::replace(BUILD_DIR, "/", "\\");
+#else
+    const std::string buildDir = BUILD_DIR;
+#endif // __WINDOWS__
+
+#ifdef __WINDOWS__
+    constexpr char LINKEENAME[] = "test-linkee.exe";
+#else
+    constexpr char LINKEENAME[] = "test-linkee";
+#endif // __WINDOWS__
+
+    const std::string linkeePath = path::join(buildDir, LINKEENAME);
+    ASSERT_TRUE(os::exists(linkeePath));
+
+    // NOTE: Because of the differences between Windows and POSIX
+    // shells when interpreting quotes, we use the second form of
+    // `subprocess` to call `test-linkee` directly with a set of
+    // arguments, rather than through the shell.
     Try<Subprocess> s = process::subprocess(
-        path::join(BUILD_DIR, "test-linkee") +
-          " '" + stringify(coordinator.self()) + "'");
+        linkeePath, {linkeePath, stringify(coordinator.self())});
     ASSERT_SOME(s);
     linkee = s.get();