Merge
authoralexp
Fri, 15 Apr 2011 20:54:13 +0400
changeset 9229 65eacdfa3a35
parent 9228 6d4f3b084c97 (current diff)
parent 9227 0317eefd7154 (diff)
child 9230 c5674561cb9e
Merge
--- a/jdk/test/java/text/Bidi/Bug6665028.java	Fri Apr 15 20:50:06 2011 +0400
+++ b/jdk/test/java/text/Bidi/Bug6665028.java	Fri Apr 15 20:54:13 2011 +0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,7 +28,7 @@
  * that this test case fails without the fix in some different ways,
  * including timeout, due to the memory corruption.
  * @build Bug6665028
- * @run main/othervm/timeout=60 -Xmx16m Bug6665028
+ * @run main/othervm -Xmx16m Bug6665028 10
  */
 
 import java.awt.font.TextAttribute;
@@ -36,6 +36,7 @@
 import java.text.Bidi;
 
 // test1() and test2() were derived from BidiEmbeddingTest.
+// Usage: java Bug6665028 [duration]
 public class Bug6665028 {
 
     private static boolean runrun = true;
@@ -50,6 +51,11 @@
     }
 
     public static void main(String[] args) {
+        int duration = 45;
+        if (args.length == 1) {
+            duration = Math.max(1, Math.min(Integer.parseInt(args[0]), 45));
+        }
+
         Test[] tests = new Test[4];
         for (int i = 0; i < tests.length; i++) {
             Test t = new Test();
@@ -58,7 +64,7 @@
         }
 
         try {
-            Thread.sleep(45000);
+            Thread.sleep(duration * 1000);
         } catch (InterruptedException e) {
         }
 
--- a/jdk/test/java/util/Locale/Bug4518797.java	Fri Apr 15 20:50:06 2011 +0400
+++ b/jdk/test/java/util/Locale/Bug4518797.java	Fri Apr 15 20:54:13 2011 +0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -24,17 +24,22 @@
  * @test
  * @bug 4518797
  * @summary Make sure that hashCode() and read/writeObject() are thread-safe.
- * @run main/timeout=200 Bug4518797
+ * @run main Bug4518797 10
  */
 
 import java.util.*;
 import java.io.*;
 
+// Usage: java Bug4518797 [duration]
 public class Bug4518797 {
     static volatile boolean runrun = true;
     static volatile String message = null;
 
     public static void main(String[] args) {
+        int duration = 180;
+        if (args.length == 1) {
+            duration = Math.max(5, Integer.parseInt(args[0]));
+        }
         final Locale loc = new Locale("ja", "US");
         final int hashcode = loc.hashCode();
 
@@ -84,7 +89,7 @@
         t1.start();
         t2.start();
         try {
-            for (int i = 0; runrun && i < 180; i++) {
+            for (int i = 0; runrun && i < duration; i++) {
                 Thread.sleep(1000);
             }
             runrun = false;
--- a/jdk/test/java/util/ResourceBundle/Control/StressTest.java	Fri Apr 15 20:50:06 2011 +0400
+++ b/jdk/test/java/util/ResourceBundle/Control/StressTest.java	Fri Apr 15 20:54:13 2011 +0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -24,12 +24,13 @@
  * @test
  * @bug 5102289
  * @summary Stress test for ResourceBundle.getBundle with ResourceBundle.Control.
- * @run main/timeout=300/othervm -esa StressTest
+ * @run main/othervm -esa StressTest 2 15
  */
 
 import java.util.*;
 import java.util.concurrent.atomic.*;
 
+// Usage: java StressTest [threadsFactor [duration]]
 public class StressTest {
     static final Locale ROOT_LOCALE = new Locale("");
     static final Random rand = new Random();
@@ -60,16 +61,16 @@
     static volatile boolean runrun = true;
 
     public static void main(String[] args) {
-        int nThreads = 2;
+        int threadsFactor = 2;
         if (args.length > 0) {
-            nThreads = Math.max(Integer.parseInt(args[0]), 2);
+            threadsFactor = Math.max(2, Integer.parseInt(args[0]));
         }
-        int nSeconds = 180;
+        int duration = 180;
         if (args.length > 1) {
-            nSeconds = Integer.parseInt(args[1]);
+            duration = Math.max(5, Integer.parseInt(args[1]));
         }
         Locale.setDefault(Locale.US);
-        Thread[] tasks = new Thread[locales.length * nThreads];
+        Thread[] tasks = new Thread[locales.length * threadsFactor];
         counters = new AtomicIntegerArray(tasks.length);
 
         for (int i = 0; i < tasks.length; i++) {
@@ -84,8 +85,8 @@
         System.out.printf("%d processors, intervalForCounterCheck = %d [sec]%n",
                           nProcessors, intervalForCounterCheck);
         try {
-            for (int i = 0; runrun && i < nSeconds; i++) {
-                Thread.sleep(1000); // 1 seconds
+            for (int i = 0; runrun && i < duration; i++) {
+                Thread.sleep(1000); // 1 second
                 if ((i % intervalForCounterCheck) == 0) {
                     checkCounters();
                 }