You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by gs...@apache.org on 2007/08/02 22:42:30 UTC
svn commit: r562249 - in /harmony/enhanced/drlvm/trunk/vm/tests/smoke:
exception/ shutdown/ thread/
Author: gshimansky
Date: Thu Aug 2 13:42:28 2007
New Revision: 562249
URL: http://svn.apache.org/viewvc?view=rev&rev=562249
Log:
Setting svn:eol-style native to the tests
Modified:
harmony/enhanced/drlvm/trunk/vm/tests/smoke/exception/ExceptionStackTest.java (props changed)
harmony/enhanced/drlvm/trunk/vm/tests/smoke/shutdown/TestFatalError.java (props changed)
harmony/enhanced/drlvm/trunk/vm/tests/smoke/shutdown/TestInterrupt.java (props changed)
harmony/enhanced/drlvm/trunk/vm/tests/smoke/shutdown/TestLock.java (props changed)
harmony/enhanced/drlvm/trunk/vm/tests/smoke/thread/InterruptWait.java (contents, props changed)
harmony/enhanced/drlvm/trunk/vm/tests/smoke/thread/ManyThreadsTest.java (props changed)
harmony/enhanced/drlvm/trunk/vm/tests/smoke/thread/SmallStackThreadTest.java (contents, props changed)
harmony/enhanced/drlvm/trunk/vm/tests/smoke/thread/ThreadOOM.java (props changed)
Propchange: harmony/enhanced/drlvm/trunk/vm/tests/smoke/exception/ExceptionStackTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: harmony/enhanced/drlvm/trunk/vm/tests/smoke/shutdown/TestFatalError.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: harmony/enhanced/drlvm/trunk/vm/tests/smoke/shutdown/TestInterrupt.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: harmony/enhanced/drlvm/trunk/vm/tests/smoke/shutdown/TestLock.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: harmony/enhanced/drlvm/trunk/vm/tests/smoke/thread/InterruptWait.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/tests/smoke/thread/InterruptWait.java?view=diff&rev=562249&r1=562248&r2=562249
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/tests/smoke/thread/InterruptWait.java (original)
+++ harmony/enhanced/drlvm/trunk/vm/tests/smoke/thread/InterruptWait.java Thu Aug 2 13:42:28 2007
@@ -1,87 +1,87 @@
-package thread;
-
-public class InterruptWait {
- static boolean success = true;
-
- public static void main(String[] args) {
- final Lock lock = new Lock();
- final Thread[] pool = new Thread[10];
-
- for (int i = 0; i < pool.length; i++) {
- pool[i] = new Thread() {
- public void run() {
- lock.lock();
- try {
- Thread.sleep(100);
- } catch (InterruptedException e) {
- System.out.println(this.toString() + " interrupted while working!");
- success = false;
- }
- lock.unlock();
- }
- };
- }
- for (int i = 0; i < pool.length; i++) {
- pool[i].start();
- }
- for (int i = 0; i < pool.length; i++) {
- try {
- pool[i].join();
- } catch (InterruptedException e) {
- System.out.println(pool[i].toString() + " interrupted while joining!");
- success = false;
- }
- }
- System.out.println(success ? "PASS" : "FAIL");
- }
-
- static class Lock {
- final java.util.List<Thread> waitQueue = new java.util.LinkedList<Thread>();
- Thread owner;
-
- public void lock() {
- final Thread currentThread = Thread.currentThread();
-
- synchronized (this) {
- if (owner == currentThread) {
- return;
- }
- if (owner == null) {
- owner = currentThread;
- return;
- }
- waitQueue.add(currentThread);
-
- try {
- wait();
- } catch (InterruptedException e) {
- // Expected, ignore.
- // System.out.println(Thread.currentThread().toString() + " interrupted while waiting!");
- }
- }
- }
-
- public void unlock() {
- synchronized (this) {
- if (owner == null) {
- System.out.println("ERROR at " + Thread.currentThread() + ": Can\'t unlock not locked resource");
- success = false;
- }
- if (owner != Thread.currentThread()) {
- System.out.println("ERROR at " + Thread.currentThread() + ": Not owner can\'t unlock resource");
- success = false;
- }
- while (!waitQueue.isEmpty()) {
- final Thread nextThread = waitQueue.remove(0);
-
- if (!nextThread.isInterrupted()) {
- owner = nextThread;
- nextThread.interrupt();
- return;
- }
- }
- owner = null;
- }
- }
- }
-}
+package thread;
+
+public class InterruptWait {
+ static boolean success = true;
+
+ public static void main(String[] args) {
+ final Lock lock = new Lock();
+ final Thread[] pool = new Thread[10];
+
+ for (int i = 0; i < pool.length; i++) {
+ pool[i] = new Thread() {
+ public void run() {
+ lock.lock();
+ try {
+ Thread.sleep(100);
+ } catch (InterruptedException e) {
+ System.out.println(this.toString() + " interrupted while working!");
+ success = false;
+ }
+ lock.unlock();
+ }
+ };
+ }
+ for (int i = 0; i < pool.length; i++) {
+ pool[i].start();
+ }
+ for (int i = 0; i < pool.length; i++) {
+ try {
+ pool[i].join();
+ } catch (InterruptedException e) {
+ System.out.println(pool[i].toString() + " interrupted while joining!");
+ success = false;
+ }
+ }
+ System.out.println(success ? "PASS" : "FAIL");
+ }
+
+ static class Lock {
+ final java.util.List<Thread> waitQueue = new java.util.LinkedList<Thread>();
+ Thread owner;
+
+ public void lock() {
+ final Thread currentThread = Thread.currentThread();
+
+ synchronized (this) {
+ if (owner == currentThread) {
+ return;
+ }
+ if (owner == null) {
+ owner = currentThread;
+ return;
+ }
+ waitQueue.add(currentThread);
+
+ try {
+ wait();
+ } catch (InterruptedException e) {
+ // Expected, ignore.
+ // System.out.println(Thread.currentThread().toString() + " interrupted while waiting!");
+ }
+ }
+ }
+
+ public void unlock() {
+ synchronized (this) {
+ if (owner == null) {
+ System.out.println("ERROR at " + Thread.currentThread() + ": Can\'t unlock not locked resource");
+ success = false;
+ }
+ if (owner != Thread.currentThread()) {
+ System.out.println("ERROR at " + Thread.currentThread() + ": Not owner can\'t unlock resource");
+ success = false;
+ }
+ while (!waitQueue.isEmpty()) {
+ final Thread nextThread = waitQueue.remove(0);
+
+ if (!nextThread.isInterrupted()) {
+ owner = nextThread;
+ nextThread.interrupt();
+ return;
+ }
+ }
+ owner = null;
+ }
+ }
+ }
+}
Propchange: harmony/enhanced/drlvm/trunk/vm/tests/smoke/thread/InterruptWait.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: harmony/enhanced/drlvm/trunk/vm/tests/smoke/thread/InterruptWait.java
('svn:executable' removed)
Propchange: harmony/enhanced/drlvm/trunk/vm/tests/smoke/thread/ManyThreadsTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: harmony/enhanced/drlvm/trunk/vm/tests/smoke/thread/SmallStackThreadTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/tests/smoke/thread/SmallStackThreadTest.java?view=diff&rev=562249&r1=562248&r2=562249
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/tests/smoke/thread/SmallStackThreadTest.java (original)
+++ harmony/enhanced/drlvm/trunk/vm/tests/smoke/thread/SmallStackThreadTest.java Thu Aug 2 13:42:28 2007
@@ -13,76 +13,76 @@
* 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 thread;
-
-public class SmallStackThreadTest implements Runnable
-{
- private static final int MAX_THREADS = 4 * 1024;
- private static final int STACK_SIZE = 256 * 1024;
-
- private static int started = 0;
- private static int finished = 0;
- private static Object awake = new Object();
+ */
+
+package thread;
+
+public class SmallStackThreadTest implements Runnable
+{
+ private static final int MAX_THREADS = 4 * 1024;
+ private static final int STACK_SIZE = 256 * 1024;
+
+ private static int started = 0;
+ private static int finished = 0;
+ private static Object awake = new Object();
private static boolean awaked = false;
-
- public static void main(String [] args) {
- Thread[] threads = new Thread[MAX_THREADS];
- for (int i = 0; i < MAX_THREADS; i++) {
- threads[i] = new Thread( null,
- new SmallStackThreadTest(),
- "Test Thread " + i,
- STACK_SIZE);
- threads[i].start();
-
- if ((i%100) == 0) {
- System.out.println("Start Thread " + i);
- }
- }
-
- synchronized(awake){
- awaked = true;
- awake.notifyAll();
- }
-
- for (int i = 0; i < MAX_THREADS; i++) {
- try {
- threads[i].join();
- } catch (Throwable th) {
- System.out.println("Was caught " + th);
- }
- }
-
- synchronized(SmallStackThreadTest.class) {
- if (started != MAX_THREADS) {
- System.out.println("FAILED");
- } else if (finished != MAX_THREADS) {
- System.out.println("FAILED");
- } else {
- System.out.println("PASSED");
- }
- }
- }
-
- public void run() {
- synchronized(SmallStackThreadTest.class) {
+
+ public static void main(String [] args) {
+ Thread[] threads = new Thread[MAX_THREADS];
+ for (int i = 0; i < MAX_THREADS; i++) {
+ threads[i] = new Thread( null,
+ new SmallStackThreadTest(),
+ "Test Thread " + i,
+ STACK_SIZE);
+ threads[i].start();
+
+ if ((i%100) == 0) {
+ System.out.println("Start Thread " + i);
+ }
+ }
+
+ synchronized(awake){
+ awaked = true;
+ awake.notifyAll();
+ }
+
+ for (int i = 0; i < MAX_THREADS; i++) {
+ try {
+ threads[i].join();
+ } catch (Throwable th) {
+ System.out.println("Was caught " + th);
+ }
+ }
+
+ synchronized(SmallStackThreadTest.class) {
+ if (started != MAX_THREADS) {
+ System.out.println("FAILED");
+ } else if (finished != MAX_THREADS) {
+ System.out.println("FAILED");
+ } else {
+ System.out.println("PASSED");
+ }
+ }
+ }
+
+ public void run() {
+ synchronized(SmallStackThreadTest.class) {
SmallStackThreadTest.started++;
}
- try {
- synchronized(awake){
- if (!awaked) {
- awake.wait();
- }
- }
- } catch (Throwable th) {
- System.out.println("Was caught " + th);
- }
-
- synchronized(SmallStackThreadTest.class) {
+ try {
+ synchronized(awake){
+ if (!awaked) {
+ awake.wait();
+ }
+ }
+ } catch (Throwable th) {
+ System.out.println("Was caught " + th);
+ }
+
+ synchronized(SmallStackThreadTest.class) {
SmallStackThreadTest.finished++;
}
- }
-}
-
+ }
+}
+
Propchange: harmony/enhanced/drlvm/trunk/vm/tests/smoke/thread/SmallStackThreadTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: harmony/enhanced/drlvm/trunk/vm/tests/smoke/thread/ThreadOOM.java
------------------------------------------------------------------------------
svn:eol-style = native