You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by bm...@apache.org on 2014/02/06 19:52:32 UTC

[1/2] git commit: Added missing include for reap.hpp.

Updated Branches:
  refs/heads/master cbba5d178 -> d4741b5e3


Added missing include for reap.hpp.

From: Ian Downes <ia...@gmail.com>
Review: https://reviews.apache.org/r/17782


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

Branch: refs/heads/master
Commit: c392b013c589765b9022248e471ee2a2803107f2
Parents: cbba5d1
Author: Benjamin Mahler <bm...@twitter.com>
Authored: Thu Feb 6 10:45:49 2014 -0800
Committer: Benjamin Mahler <bm...@twitter.com>
Committed: Thu Feb 6 10:45:49 2014 -0800

----------------------------------------------------------------------
 3rdparty/libprocess/include/process/reap.hpp | 2 ++
 1 file changed, 2 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/c392b013/3rdparty/libprocess/include/process/reap.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/include/process/reap.hpp b/3rdparty/libprocess/include/process/reap.hpp
index dcc6c72..9de5336 100644
--- a/3rdparty/libprocess/include/process/reap.hpp
+++ b/3rdparty/libprocess/include/process/reap.hpp
@@ -3,6 +3,8 @@
 
 #include <sys/types.h>
 
+#include <process/future.hpp>
+
 #include <stout/option.hpp>
 
 namespace process {


[2/2] git commit: Added a Subprocess test that uses splice to redirect output.

Posted by bm...@apache.org.
Added a Subprocess test that uses splice to redirect output.

From: Ian Downes <ia...@gmail.com>
Review: https://reviews.apache.org/r/17783


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

Branch: refs/heads/master
Commit: d4741b5e3fb32ebd0cf664a059d3e89221a1f1b9
Parents: c392b01
Author: Benjamin Mahler <bm...@twitter.com>
Authored: Thu Feb 6 10:46:07 2014 -0800
Committer: Benjamin Mahler <bm...@twitter.com>
Committed: Thu Feb 6 10:46:07 2014 -0800

----------------------------------------------------------------------
 .../libprocess/src/tests/subprocess_tests.cpp   | 44 ++++++++++++++++++++
 1 file changed, 44 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/d4741b5e/3rdparty/libprocess/src/tests/subprocess_tests.cpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/src/tests/subprocess_tests.cpp b/3rdparty/libprocess/src/tests/subprocess_tests.cpp
index d2cf7f5..e720176 100644
--- a/3rdparty/libprocess/src/tests/subprocess_tests.cpp
+++ b/3rdparty/libprocess/src/tests/subprocess_tests.cpp
@@ -187,3 +187,47 @@ TEST(Subprocess, input)
 
   Clock::resume();
 }
+
+
+TEST(Subprocess, splice)
+{
+  Clock::pause();
+
+  Try<Subprocess> s = subprocess("echo 'hello world'");
+
+  ASSERT_SOME(s);
+
+  // Create a temporary file for splicing into.
+  Try<string> path = os::mktemp();
+  ASSERT_SOME(path);
+
+  Try<int> fd = os::open(
+      path.get(),
+      O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR | S_IRGRP | S_IRWXO);
+  ASSERT_SOME(fd);
+  ASSERT_SOME(os::nonblock(fd.get()));
+
+  ASSERT_SOME(os::nonblock(s.get().out()));
+
+  AWAIT_READY(io::splice(s.get().out(), fd.get()));
+
+  // Advance time until the internal reaper reaps the subprocess.
+  while (s.get().status().isPending()) {
+    Clock::advance(Seconds(1));
+    Clock::settle();
+  }
+
+  AWAIT_ASSERT_READY(s.get().status());
+  ASSERT_SOME(s.get().status().get());
+  int status = s.get().status().get().get();
+
+  ASSERT_TRUE(WIFEXITED(status));
+  ASSERT_EQ(0, WEXITSTATUS(status));
+
+  // Now make sure all the data is there!
+  Try<string> read = os::read(path.get());
+  ASSERT_SOME(read);
+  EXPECT_EQ("hello world\n", read.get());
+
+  Clock::resume();
+}