You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by ji...@apache.org on 2014/08/16 20:46:39 UTC

[2/2] git commit: Fixed libprocess tests due to the new io::read semantics.

Fixed libprocess tests due to the new io::read semantics.

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


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

Branch: refs/heads/master
Commit: 44d0bae83c18dd5334f05e8d4f697654fb555a59
Parents: 0bc57b8
Author: Jie Yu <yu...@gmail.com>
Authored: Sat Aug 16 10:46:44 2014 -0700
Committer: Jie Yu <yu...@gmail.com>
Committed: Sat Aug 16 11:46:24 2014 -0700

----------------------------------------------------------------------
 3rdparty/libprocess/src/tests/io_tests.cpp       | 19 +++----------------
 .../libprocess/src/tests/subprocess_tests.cpp    | 10 ----------
 2 files changed, 3 insertions(+), 26 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/44d0bae8/3rdparty/libprocess/src/tests/io_tests.cpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/src/tests/io_tests.cpp b/3rdparty/libprocess/src/tests/io_tests.cpp
index 1102b1a..4d304fe 100644
--- a/3rdparty/libprocess/src/tests/io_tests.cpp
+++ b/3rdparty/libprocess/src/tests/io_tests.cpp
@@ -128,11 +128,6 @@ TEST(IO, BufferedRead)
   Try<int> fd = os::open("file", O_RDONLY);
   ASSERT_SOME(fd);
 
-  // Read from blocking fd.
-  AWAIT_EXPECT_FAILED(io::read(fd.get()));
-
-  // Read from non-blocking fd.
-  ASSERT_TRUE(os::nonblock(fd.get()).isSome());
   AWAIT_EXPECT_EQ(data, io::read(fd.get()));
 
   ASSERT_SOME(os::close(fd.get()));
@@ -140,27 +135,19 @@ TEST(IO, BufferedRead)
   // Now read from pipes.
   int pipes[2];
 
-  // Create a blocking pipe.
+  // Test on a closed pipe.
   ASSERT_NE(-1, ::pipe(pipes));
-
-  // Test on a blocking pipe.
-  AWAIT_EXPECT_FAILED(io::read(pipes[0]));
-
   ASSERT_SOME(os::close(pipes[0]));
   ASSERT_SOME(os::close(pipes[1]));
 
-  // Test on a closed pipe.
   AWAIT_EXPECT_FAILED(io::read(pipes[0]));
 
-  // Create a nonblocking pipe for reading.
-  ASSERT_NE(-1, ::pipe(pipes));
-  ASSERT_SOME(os::nonblock(pipes[0]));
-
   // Test a successful read from the pipe.
-  Future<string> future = io::read(pipes[0]);
+  ASSERT_NE(-1, ::pipe(pipes));
 
   // At first, the future will not be ready until we write to and
   // close the pipe.
+  Future<string> future = io::read(pipes[0]);
   ASSERT_FALSE(future.isReady());
 
   ASSERT_SOME(os::write(pipes[1], data));

http://git-wip-us.apache.org/repos/asf/mesos/blob/44d0bae8/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 5fec289..c2c9a5e 100644
--- a/3rdparty/libprocess/src/tests/subprocess_tests.cpp
+++ b/3rdparty/libprocess/src/tests/subprocess_tests.cpp
@@ -129,7 +129,6 @@ TEST_F(SubprocessTest, PipeOutput)
 
   ASSERT_SOME(s);
   ASSERT_SOME(s.get().out());
-  ASSERT_SOME(os::nonblock(s.get().out().get()));
   AWAIT_EXPECT_EQ("hello\n", io::read(s.get().out().get()));
 
   // Advance time until the internal reaper reaps the subprocess.
@@ -154,7 +153,6 @@ TEST_F(SubprocessTest, PipeOutput)
 
   ASSERT_SOME(s);
   ASSERT_SOME(s.get().err());
-  ASSERT_SOME(os::nonblock(s.get().err().get()));
   AWAIT_EXPECT_EQ("hello\n", io::read(s.get().err().get()));
 
   // Advance time until the internal reaper reaps the subprocess.
@@ -189,7 +187,6 @@ TEST_F(SubprocessTest, PipeInput)
   ASSERT_SOME(os::write(s.get().in().get(), "hello\n"));
 
   ASSERT_SOME(s.get().out());
-  ASSERT_SOME(os::nonblock(s.get().out().get()));
   AWAIT_EXPECT_EQ("hello\n", io::read(s.get().out().get()));
 
   // Advance time until the internal reaper reaps the subprocess.
@@ -337,7 +334,6 @@ TEST_F(SubprocessTest, PathInput)
 
   ASSERT_SOME(s);
   ASSERT_SOME(s.get().out());
-  ASSERT_SOME(os::nonblock(s.get().out().get()));
   AWAIT_EXPECT_EQ("hello\n", io::read(s.get().out().get()));
 
   // Advance time until the internal reaper reaps the subprocess.
@@ -457,7 +453,6 @@ TEST_F(SubprocessTest, FdInput)
 
   ASSERT_SOME(s);
   ASSERT_SOME(s.get().out());
-  ASSERT_SOME(os::nonblock(s.get().out().get()));
   AWAIT_EXPECT_EQ("hello\n", io::read(s.get().out().get()));
 
   // Advance time until the internal reaper reaps the subprocess.
@@ -636,7 +631,6 @@ TEST_F(SubprocessTest, Environment)
 
   ASSERT_SOME(s);
   ASSERT_SOME(s.get().out());
-  ASSERT_SOME(os::nonblock(s.get().out().get()));
   AWAIT_EXPECT_EQ("hello\n", io::read(s.get().out().get()));
 
   // Advance time until the internal reaper reaps the subprocess.
@@ -666,7 +660,6 @@ TEST_F(SubprocessTest, Environment)
 
   ASSERT_SOME(s);
   ASSERT_SOME(s.get().out());
-  ASSERT_SOME(os::nonblock(s.get().out().get()));
   AWAIT_EXPECT_EQ("hello world\n", io::read(s.get().out().get()));
 
   // Advance time until the internal reaper reaps the subprocess.
@@ -703,7 +696,6 @@ TEST_F(SubprocessTest, EnvironmentWithSpaces)
 
   ASSERT_SOME(s);
   ASSERT_SOME(s.get().out());
-  ASSERT_SOME(os::nonblock(s.get().out().get()));
   AWAIT_EXPECT_EQ("hello world\n", io::read(s.get().out().get()));
 
   // Advance time until the internal reaper reaps the subprocess.
@@ -740,7 +732,6 @@ TEST_F(SubprocessTest, EnvironmentWithSpacesAndQuotes)
 
   ASSERT_SOME(s);
   ASSERT_SOME(s.get().out());
-  ASSERT_SOME(os::nonblock(s.get().out().get()));
   AWAIT_EXPECT_EQ("\"hello world\"\n", io::read(s.get().out().get()));
 
   // Advance time until the internal reaper reaps the subprocess.
@@ -779,7 +770,6 @@ TEST_F(SubprocessTest, EnvironmentOverride)
 
   ASSERT_SOME(s);
   ASSERT_SOME(s.get().out());
-  ASSERT_SOME(os::nonblock(s.get().out().get()));
   AWAIT_EXPECT_EQ("goodbye\n", io::read(s.get().out().get()));
 
   // Advance time until the internal reaper reaps the subprocess.