HADOOP-11462. TestSocketIOWithTimeout needs change for PowerPC platform. Contributed by Ayappan.

This commit is contained in:
cnauroth 2015-01-07 12:24:10 -08:00
parent fe8d2bd741
commit 3ed0aed3cc
2 changed files with 8 additions and 2 deletions

View File

@ -680,6 +680,9 @@ Release 2.7.0 - UNRELEASED
HADOOP-11445. Bzip2Codec: Data block is skipped when position of newly HADOOP-11445. Bzip2Codec: Data block is skipped when position of newly
created stream is equal to start of split (Ankit Kamboj via jlowe) created stream is equal to start of split (Ankit Kamboj via jlowe)
HADOOP-11462. TestSocketIOWithTimeout needs change for PowerPC platform.
(Ayappan via cnauroth)
Release 2.6.0 - 2014-11-18 Release 2.6.0 - 2014-11-18
INCOMPATIBLE CHANGES INCOMPATIBLE CHANGES

View File

@ -33,6 +33,7 @@ import org.apache.hadoop.test.MultithreadedTestUtil.TestContext;
import org.apache.hadoop.test.MultithreadedTestUtil.TestingThread; import org.apache.hadoop.test.MultithreadedTestUtil.TestingThread;
import org.apache.hadoop.util.Time; import org.apache.hadoop.util.Time;
import org.apache.hadoop.util.Shell; import org.apache.hadoop.util.Shell;
import org.apache.hadoop.io.nativeio.NativeIO;
import org.junit.Test; import org.junit.Test;
import static org.junit.Assert.*; import static org.junit.Assert.*;
@ -53,12 +54,14 @@ public class TestSocketIOWithTimeout {
private MultithreadedTestUtil.TestContext ctx = new TestContext(); private MultithreadedTestUtil.TestContext ctx = new TestContext();
private static final int PAGE_SIZE = (int) NativeIO.POSIX.getCacheManipulator().getOperatingSystemPageSize();
private void doIO(InputStream in, OutputStream out, private void doIO(InputStream in, OutputStream out,
int expectedTimeout) throws IOException { int expectedTimeout) throws IOException {
/* Keep on writing or reading until we get SocketTimeoutException. /* Keep on writing or reading until we get SocketTimeoutException.
* It expects this exception to occur within 100 millis of TIMEOUT. * It expects this exception to occur within 100 millis of TIMEOUT.
*/ */
byte buf[] = new byte[4192]; byte buf[] = new byte[PAGE_SIZE + 19];
while (true) { while (true) {
long start = Time.now(); long start = Time.now();
@ -151,7 +154,7 @@ public class TestSocketIOWithTimeout {
// simulate a partial write scenario. Attempts were made to switch the // simulate a partial write scenario. Attempts were made to switch the
// test from using a pipe to a network socket and also to use larger and // test from using a pipe to a network socket and also to use larger and
// larger buffers in doIO. Nothing helped the situation though. // larger buffers in doIO. Nothing helped the situation though.
if (!Shell.WINDOWS && !Shell.PPC_64) { if (!Shell.WINDOWS) {
try { try {
out.write(1); out.write(1);
fail("Did not throw"); fail("Did not throw");