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:05 UTC

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

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();