changeset 3969:adfdbb41cdf2

7035446: some regression tests take too long Reviewed-by: peytoia
author okutsu
date Fri, 15 Apr 2011 22:57:15 +0900
parents d42338742583
children 1e2366f02b50
files test/java/text/Bidi/Bug6665028.java test/java/util/Locale/Bug4518797.java test/java/util/ResourceBundle/Control/StressTest.java
diffstat 3 files changed, 27 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/test/java/text/Bidi/Bug6665028.java	Fri Apr 15 12:08:07 2011 +0900
+++ b/test/java/text/Bidi/Bug6665028.java	Fri Apr 15 22:57:15 2011 +0900
@@ -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/test/java/util/Locale/Bug4518797.java	Fri Apr 15 12:08:07 2011 +0900
+++ b/test/java/util/Locale/Bug4518797.java	Fri Apr 15 22:57:15 2011 +0900
@@ -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/test/java/util/ResourceBundle/Control/StressTest.java	Fri Apr 15 12:08:07 2011 +0900
+++ b/test/java/util/ResourceBundle/Control/StressTest.java	Fri Apr 15 22:57:15 2011 +0900
@@ -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();
                 }