diff options
author | Elliott Hughes <enh@google.com> | 2012-10-10 14:45:57 -0700 |
---|---|---|
committer | Elliott Hughes <enh@google.com> | 2012-10-10 16:03:21 -0700 |
commit | 78601286edbfed7ea072814763f661eb80f6e777 (patch) | |
tree | d3107674e31dfc855ec80e9e3872c17a92a0ed40 | |
parent | cc5d0071987b9cacd58750e53ede3fd3b53fb2c9 (diff) | |
download | libcore-78601286edbfed7ea072814763f661eb80f6e777.zip libcore-78601286edbfed7ea072814763f661eb80f6e777.tar.gz libcore-78601286edbfed7ea072814763f661eb80f6e777.tar.bz2 |
Extra log output for ConcurrentCloseTest flakiness.
No clue what's wrong here, but we're seeing some flakiness in the
"connect" tests. Hopefully there will be a clue in this extra
output next time we see a failure.
(cherry-pick of 735875881f3995ec6a687e65a2e5495304bc48be.)
Bug: 6971145
Change-Id: I8236b2fb368581e2b6965898f109370e7e0af2e5
-rw-r--r-- | luni/src/test/java/libcore/java/net/ConcurrentCloseTest.java | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/luni/src/test/java/libcore/java/net/ConcurrentCloseTest.java b/luni/src/test/java/libcore/java/net/ConcurrentCloseTest.java index 06a546a..6988f6f 100644 --- a/luni/src/test/java/libcore/java/net/ConcurrentCloseTest.java +++ b/luni/src/test/java/libcore/java/net/ConcurrentCloseTest.java @@ -38,12 +38,12 @@ import tests.net.StuckServer; */ public class ConcurrentCloseTest extends junit.framework.TestCase { public void test_accept() throws Exception { - ServerSocket s = new ServerSocket(0); - new Killer(s).start(); + ServerSocket ss = new ServerSocket(0); + new Killer(ss).start(); try { System.err.println("accept..."); - s.accept(); - fail("accept returned!"); + Socket s = ss.accept(); + fail("accept returned " + s + "!"); } catch (SocketException expected) { assertEquals("Socket closed", expected.getMessage()); } @@ -54,9 +54,9 @@ public class ConcurrentCloseTest extends junit.framework.TestCase { Socket s = new Socket(); new Killer(s).start(); try { - System.err.println("connect..."); + System.err.println("connect " + s + " to " + ss.getLocalSocketAddress() + "..."); s.connect(ss.getLocalSocketAddress()); - fail("connect returned!"); + fail("connect returned: " + s + "!"); } catch (SocketException expected) { assertEquals("Socket closed", expected.getMessage()); } finally { @@ -69,9 +69,9 @@ public class ConcurrentCloseTest extends junit.framework.TestCase { Socket s = new Socket(); new Killer(s).start(); try { - System.err.println("connect (with timeout)..."); + System.err.println("connect (with timeout) " + s + " to " + ss.getLocalSocketAddress() + "..."); s.connect(ss.getLocalSocketAddress(), 3600 * 1000); - fail("connect returned!"); + fail("connect returned: " + s + "!"); } catch (SocketException expected) { assertEquals("Socket closed", expected.getMessage()); } finally { @@ -84,13 +84,13 @@ public class ConcurrentCloseTest extends junit.framework.TestCase { SocketChannel s = SocketChannel.open(); new Killer(s.socket()).start(); try { - System.err.println("connect (non-blocking)..."); + System.err.println("connect (non-blocking) " + s + " to " + ss.getLocalSocketAddress() + "..."); s.configureBlocking(false); s.connect(ss.getLocalSocketAddress()); while (!s.finishConnect()) { // Spin like a mad thing! } - fail("connect returned!"); + fail("connect returned: " + s + "!"); } catch (SocketException expected) { assertEquals("Socket closed", expected.getMessage()); } catch (AsynchronousCloseException alsoOkay) { @@ -111,7 +111,7 @@ public class ConcurrentCloseTest extends junit.framework.TestCase { try { System.err.println("read..."); int i = s.getInputStream().read(); - fail("read returned " + i); + fail("read returned: " + i); } catch (SocketException expected) { assertEquals("Socket closed", expected.getMessage()); } @@ -136,7 +136,7 @@ public class ConcurrentCloseTest extends junit.framework.TestCase { try { System.err.println("read..."); int i = s.getInputStream().read(); - fail("read returned " + i); + fail("read returned: " + i); } catch (SocketException expected) { assertEquals("Socket closed", expected.getMessage()); } @@ -238,7 +238,7 @@ public class ConcurrentCloseTest extends junit.framework.TestCase { try { System.err.println("sleep..."); Thread.sleep(2000); - System.err.println("close..."); + System.err.println("close " + s + "..."); s.getClass().getMethod("close").invoke(s); } catch (Exception ex) { ex.printStackTrace(); |