diff --git a/test/java/text/Bidi/Bug6665028.java b/test/java/text/Bidi/Bug6665028.java index 3089337036bb165f307c833cc473a39e7aa6dae7..ffd1044ee18eb2f6e1b51a861bc2f6ae03253c9f 100644 --- a/test/java/text/Bidi/Bug6665028.java +++ b/test/java/text/Bidi/Bug6665028.java @@ -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.AttributedString; 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 class Bug6665028 { } 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 @@ public class Bug6665028 { } try { - Thread.sleep(45000); + Thread.sleep(duration * 1000); } catch (InterruptedException e) { } diff --git a/test/java/util/Locale/Bug4518797.java b/test/java/util/Locale/Bug4518797.java index fbbb2f5bf00531213218cd3930900d1fd8f25241..f25b64fbedb87657316dca9c3fdcb3b3aa5cb7ad 100644 --- a/test/java/util/Locale/Bug4518797.java +++ b/test/java/util/Locale/Bug4518797.java @@ -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 @@ public class Bug4518797 { 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; diff --git a/test/java/util/ResourceBundle/Control/StressTest.java b/test/java/util/ResourceBundle/Control/StressTest.java index d37c60a62ecb177df7aa055bca24d5dde479977d..401f6b43091ec91b73ef1986eea77d2fabfcdbf3 100644 --- a/test/java/util/ResourceBundle/Control/StressTest.java +++ b/test/java/util/ResourceBundle/Control/StressTest.java @@ -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 @@ public class StressTest { 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 @@ public class StressTest { 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(); }