Mercurial > hg > release > icedtea6-1.10
changeset 2250:b17d4c7ff7a1
S6510892, S6969395: Fix networking tests.
2010-09-07 Andrew John Hughes <ahughes@redhat.com>
S6510892, S6969395:
* Makefile.am: Add new patches.
* NEWS: Updated.
* patches/openjdk/6510892-httpserver_test.patch,
* patches/openjdk/6969395-net_bugs.patch:
Fix networking tests.
author | Andrew John Hughes <ahughes@redhat.com> |
---|---|
date | Tue, 07 Sep 2010 12:38:02 +0100 |
parents | dfc3c1061ec7 |
children | e8452eabe369 |
files | ChangeLog Makefile.am NEWS patches/openjdk/6510892-httpserver_test.patch patches/openjdk/6969395-net_bugs.patch |
diffstat | 5 files changed, 597 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Fri Sep 03 11:00:55 2010 +0200 +++ b/ChangeLog Tue Sep 07 12:38:02 2010 +0100 @@ -1,3 +1,12 @@ +2010-09-07 Andrew John Hughes <ahughes@redhat.com> + + S6510892, S6969395: + * Makefile.am: Add new patches. + * NEWS: Updated. + * patches/openjdk/6510892-httpserver_test.patch, + * patches/openjdk/6969395-net_bugs.patch: + Fix networking tests. + 2010-09-03 Pavel Tisnovsky <ptisnovs@redhat.com> * Makefile.am: Fixed indentation, changes spaces to tab.
--- a/Makefile.am Fri Sep 03 11:00:55 2010 +0200 +++ b/Makefile.am Tue Sep 07 12:38:02 2010 +0100 @@ -293,7 +293,9 @@ patches/openjdk/6438179-systray_check.patch \ patches/openjdk/6951319-sparc_build_fixes.patch \ patches/icedtea-too-many-args.patch \ - patches/icedtea-jtreg-OpenGLContextInit.patch + patches/icedtea-jtreg-OpenGLContextInit.patch \ + patches/openjdk/6969395-net_bugs.patch \ + patches/openjdk/6510892-httpserver_test.patch if WITH_RHINO ICEDTEA_PATCHES += \
--- a/NEWS Fri Sep 03 11:00:55 2010 +0200 +++ b/NEWS Tue Sep 07 12:38:02 2010 +0100 @@ -710,6 +710,8 @@ - S6961732: FontMetrics.getLeading() may be negative in freetype-based OpenJDK builds - S6967533: ExceptionInInitializerError on systems with uninitialized clock - S6795060: VM crash on Linux in ICU layout library when processing \u0DDD (Sinhalese) + - S6969395: Synchronization of HttpServlet regression test with OpenJDK7 + - S6510892: com/sun/net/httpserver/bugs/B6361557.java fails * Fixes: - Provide font configuration for RHEL 6. - G266295: Provide font configuration for Gentoo.
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/openjdk/6510892-httpserver_test.patch Tue Sep 07 12:38:02 2010 +0100 @@ -0,0 +1,122 @@ +# HG changeset patch +# User michaelm +# Date 1280510190 -3600 +# Node ID 4d72d0ec83f5e7870c3f38c0c238b8617273ee4d +# Parent 48e6f4807e5f2c4fea2ac435ea92a1a7531019d8 +6510892: com/sun/net/httpserver/bugs/B6361557.java fails +Reviewed-by: chegar + +diff -r 48e6f4807e5f -r 4d72d0ec83f5 test/com/sun/net/httpserver/bugs/B6361557.java +--- openjdk.orig/jdk/test/com/sun/net/httpserver/bugs/B6361557.java Thu Jul 29 22:02:45 2010 -0700 ++++ openjdk/jdk/test/com/sun/net/httpserver/bugs/B6361557.java Fri Jul 30 18:16:30 2010 +0100 +@@ -24,6 +24,7 @@ + /** + * @test + * @bug 6361557 ++ * @run main/othervm B6361557 + * @summary Lightweight HTTP server quickly runs out of file descriptors on Linux + */ + +@@ -63,6 +64,9 @@ + } + } + ++ final static String request = "GET /test/foo.html HTTP/1.1\r\nContent-length: 0\r\n\r\n"; ++ final static ByteBuffer requestBuf = ByteBuffer.allocate(64).put(request.getBytes()); ++ + public static void main (String[] args) throws Exception { + Handler handler = new Handler(); + InetSocketAddress addr = new InetSocketAddress (0); +@@ -73,48 +77,72 @@ + server.setExecutor (executor); + server.start (); + +- ByteBuffer buf = ByteBuffer.allocate (4096); + InetSocketAddress destaddr = new InetSocketAddress ( + "127.0.0.1", server.getAddress().getPort() + ); + System.out.println ("destaddr " + destaddr); + + Selector selector = Selector.open (); +- int i = 0; ++ int requests = 0; ++ int responses = 0; + while (true) { +- i ++; + int selres = selector.select (1); + Set<SelectionKey> selkeys = selector.selectedKeys(); + for (SelectionKey key : selkeys) { + if (key.isReadable()) { + SocketChannel chan = (SocketChannel)key.channel(); +- buf.clear(); ++ ByteBuffer buf = (ByteBuffer)key.attachment(); + try { +- int x = chan.read (buf); +- if (x == -1) { ++ int x = chan.read(buf); ++ if (x == -1 || responseComplete(buf)) { ++ key.attach(null); + chan.close(); ++ responses++; + } + } catch (IOException e) {} + } + } +- if (i< NUM) { +- SocketChannel schan = SocketChannel.open (destaddr); +- String cmd = "GET /test/foo.html HTTP/1.1\r\nContent-length: 0\r\n\r\n"; +- buf.rewind (); +- buf.put (cmd.getBytes()); +- buf.flip(); ++ if (requests < NUM) { ++ SocketChannel schan = SocketChannel.open(destaddr); ++ requestBuf.rewind(); + int c = 0; +- while (buf.remaining() > 0) { +- c += schan.write (buf); ++ while (requestBuf.remaining() > 0) { ++ c += schan.write(requestBuf); + } +- schan.configureBlocking (false); +- schan.register (selector, SelectionKey.OP_READ, null); +- } else { ++ schan.configureBlocking(false); ++ schan.register(selector, SelectionKey.OP_READ, ByteBuffer.allocate(100)); ++ requests++; ++ } ++ if (responses == NUM) { + System.out.println ("Finished clients"); +- server.stop (1); +- executor.shutdown (); +- return; ++ break; + } + } ++ server.stop (1); ++ selector.close(); ++ executor.shutdown (); ++ ++ } ++ ++ /* Look for CR LF CR LF */ ++ static boolean responseComplete(ByteBuffer buf) { ++ int pos = buf.position(); ++ buf.flip(); ++ byte[] lookingFor = new byte[] {'\r', '\n', '\r', '\n' }; ++ int lookingForCount = 0; ++ while (buf.hasRemaining()) { ++ byte b = buf.get(); ++ if (b == lookingFor[lookingForCount]) { ++ lookingForCount++; ++ if (lookingForCount == 4) { ++ return true; ++ } ++ } else { ++ lookingForCount = 0; ++ } ++ } ++ buf.position(pos); ++ buf.limit(buf.capacity()); ++ return false; + } + }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/openjdk/6969395-net_bugs.patch Tue Sep 07 12:38:02 2010 +0100 @@ -0,0 +1,461 @@ +# HG changeset patch +# User ptisnovs +# Date 1279815765 -7200 +# Node ID 13939cd625076ff7cfd40556a9c44e5e9eb13094 +# Parent f63ef918ce3a1c4d403a85796dbb5a288539e46e +6969395: TEST_BUG: Tests in java/net sun/net problems +Summary: Synchronization of HttpServlet regression test with OpenJDK7 +Reviewed-by: chegar + +diff -r f63ef918ce3a -r 13939cd62507 test/com/sun/net/httpserver/Test1.java +--- openjdk.orig/jdk/test/com/sun/net/httpserver/Test1.java Fri Jul 25 14:46:38 2008 +0400 ++++ openjdk/jdk/test/com/sun/net/httpserver/Test1.java Thu Jul 22 18:22:45 2010 +0200 +@@ -24,17 +24,15 @@ + /** + * @test + * @bug 6270015 ++ * @run main/othervm Test1 + * @summary Light weight HTTP server + */ + + import com.sun.net.httpserver.*; + +-import java.util.*; + import java.util.concurrent.*; + import java.io.*; + import java.net.*; +-import java.security.*; +-import java.security.cert.*; + import javax.net.ssl.*; + + /* basic http/s connectivity test +@@ -86,9 +84,12 @@ + System.out.println ("OK"); + } finally { + delay(); +- s1.stop(2); +- s2.stop(2); +- executor.shutdown (); ++ if (s1 != null) ++ s1.stop(2); ++ if (s2 != null) ++ s2.stop(2); ++ if (executor != null) ++ executor.shutdown (); + } + } + +diff -r f63ef918ce3a -r 13939cd62507 test/com/sun/net/httpserver/Test11.java +--- openjdk.orig/jdk/test/com/sun/net/httpserver/Test11.java Fri Jul 25 14:46:38 2008 +0400 ++++ openjdk/jdk/test/com/sun/net/httpserver/Test11.java Thu Jul 22 18:22:45 2010 +0200 +@@ -28,7 +28,6 @@ + */ + + import java.net.*; +-import java.util.*; + import java.util.concurrent.*; + import java.io.*; + import com.sun.net.httpserver.*; +@@ -52,22 +51,25 @@ + + public static void main (String[] args) throws Exception { + System.out.print ("Test 11: "); +- HttpServer server = HttpServer.create (new InetSocketAddress(0), 0); +- HttpContext ctx = server.createContext ( +- "/foo/bar/", new Handler () +- ); +- ExecutorService s = Executors.newCachedThreadPool(); +- server.setExecutor (s); +- server.start (); +- URL url = new URL ("http://localhost:" + server.getAddress().getPort()+ +- "/Foo/bar/test.html"); +- HttpURLConnection urlc = (HttpURLConnection)url.openConnection(); +- int r = urlc.getResponseCode(); +- System.out.println ("OK"); +- s.shutdown(); +- server.stop(5); +- if (r == 200) { +- throw new RuntimeException ("wrong response received"); ++ HttpServer server = HttpServer.create(new InetSocketAddress(0), 0); ++ ExecutorService s = Executors.newCachedThreadPool(); ++ try { ++ HttpContext ctx = server.createContext ( ++ "/foo/bar/", new Handler () ++ ); ++ s = Executors.newCachedThreadPool(); ++ server.start (); ++ URL url = new URL ("http://localhost:" + server.getAddress().getPort()+ ++ "/Foo/bar/test.html"); ++ HttpURLConnection urlc = (HttpURLConnection)url.openConnection(); ++ int r = urlc.getResponseCode(); ++ if (r == 200) { ++ throw new RuntimeException ("wrong response received"); ++ } ++ System.out.println ("OK"); ++ } finally { ++ s.shutdown(); ++ server.stop(2); + } + } + } +diff -r f63ef918ce3a -r 13939cd62507 test/com/sun/net/httpserver/Test12.java +--- openjdk.orig/jdk/test/com/sun/net/httpserver/Test12.java Fri Jul 25 14:46:38 2008 +0400 ++++ openjdk/jdk/test/com/sun/net/httpserver/Test12.java Thu Jul 22 18:22:45 2010 +0200 +@@ -24,17 +24,15 @@ + /** + * @test + * @bug 6270015 ++ * @run main/othervm Test12 + * @summary Light weight HTTP server + */ + + import com.sun.net.httpserver.*; + +-import java.util.*; + import java.util.concurrent.*; + import java.io.*; + import java.net.*; +-import java.security.*; +-import java.security.cert.*; + import javax.net.ssl.*; + + /* basic http/s connectivity test +@@ -85,9 +83,12 @@ + System.out.println ("OK"); + } finally { + delay(); +- s1.stop(2); +- s2.stop(2); +- executor.shutdown (); ++ if (s1 != null) ++ s1.stop(2); ++ if (s2 != null) ++ s2.stop(2); ++ if (executor != null) ++ executor.shutdown (); + } + } + +diff -r f63ef918ce3a -r 13939cd62507 test/com/sun/net/httpserver/Test13.java +--- openjdk.orig/jdk/test/com/sun/net/httpserver/Test13.java Fri Jul 25 14:46:38 2008 +0400 ++++ openjdk/jdk/test/com/sun/net/httpserver/Test13.java Thu Jul 22 18:22:45 2010 +0200 +@@ -24,17 +24,16 @@ + /** + * @test + * @bug 6270015 ++ * @run main/othervm Test13 + * @summary Light weight HTTP server + */ + + import com.sun.net.httpserver.*; + +-import java.util.*; + import java.util.concurrent.*; + import java.io.*; + import java.net.*; +-import java.security.*; +-import java.security.cert.*; ++ + import javax.net.ssl.*; + + /* basic http/s connectivity test +@@ -81,9 +80,12 @@ + System.out.println ("OK"); + } finally { + delay(); +- s1.stop(2); +- s2.stop(2); +- executor.shutdown (); ++ if (s1 != null) ++ s1.stop(2); ++ if (s2 != null) ++ s2.stop(2); ++ if (executor != null) ++ executor.shutdown (); + } + } + +diff -r f63ef918ce3a -r 13939cd62507 test/com/sun/net/httpserver/Test6a.java +--- openjdk.orig/jdk/test/com/sun/net/httpserver/Test6a.java Fri Jul 25 14:46:38 2008 +0400 ++++ openjdk/jdk/test/com/sun/net/httpserver/Test6a.java Thu Jul 22 18:22:45 2010 +0200 +@@ -24,17 +24,15 @@ + /** + * @test + * @bug 6270015 ++ * @run main/othervm Test6a + * @summary Light weight HTTP server + */ + + import com.sun.net.httpserver.*; + +-import java.util.*; + import java.util.concurrent.*; + import java.io.*; + import java.net.*; +-import java.security.*; +-import javax.security.auth.callback.*; + import javax.net.ssl.*; + + /** +diff -r f63ef918ce3a -r 13939cd62507 test/com/sun/net/httpserver/Test7a.java +--- openjdk.orig/jdk/test/com/sun/net/httpserver/Test7a.java Fri Jul 25 14:46:38 2008 +0400 ++++ openjdk/jdk/test/com/sun/net/httpserver/Test7a.java Thu Jul 22 18:22:45 2010 +0200 +@@ -24,18 +24,15 @@ + /** + * @test + * @bug 6270015 ++ * @run main/othervm Test7a + * @summary Light weight HTTP server + */ + + import com.sun.net.httpserver.*; + +-import java.util.*; + import java.util.concurrent.*; +-import java.util.logging.*; + import java.io.*; + import java.net.*; +-import java.security.*; +-import javax.security.auth.callback.*; + import javax.net.ssl.*; + + /** +diff -r f63ef918ce3a -r 13939cd62507 test/com/sun/net/httpserver/Test8a.java +--- openjdk.orig/jdk/test/com/sun/net/httpserver/Test8a.java Fri Jul 25 14:46:38 2008 +0400 ++++ openjdk/jdk/test/com/sun/net/httpserver/Test8a.java Thu Jul 22 18:22:45 2010 +0200 +@@ -24,18 +24,15 @@ + /** + * @test + * @bug 6270015 ++ * @run main/othervm Test8a + * @summary Light weight HTTP server + */ + + import com.sun.net.httpserver.*; + +-import java.util.*; + import java.util.concurrent.*; +-import java.util.logging.*; + import java.io.*; + import java.net.*; +-import java.security.*; +-import javax.security.auth.callback.*; + import javax.net.ssl.*; + + /** +@@ -50,46 +47,50 @@ + //h.setLevel (Level.INFO); + //log.addHandler (h); + //log.setLevel (Level.INFO); +- Handler handler = new Handler(); +- InetSocketAddress addr = new InetSocketAddress (0); +- HttpsServer server = HttpsServer.create (addr, 0); +- HttpContext ctx = server.createContext ("/test", handler); +- ExecutorService executor = Executors.newCachedThreadPool(); +- SSLContext ssl = new SimpleSSLContext(System.getProperty("test.src")).get(); +- server.setHttpsConfigurator(new HttpsConfigurator (ssl)); +- server.setExecutor (executor); +- server.start (); ++ HttpsServer server = null; ++ ExecutorService executor = null; ++ try { ++ Handler handler = new Handler(); ++ InetSocketAddress addr = new InetSocketAddress (0); ++ server = HttpsServer.create (addr, 0); ++ HttpContext ctx = server.createContext ("/test", handler); ++ executor = Executors.newCachedThreadPool(); ++ SSLContext ssl = new SimpleSSLContext(System.getProperty("test.src")).get(); ++ server.setHttpsConfigurator(new HttpsConfigurator (ssl)); ++ server.setExecutor (executor); ++ server.start (); + +- URL url = new URL ("https://localhost:"+server.getAddress().getPort()+"/test/foo.html"); +- System.out.print ("Test8a: " ); +- HttpsURLConnection urlc = (HttpsURLConnection)url.openConnection (); +- urlc.setDoOutput (true); +- urlc.setRequestMethod ("POST"); +- urlc.setHostnameVerifier (new DummyVerifier()); +- urlc.setSSLSocketFactory (ssl.getSocketFactory()); +- OutputStream os = new BufferedOutputStream (urlc.getOutputStream(), 8000); +- for (int i=0; i<SIZE; i++) { +- os.write (i % 250); ++ URL url = new URL ("https://localhost:"+server.getAddress().getPort()+"/test/foo.html"); ++ System.out.print ("Test8a: " ); ++ HttpsURLConnection urlc = (HttpsURLConnection)url.openConnection (); ++ urlc.setDoOutput (true); ++ urlc.setRequestMethod ("POST"); ++ urlc.setHostnameVerifier (new DummyVerifier()); ++ urlc.setSSLSocketFactory (ssl.getSocketFactory()); ++ OutputStream os = new BufferedOutputStream (urlc.getOutputStream(), 8000); ++ for (int i=0; i<SIZE; i++) { ++ os.write (i % 250); ++ } ++ os.close(); ++ int resp = urlc.getResponseCode(); ++ if (resp != 200) { ++ throw new RuntimeException ("test failed response code"); ++ } ++ InputStream is = urlc.getInputStream (); ++ for (int i=0; i<SIZE; i++) { ++ int f = is.read(); ++ if (f != (i % 250)) { ++ System.out.println ("Setting error(" +f +")("+i+")" ); ++ error = true; ++ break; ++ } ++ } ++ is.close(); ++ } finally { ++ delay(); ++ if (server != null) server.stop(2); ++ if (executor != null) executor.shutdown(); + } +- os.close(); +- int resp = urlc.getResponseCode(); +- if (resp != 200) { +- throw new RuntimeException ("test failed response code"); +- } +- InputStream is = urlc.getInputStream (); +- for (int i=0; i<SIZE; i++) { +- int f = is.read(); +- if (f != (i % 250)) { +- System.out.println ("Setting error(" +f +")("+i+")" ); +- error = true; +- break; +- } +- } +- is.close(); +- +- delay(); +- server.stop(2); +- executor.shutdown(); + if (error) { + throw new RuntimeException ("test failed error"); + } +diff -r f63ef918ce3a -r 13939cd62507 test/com/sun/net/httpserver/Test9.java +--- openjdk.orig/jdk/test/com/sun/net/httpserver/Test9.java Fri Jul 25 14:46:38 2008 +0400 ++++ openjdk/jdk/test/com/sun/net/httpserver/Test9.java Thu Jul 22 18:22:45 2010 +0200 +@@ -24,17 +24,15 @@ + /** + * @test + * @bug 6270015 ++ * @run main/othervm Test9 + * @summary Light weight HTTP server + */ + + import com.sun.net.httpserver.*; + +-import java.util.*; + import java.util.concurrent.*; + import java.io.*; + import java.net.*; +-import java.security.*; +-import java.security.cert.*; + import javax.net.ssl.*; + + /* Same as Test1 but requests run in parallel. +@@ -97,9 +95,12 @@ + System.out.println ("OK"); + } finally { + delay(); +- s1.stop(2); +- s2.stop(2); +- executor.shutdown (); ++ if (s1 != null) ++ s1.stop(2); ++ if (s2 != null) ++ s2.stop(2); ++ if (executor != null) ++ executor.shutdown (); + } + } + +diff -r f63ef918ce3a -r 13939cd62507 test/com/sun/net/httpserver/Test9a.java +--- openjdk.orig/jdk/test/com/sun/net/httpserver/Test9a.java Fri Jul 25 14:46:38 2008 +0400 ++++ openjdk/jdk/test/com/sun/net/httpserver/Test9a.java Thu Jul 22 18:22:45 2010 +0200 +@@ -24,17 +24,15 @@ + /** + * @test + * @bug 6270015 ++ * @run main/othervm Test9a + * @summary Light weight HTTP server + */ + + import com.sun.net.httpserver.*; + +-import java.util.*; + import java.util.concurrent.*; + import java.io.*; + import java.net.*; +-import java.security.*; +-import java.security.cert.*; + import javax.net.ssl.*; + + /* Same as Test1 but requests run in parallel. +@@ -92,8 +90,10 @@ + System.out.println ("OK"); + } finally { + delay(); +- server.stop(2); +- executor.shutdown (); ++ if (server != null) ++ server.stop(2); ++ if (executor != null) ++ executor.shutdown(); + } + } + +diff -r f63ef918ce3a -r 13939cd62507 test/com/sun/net/httpserver/bugs/B6361557.java +--- openjdk.orig/jdk/test/com/sun/net/httpserver/bugs/B6361557.java Fri Jul 25 14:46:38 2008 +0400 ++++ openjdk/jdk/test/com/sun/net/httpserver/bugs/B6361557.java Thu Jul 22 18:22:45 2010 +0200 +@@ -35,12 +35,9 @@ + import java.nio.*; + import java.nio.channels.*; + import java.net.*; +-import java.security.*; +-import java.security.cert.*; +-import javax.net.ssl.*; + + /** +- * The test simply opens 10,000 separate connections ++ * The test simply opens 1,000 separate connections + * and invokes one http request on each. The client does + * not close any sockets until after they are closed + * by the server. This verifies the basic ability +@@ -49,6 +46,7 @@ + public class B6361557 { + + public static boolean error = false; ++ static final int NUM = 1000; + + static class Handler implements HttpHandler { + int invocation = 1; +@@ -75,7 +73,6 @@ + server.setExecutor (executor); + server.start (); + +- final int NUM = 10000; + ByteBuffer buf = ByteBuffer.allocate (4096); + InetSocketAddress destaddr = new InetSocketAddress ( + "127.0.0.1", server.getAddress().getPort() +diff -r f63ef918ce3a -r 13939cd62507 test/com/sun/net/httpserver/bugs/B6373555.java +--- openjdk.orig/jdk/test/com/sun/net/httpserver/bugs/B6373555.java Fri Jul 25 14:46:38 2008 +0400 ++++ openjdk/jdk/test/com/sun/net/httpserver/bugs/B6373555.java Thu Jul 22 18:22:45 2010 +0200 +@@ -46,7 +46,7 @@ + private static Object lock; + static HttpServer httpServer; + static ExecutorService pool, execs; +- static int NUM = 4000; ++ static int NUM = 1000; + + public static void main(String[] args) throws Exception { + try { +@@ -125,7 +125,7 @@ + } + } + catch(Exception e) { +- //e.printStackTrace(); ++ e.printStackTrace(); + System.out.print ("."); + error = true; + }