You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by wj...@apache.org on 2007/10/26 15:59:43 UTC

svn commit: r588649 - in /harmony/enhanced/drlvm/trunk/src/test/regression/H3822: ./ Test.java

Author: wjwashburn
Date: Fri Oct 26 06:59:42 2007
New Revision: 588649

URL: http://svn.apache.org/viewvc?rev=588649&view=rev
Log:
H3822 -- a regression test that test > 338 threads can be created on Linux.

Added:
    harmony/enhanced/drlvm/trunk/src/test/regression/H3822/
    harmony/enhanced/drlvm/trunk/src/test/regression/H3822/Test.java   (with props)

Added: harmony/enhanced/drlvm/trunk/src/test/regression/H3822/Test.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/src/test/regression/H3822/Test.java?rev=588649&view=auto
==============================================================================
--- harmony/enhanced/drlvm/trunk/src/test/regression/H3822/Test.java (added)
+++ harmony/enhanced/drlvm/trunk/src/test/regression/H3822/Test.java Fri Oct 26 06:59:42 2007
@@ -0,0 +1,62 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.apache.harmony.drlvm.tests.regression.h3822;
+import junit.framework.*;
+
+public class Test extends TestCase {
+    public static void main(String[] args) {
+        (new Test()).test();
+    }
+
+    public void test() {
+        try {
+            if (!(new ThreadTest()).test()) {
+                fail();
+            }
+        } catch (Throwable e) {
+            e.printStackTrace();
+            fail();
+        }
+    }
+}
+
+class ThreadTest extends Thread {
+    public boolean test() {
+        final int MAX_THREADS = 10000;
+        int i = 0;
+        try {
+            for (i = 0; i < MAX_THREADS; i++) {
+                ThreadTest t = new ThreadTest();
+                t.start();
+                try {
+                    t.join();
+                } catch (InterruptedException e) {
+                    e.printStackTrace();
+                    break;
+                }
+            }
+        } finally {
+            System.out.println("Created threads: " + i);
+        }
+        return (i == MAX_THREADS);
+    }
+    
+    public void run() {
+        System.out.print("*");
+    }
+}

Propchange: harmony/enhanced/drlvm/trunk/src/test/regression/H3822/Test.java
------------------------------------------------------------------------------
    svn:eol-style = native