harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wjwashb...@apache.org
Subject svn commit: r588645 - in /harmony/enhanced/drlvm/trunk/src/test/regression/H3582: ./ Test.java
Date Fri, 26 Oct 2007 13:53:08 GMT
Author: wjwashburn
Date: Fri Oct 26 06:53:07 2007
New Revision: 588645

URL: http://svn.apache.org/viewvc?rev=588645&view=rev
Log:
H3582 -- added a regression test for a shutdown bug that was fixed a while ago


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

Added: harmony/enhanced/drlvm/trunk/src/test/regression/H3582/Test.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/src/test/regression/H3582/Test.java?rev=588645&view=auto
==============================================================================
--- harmony/enhanced/drlvm/trunk/src/test/regression/H3582/Test.java (added)
+++ harmony/enhanced/drlvm/trunk/src/test/regression/H3582/Test.java Fri Oct 26 06:53:07 2007
@@ -0,0 +1,88 @@
+/*
+ *  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.h3582;
+import junit.framework.*;
+
+public class Test extends TestCase {
+    public static void main(String[] args) {
+        (new Test()).test();
+    }
+
+    public void test() {
+        try {
+            (new MegaJoin()).test();
+        } catch (Throwable e) {
+            e.printStackTrace();
+            fail();
+        }
+    }
+}
+
+class MegaJoin implements Runnable {
+    static int number_of_bosses = 10;
+    static int worker_threads_per_boss = 1000;
+    static int number_of_workers_created = 0;
+
+    public static void main(String[] args) {
+        (new Test()).test();
+    }
+
+    public void test() throws InterruptedException {
+        Thread[] boss_threads = new Thread[number_of_bosses];
+        int ii = 0;
+        for (ii = 0; ii < boss_threads.length; ii++) {
+            boss_threads[ii] = new Thread(new MegaJoin());
+            System.out.println("H3582: " +  boss_threads[ii]);
+            boss_threads[ii].start();
+        }
+
+        for (ii = 0; ii < boss_threads.length; ii++) {
+            try {
+                boss_threads[ii].join();
+                System.out.println("H3582: " +  boss_threads[ii]
+                        + " - finished!");
+            } catch (InterruptedException e) {
+                throw e;
+            }
+        }
+        System.out.println("H3582: PASSED!");
+    }
+
+    public void run() {
+        Thread [] wta = new Thread[worker_threads_per_boss];
+        for (int ii = 0; ii < wta.length; ii++) {
+            wta[ii] = new Thread() {
+                public void run () {
+                    //intentionally empty, only testing thread join
+                }
+            };
+            wta[ii].start();
+        }
+
+        for (int ii = 0; ii < wta.length; ii++) {
+            try {
+                wta[ii].join();
+            }
+            catch (InterruptedException e) {
+                System.out.println("Working thread exeption:");
+                e.printStackTrace();
+            }
+        }
+    }
+}

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



Mime
View raw message