Windows: Made `CURL` test filter also succeed.

Since `curl.exe` is built as part of Windows (it's a build target which
`mesos-agent` depends on), it will always exist in a known location for
test purposes.

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


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

Branch: refs/heads/master
Commit: 2b80a7a9ea7db710b703b11e6d9daaafd4d7e1ea
Parents: ae5a696
Author: Jeff Coffler <j...@taltos.com>
Authored: Thu Feb 8 15:19:25 2018 -0800
Committer: Andrew Schwartzmeyer <and...@schwartzmeyer.com>
Committed: Thu Feb 8 15:32:28 2018 -0800

----------------------------------------------------------------------
 src/tests/environment.cpp | 11 +++++++++++
 1 file changed, 11 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/2b80a7a9/src/tests/environment.cpp
----------------------------------------------------------------------
diff --git a/src/tests/environment.cpp b/src/tests/environment.cpp
index 13a4c95..931e647 100644
--- a/src/tests/environment.cpp
+++ b/src/tests/environment.cpp
@@ -216,7 +216,18 @@ class CurlFilter : public TestFilter
 public:
   CurlFilter()
   {
+#ifndef __WINDOWS__
     curlError = os::which("curl").isNone();
+#else
+    // NOTE: We cannot use `os::which` here because it specifically checks the
+    // `PATH` for `curl`, but on Windows, we rely on `curl` being placed by the
+    // build next to the other executables (e.g. `mesos-agent` and
+    // `mesos-tests`). When placed like this, `::CreateProcess` is guaranteed 
to
+    // find it, regardless of `PATH` (and likewise `os::which`). Because it is
+    // built and placed as a build dependency of `mesos-agent`, it will always
+    // be available for testing.
+    curlError = false;
+#endif // __WINDOWS__
     if (curlError) {
       std::cerr
         << "-------------------------------------------------------------\n"

Reply via email to