Mercurial > hg > truffle
comparison test/compiler/6863420/Test.java @ 9079:f67065f02409
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>
author | bharadwaj |
---|---|
date | Mon, 08 Apr 2013 07:40:08 -0700 |
parents | c18cbe5936b8 |
children |
comparison
equal
deleted
inserted
replaced
9078:705ef39fcaa9 | 9079:f67065f02409 |
---|---|
25 /** | 25 /** |
26 * @test | 26 * @test |
27 * @bug 6863420 | 27 * @bug 6863420 |
28 * @summary os::javaTimeNanos() go backward on Solaris x86 | 28 * @summary os::javaTimeNanos() go backward on Solaris x86 |
29 * | 29 * |
30 * @run main/othervm Test | 30 * Notice the internal timeout in timeout thread Test.TOT. |
31 * @run main/othervm/timeout=300 Test | |
31 */ | 32 */ |
32 | 33 |
33 public class Test { | 34 public class Test { |
35 | |
36 static final int INTERNAL_TIMEOUT=240; | |
37 static class TOT extends Thread { | |
38 public void run() { | |
39 try { | |
40 Thread.sleep(INTERNAL_TIMEOUT*1000); | |
41 } catch (InterruptedException ex) { | |
42 } | |
43 done = true; | |
44 } | |
45 } | |
46 | |
34 static long value = 0; | 47 static long value = 0; |
35 static boolean got_backward_time = false; | 48 static boolean got_backward_time = false; |
49 static volatile boolean done = false; | |
36 | 50 |
37 public static void main(String args[]) { | 51 public static void main(String args[]) { |
38 final int count = 100000; | 52 final int count = 100000; |
39 | 53 |
40 for (int numThreads = 1; numThreads <= 32; numThreads++) { | 54 TOT tot = new TOT(); |
55 tot.setDaemon(true); | |
56 tot.start(); | |
57 | |
58 for (int numThreads = 1; !done && numThreads <= 32; numThreads++) { | |
41 final int numRuns = 1; | 59 final int numRuns = 1; |
42 for (int t=1; t <= numRuns; t++) { | 60 for (int t=1; t <= numRuns; t++) { |
43 final int curRun = t; | 61 final int curRun = t; |
44 | 62 |
45 System.out.println("Spawning " + numThreads + " threads"); | 63 System.out.println("Spawning " + numThreads + " threads"); |
46 final Thread threads[] = new Thread[numThreads]; | 64 final Thread threads[] = new Thread[numThreads]; |
47 for (int i = 0; i < threads.length; i++) { | 65 for (int i = 0; i < threads.length; i++) { |
48 Runnable thread = | 66 Runnable thread = |
49 new Runnable() { | 67 new Runnable() { |
50 public void run() { | 68 public void run() { |
51 for (long l = 0; l < 100000; l++) { | 69 for (long l = 0; !done && l < 100000; l++) { |
52 final long start = System.nanoTime(); | 70 final long start = System.nanoTime(); |
53 if (value == 12345678) { | 71 if (value == 12345678) { |
54 System.out.println("Wow!"); | 72 System.out.println("Wow!"); |
55 } | 73 } |
56 final long end = System.nanoTime(); | 74 final long end = System.nanoTime(); |