You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@thrift.apache.org by ro...@apache.org on 2013/05/03 22:40:39 UTC

git commit: THRIFT-1850 make check hangs on TSocket tests in TransportTest.cpp Patch: Randy Abernethy

Updated Branches:
  refs/heads/master 0fd47dab1 -> 967600ef4


THRIFT-1850 make check hangs on TSocket tests in TransportTest.cpp
Patch: Randy Abernethy


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

Branch: refs/heads/master
Commit: 967600ef4f09445d9dbb6654dca8d235d9d65f5b
Parents: 0fd47da
Author: Roger Meier <ro...@apache.org>
Authored: Fri May 3 22:39:53 2013 +0200
Committer: Roger Meier <ro...@apache.org>
Committed: Fri May 3 22:39:53 2013 +0200

----------------------------------------------------------------------
 lib/cpp/test/TransportTest.cpp |   14 +++++++++++---
 1 files changed, 11 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/thrift/blob/967600ef/lib/cpp/test/TransportTest.cpp
----------------------------------------------------------------------
diff --git a/lib/cpp/test/TransportTest.cpp b/lib/cpp/test/TransportTest.cpp
old mode 100644
new mode 100755
index 508d3e3..4233e6e
--- a/lib/cpp/test/TransportTest.cpp
+++ b/lib/cpp/test/TransportTest.cpp
@@ -236,6 +236,7 @@ class CoupledSocketTransports : public CoupledTransports<TSocket> {
 
     in.reset(new TSocket(sockets[0]));
     out.reset(new TSocket(sockets[1]));
+    out->setSendTimeout(100);
   }
 };
 
@@ -511,7 +512,14 @@ void test_rw(uint32_t totalSize,
         write_size = wchunk_size - chunk_written;
       }
 
-      transports.out->write(wbuf.get() + total_written, write_size);
+      try {
+        transports.out->write(wbuf.get() + total_written, write_size);
+      }
+      catch (TTransportException & te) {
+        if (te.getType() == TTransportException::TIMED_OUT)
+          break;
+        throw te;
+      }
       chunk_written += write_size;
       total_written += write_size;
     }
@@ -856,7 +864,7 @@ class TransportTestGen {
     // each send() call.  If we have more than ~400 outstanding 1-byte write
     // requests, additional send() calls start blocking.
     TEST_RW(CoupledSocketTransports, 1024*16, 1, 1,
-            0, 0, 400);
+            0, 0, socket_max_outstanding);
     TEST_RW(CoupledSocketTransports, 1024*256, 0, 0,
             rand4k, rand4k, socket_max_outstanding);
     TEST_RW(CoupledSocketTransports, 1024*256, rand4k, rand4k,
@@ -864,7 +872,7 @@ class TransportTestGen {
     TEST_RW(CoupledSocketTransports, 1024*256, 167, 163,
             rand4k, rand4k, socket_max_outstanding);
     TEST_RW(CoupledSocketTransports, 1024*16, 1, 1,
-            rand4k, rand4k, 400);
+            rand4k, rand4k, socket_max_outstanding);
 
     TEST_BLOCKING_BEHAVIOR(CoupledSocketTransports);