Mon, 08 Apr 2013 07:40:08 -0700
8010913: compiler/6863420 often exceeds timeout
Summary: add longer timeout for jtreg, add internal timeout thread to prevent spurious timeouts
Reviewed-by: twisti, kvn
Contributed-by: drchase <david.r.chase@oracle.com>
test/compiler/6863420/Test.java | file | annotate | diff | comparison | revisions |
1.1 --- a/test/compiler/6863420/Test.java Fri Apr 05 11:09:43 2013 +0200 1.2 +++ b/test/compiler/6863420/Test.java Mon Apr 08 07:40:08 2013 -0700 1.3 @@ -27,17 +27,35 @@ 1.4 * @bug 6863420 1.5 * @summary os::javaTimeNanos() go backward on Solaris x86 1.6 * 1.7 - * @run main/othervm Test 1.8 + * Notice the internal timeout in timeout thread Test.TOT. 1.9 + * @run main/othervm/timeout=300 Test 1.10 */ 1.11 1.12 public class Test { 1.13 + 1.14 + static final int INTERNAL_TIMEOUT=240; 1.15 + static class TOT extends Thread { 1.16 + public void run() { 1.17 + try { 1.18 + Thread.sleep(INTERNAL_TIMEOUT*1000); 1.19 + } catch (InterruptedException ex) { 1.20 + } 1.21 + done = true; 1.22 + } 1.23 + } 1.24 + 1.25 static long value = 0; 1.26 static boolean got_backward_time = false; 1.27 + static volatile boolean done = false; 1.28 1.29 public static void main(String args[]) { 1.30 final int count = 100000; 1.31 1.32 - for (int numThreads = 1; numThreads <= 32; numThreads++) { 1.33 + TOT tot = new TOT(); 1.34 + tot.setDaemon(true); 1.35 + tot.start(); 1.36 + 1.37 + for (int numThreads = 1; !done && numThreads <= 32; numThreads++) { 1.38 final int numRuns = 1; 1.39 for (int t=1; t <= numRuns; t++) { 1.40 final int curRun = t; 1.41 @@ -48,7 +66,7 @@ 1.42 Runnable thread = 1.43 new Runnable() { 1.44 public void run() { 1.45 - for (long l = 0; l < 100000; l++) { 1.46 + for (long l = 0; !done && l < 100000; l++) { 1.47 final long start = System.nanoTime(); 1.48 if (value == 12345678) { 1.49 System.out.println("Wow!");