[vmkit-commits] [vmkit] r145798 - in /vmkit/trunk/tests: LockThread.java ThreadTest.java

Will Dietz wdietz2 at illinois.edu
Sun Dec 4 21:10:45 PST 2011


Author: wdietz2
Date: Sun Dec  4 23:10:45 2011
New Revision: 145798

URL: http://llvm.org/viewvc/llvm-project?rev=145798&view=rev
Log:
Drop weak LockThread test, add Thread spawning stress test to replace.

LockThread's primary issue was fixed in r145796, and remaining issue only
occurred occasionally.  ThreadTest exercises this more directly.

Added:
    vmkit/trunk/tests/ThreadTest.java
Removed:
    vmkit/trunk/tests/LockThread.java

Removed: vmkit/trunk/tests/LockThread.java
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/tests/LockThread.java?rev=145797&view=auto
==============================================================================
--- vmkit/trunk/tests/LockThread.java (original)
+++ vmkit/trunk/tests/LockThread.java (removed)
@@ -1,26 +0,0 @@
-// Allocate too many fat locks, crash VM
-public class LockThread extends Thread {
-  static Object Lock;
-  static long x = 0;
-  static final long max = 1000;
-  public void run() {
-    while(x < max)
-      synchronized(Lock) {
-        ++x;
-      }
-  }
-
-  public static void main(String[] args) {
-    for(int i = 0; i < 2048; ++i) {
-      Lock = new Object();
-
-      Thread t1 = new LockThread();
-      Thread t2 = new LockThread();
-      t1.start();
-      t2.start();
-
-      try { t1.join(); } catch (InterruptedException ignore){}
-      try { t2.join(); } catch (InterruptedException ignore){}
-    }
-  }
-}

Added: vmkit/trunk/tests/ThreadTest.java
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/tests/ThreadTest.java?rev=145798&view=auto
==============================================================================
--- vmkit/trunk/tests/ThreadTest.java (added)
+++ vmkit/trunk/tests/ThreadTest.java Sun Dec  4 23:10:45 2011
@@ -0,0 +1,17 @@
+public class ThreadTest extends Thread {
+  public void run() {
+    // Nothing
+  }
+
+  public static void main(String[] args) throws InterruptedException {
+    for(int i = 0; i < 10000; ++i) {
+      Thread t1 = new ThreadTest();
+      Thread t2 = new ThreadTest();
+      t1.start();
+      t2.start();
+
+      t1.join();
+      t2.join();
+    }
+  }
+}





More information about the vmkit-commits mailing list