author | miauno |
Fri, 30 Jan 2015 20:00:57 +0100 | |
changeset 28821 | f7820f311663 |
child 29678 | dd2f3932c21e |
permissions | -rw-r--r-- |
28821
f7820f311663
8071908: Port internal Diagnostic Command tests and test framework to jtreg
miauno
parents:
diff
changeset
|
1 |
/* |
f7820f311663
8071908: Port internal Diagnostic Command tests and test framework to jtreg
miauno
parents:
diff
changeset
|
2 |
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. |
f7820f311663
8071908: Port internal Diagnostic Command tests and test framework to jtreg
miauno
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
f7820f311663
8071908: Port internal Diagnostic Command tests and test framework to jtreg
miauno
parents:
diff
changeset
|
4 |
* |
f7820f311663
8071908: Port internal Diagnostic Command tests and test framework to jtreg
miauno
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
f7820f311663
8071908: Port internal Diagnostic Command tests and test framework to jtreg
miauno
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
f7820f311663
8071908: Port internal Diagnostic Command tests and test framework to jtreg
miauno
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
f7820f311663
8071908: Port internal Diagnostic Command tests and test framework to jtreg
miauno
parents:
diff
changeset
|
8 |
* |
f7820f311663
8071908: Port internal Diagnostic Command tests and test framework to jtreg
miauno
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
f7820f311663
8071908: Port internal Diagnostic Command tests and test framework to jtreg
miauno
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
f7820f311663
8071908: Port internal Diagnostic Command tests and test framework to jtreg
miauno
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
f7820f311663
8071908: Port internal Diagnostic Command tests and test framework to jtreg
miauno
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
f7820f311663
8071908: Port internal Diagnostic Command tests and test framework to jtreg
miauno
parents:
diff
changeset
|
13 |
* accompanied this code). |
f7820f311663
8071908: Port internal Diagnostic Command tests and test framework to jtreg
miauno
parents:
diff
changeset
|
14 |
* |
f7820f311663
8071908: Port internal Diagnostic Command tests and test framework to jtreg
miauno
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
f7820f311663
8071908: Port internal Diagnostic Command tests and test framework to jtreg
miauno
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
f7820f311663
8071908: Port internal Diagnostic Command tests and test framework to jtreg
miauno
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
f7820f311663
8071908: Port internal Diagnostic Command tests and test framework to jtreg
miauno
parents:
diff
changeset
|
18 |
* |
f7820f311663
8071908: Port internal Diagnostic Command tests and test framework to jtreg
miauno
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
f7820f311663
8071908: Port internal Diagnostic Command tests and test framework to jtreg
miauno
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
f7820f311663
8071908: Port internal Diagnostic Command tests and test framework to jtreg
miauno
parents:
diff
changeset
|
21 |
* questions. |
f7820f311663
8071908: Port internal Diagnostic Command tests and test framework to jtreg
miauno
parents:
diff
changeset
|
22 |
*/ |
f7820f311663
8071908: Port internal Diagnostic Command tests and test framework to jtreg
miauno
parents:
diff
changeset
|
23 |
|
f7820f311663
8071908: Port internal Diagnostic Command tests and test framework to jtreg
miauno
parents:
diff
changeset
|
24 |
import org.testng.annotations.Test; |
f7820f311663
8071908: Port internal Diagnostic Command tests and test framework to jtreg
miauno
parents:
diff
changeset
|
25 |
import org.testng.Assert; |
f7820f311663
8071908: Port internal Diagnostic Command tests and test framework to jtreg
miauno
parents:
diff
changeset
|
26 |
|
f7820f311663
8071908: Port internal Diagnostic Command tests and test framework to jtreg
miauno
parents:
diff
changeset
|
27 |
import com.oracle.java.testlibrary.OutputAnalyzer; |
f7820f311663
8071908: Port internal Diagnostic Command tests and test framework to jtreg
miauno
parents:
diff
changeset
|
28 |
|
f7820f311663
8071908: Port internal Diagnostic Command tests and test framework to jtreg
miauno
parents:
diff
changeset
|
29 |
import com.oracle.java.testlibrary.dcmd.CommandExecutor; |
f7820f311663
8071908: Port internal Diagnostic Command tests and test framework to jtreg
miauno
parents:
diff
changeset
|
30 |
import com.oracle.java.testlibrary.dcmd.JMXExecutor; |
f7820f311663
8071908: Port internal Diagnostic Command tests and test framework to jtreg
miauno
parents:
diff
changeset
|
31 |
|
f7820f311663
8071908: Port internal Diagnostic Command tests and test framework to jtreg
miauno
parents:
diff
changeset
|
32 |
import java.util.concurrent.BrokenBarrierException; |
f7820f311663
8071908: Port internal Diagnostic Command tests and test framework to jtreg
miauno
parents:
diff
changeset
|
33 |
import java.util.concurrent.CyclicBarrier; |
f7820f311663
8071908: Port internal Diagnostic Command tests and test framework to jtreg
miauno
parents:
diff
changeset
|
34 |
import java.util.concurrent.locks.ReentrantLock; |
f7820f311663
8071908: Port internal Diagnostic Command tests and test framework to jtreg
miauno
parents:
diff
changeset
|
35 |
import java.util.regex.Pattern; |
f7820f311663
8071908: Port internal Diagnostic Command tests and test framework to jtreg
miauno
parents:
diff
changeset
|
36 |
|
f7820f311663
8071908: Port internal Diagnostic Command tests and test framework to jtreg
miauno
parents:
diff
changeset
|
37 |
/* |
f7820f311663
8071908: Port internal Diagnostic Command tests and test framework to jtreg
miauno
parents:
diff
changeset
|
38 |
* @test |
f7820f311663
8071908: Port internal Diagnostic Command tests and test framework to jtreg
miauno
parents:
diff
changeset
|
39 |
* @summary Test of diagnostic command Thread.print |
f7820f311663
8071908: Port internal Diagnostic Command tests and test framework to jtreg
miauno
parents:
diff
changeset
|
40 |
* @library /testlibrary |
f7820f311663
8071908: Port internal Diagnostic Command tests and test framework to jtreg
miauno
parents:
diff
changeset
|
41 |
* @build com.oracle.java.testlibrary.* |
f7820f311663
8071908: Port internal Diagnostic Command tests and test framework to jtreg
miauno
parents:
diff
changeset
|
42 |
* @build com.oracle.java.testlibrary.dcmd.* |
f7820f311663
8071908: Port internal Diagnostic Command tests and test framework to jtreg
miauno
parents:
diff
changeset
|
43 |
* @run testng PrintTest |
f7820f311663
8071908: Port internal Diagnostic Command tests and test framework to jtreg
miauno
parents:
diff
changeset
|
44 |
*/ |
f7820f311663
8071908: Port internal Diagnostic Command tests and test framework to jtreg
miauno
parents:
diff
changeset
|
45 |
public class PrintTest { |
f7820f311663
8071908: Port internal Diagnostic Command tests and test framework to jtreg
miauno
parents:
diff
changeset
|
46 |
protected boolean jucLocks = false; |
f7820f311663
8071908: Port internal Diagnostic Command tests and test framework to jtreg
miauno
parents:
diff
changeset
|
47 |
|
f7820f311663
8071908: Port internal Diagnostic Command tests and test framework to jtreg
miauno
parents:
diff
changeset
|
48 |
CyclicBarrier readyBarrier = new CyclicBarrier(3); |
f7820f311663
8071908: Port internal Diagnostic Command tests and test framework to jtreg
miauno
parents:
diff
changeset
|
49 |
CyclicBarrier doneBarrier = new CyclicBarrier(3); |
f7820f311663
8071908: Port internal Diagnostic Command tests and test framework to jtreg
miauno
parents:
diff
changeset
|
50 |
|
f7820f311663
8071908: Port internal Diagnostic Command tests and test framework to jtreg
miauno
parents:
diff
changeset
|
51 |
private void waitForBarrier(CyclicBarrier b) { |
f7820f311663
8071908: Port internal Diagnostic Command tests and test framework to jtreg
miauno
parents:
diff
changeset
|
52 |
try { |
f7820f311663
8071908: Port internal Diagnostic Command tests and test framework to jtreg
miauno
parents:
diff
changeset
|
53 |
b.await(); |
f7820f311663
8071908: Port internal Diagnostic Command tests and test framework to jtreg
miauno
parents:
diff
changeset
|
54 |
} catch (InterruptedException | BrokenBarrierException e) { |
f7820f311663
8071908: Port internal Diagnostic Command tests and test framework to jtreg
miauno
parents:
diff
changeset
|
55 |
Assert.fail("Test error: Caught unexpected exception:", e); |
f7820f311663
8071908: Port internal Diagnostic Command tests and test framework to jtreg
miauno
parents:
diff
changeset
|
56 |
} |
f7820f311663
8071908: Port internal Diagnostic Command tests and test framework to jtreg
miauno
parents:
diff
changeset
|
57 |
} |
f7820f311663
8071908: Port internal Diagnostic Command tests and test framework to jtreg
miauno
parents:
diff
changeset
|
58 |
|
f7820f311663
8071908: Port internal Diagnostic Command tests and test framework to jtreg
miauno
parents:
diff
changeset
|
59 |
class MonitorThread extends Thread { |
f7820f311663
8071908: Port internal Diagnostic Command tests and test framework to jtreg
miauno
parents:
diff
changeset
|
60 |
Object lock = new Object(); |
f7820f311663
8071908: Port internal Diagnostic Command tests and test framework to jtreg
miauno
parents:
diff
changeset
|
61 |
|
f7820f311663
8071908: Port internal Diagnostic Command tests and test framework to jtreg
miauno
parents:
diff
changeset
|
62 |
public void run() { |
f7820f311663
8071908: Port internal Diagnostic Command tests and test framework to jtreg
miauno
parents:
diff
changeset
|
63 |
/* Hold lock on "lock" to show up in thread dump */ |
f7820f311663
8071908: Port internal Diagnostic Command tests and test framework to jtreg
miauno
parents:
diff
changeset
|
64 |
synchronized (lock) { |
f7820f311663
8071908: Port internal Diagnostic Command tests and test framework to jtreg
miauno
parents:
diff
changeset
|
65 |
/* Signal that we're ready for thread dump */ |
f7820f311663
8071908: Port internal Diagnostic Command tests and test framework to jtreg
miauno
parents:
diff
changeset
|
66 |
waitForBarrier(readyBarrier); |
f7820f311663
8071908: Port internal Diagnostic Command tests and test framework to jtreg
miauno
parents:
diff
changeset
|
67 |
|
f7820f311663
8071908: Port internal Diagnostic Command tests and test framework to jtreg
miauno
parents:
diff
changeset
|
68 |
/* Released when the thread dump has been taken */ |
f7820f311663
8071908: Port internal Diagnostic Command tests and test framework to jtreg
miauno
parents:
diff
changeset
|
69 |
waitForBarrier(doneBarrier); |
f7820f311663
8071908: Port internal Diagnostic Command tests and test framework to jtreg
miauno
parents:
diff
changeset
|
70 |
} |
f7820f311663
8071908: Port internal Diagnostic Command tests and test framework to jtreg
miauno
parents:
diff
changeset
|
71 |
} |
f7820f311663
8071908: Port internal Diagnostic Command tests and test framework to jtreg
miauno
parents:
diff
changeset
|
72 |
} |
f7820f311663
8071908: Port internal Diagnostic Command tests and test framework to jtreg
miauno
parents:
diff
changeset
|
73 |
|
f7820f311663
8071908: Port internal Diagnostic Command tests and test framework to jtreg
miauno
parents:
diff
changeset
|
74 |
class LockThread extends Thread { |
f7820f311663
8071908: Port internal Diagnostic Command tests and test framework to jtreg
miauno
parents:
diff
changeset
|
75 |
ReentrantLock lock = new ReentrantLock(); |
f7820f311663
8071908: Port internal Diagnostic Command tests and test framework to jtreg
miauno
parents:
diff
changeset
|
76 |
|
f7820f311663
8071908: Port internal Diagnostic Command tests and test framework to jtreg
miauno
parents:
diff
changeset
|
77 |
public void run() { |
f7820f311663
8071908: Port internal Diagnostic Command tests and test framework to jtreg
miauno
parents:
diff
changeset
|
78 |
/* Hold lock "lock" to show up in thread dump */ |
f7820f311663
8071908: Port internal Diagnostic Command tests and test framework to jtreg
miauno
parents:
diff
changeset
|
79 |
lock.lock(); |
f7820f311663
8071908: Port internal Diagnostic Command tests and test framework to jtreg
miauno
parents:
diff
changeset
|
80 |
|
f7820f311663
8071908: Port internal Diagnostic Command tests and test framework to jtreg
miauno
parents:
diff
changeset
|
81 |
/* Signal that we're ready for thread dump */ |
f7820f311663
8071908: Port internal Diagnostic Command tests and test framework to jtreg
miauno
parents:
diff
changeset
|
82 |
waitForBarrier(readyBarrier); |
f7820f311663
8071908: Port internal Diagnostic Command tests and test framework to jtreg
miauno
parents:
diff
changeset
|
83 |
|
f7820f311663
8071908: Port internal Diagnostic Command tests and test framework to jtreg
miauno
parents:
diff
changeset
|
84 |
/* Released when the thread dump has been taken */ |
f7820f311663
8071908: Port internal Diagnostic Command tests and test framework to jtreg
miauno
parents:
diff
changeset
|
85 |
waitForBarrier(doneBarrier); |
f7820f311663
8071908: Port internal Diagnostic Command tests and test framework to jtreg
miauno
parents:
diff
changeset
|
86 |
|
f7820f311663
8071908: Port internal Diagnostic Command tests and test framework to jtreg
miauno
parents:
diff
changeset
|
87 |
lock.unlock(); |
f7820f311663
8071908: Port internal Diagnostic Command tests and test framework to jtreg
miauno
parents:
diff
changeset
|
88 |
} |
f7820f311663
8071908: Port internal Diagnostic Command tests and test framework to jtreg
miauno
parents:
diff
changeset
|
89 |
} |
f7820f311663
8071908: Port internal Diagnostic Command tests and test framework to jtreg
miauno
parents:
diff
changeset
|
90 |
|
f7820f311663
8071908: Port internal Diagnostic Command tests and test framework to jtreg
miauno
parents:
diff
changeset
|
91 |
public void run(CommandExecutor executor) { |
f7820f311663
8071908: Port internal Diagnostic Command tests and test framework to jtreg
miauno
parents:
diff
changeset
|
92 |
MonitorThread mThread = new MonitorThread(); |
f7820f311663
8071908: Port internal Diagnostic Command tests and test framework to jtreg
miauno
parents:
diff
changeset
|
93 |
mThread.start(); |
f7820f311663
8071908: Port internal Diagnostic Command tests and test framework to jtreg
miauno
parents:
diff
changeset
|
94 |
LockThread lThread = new LockThread(); |
f7820f311663
8071908: Port internal Diagnostic Command tests and test framework to jtreg
miauno
parents:
diff
changeset
|
95 |
lThread.start(); |
f7820f311663
8071908: Port internal Diagnostic Command tests and test framework to jtreg
miauno
parents:
diff
changeset
|
96 |
|
f7820f311663
8071908: Port internal Diagnostic Command tests and test framework to jtreg
miauno
parents:
diff
changeset
|
97 |
/* Wait for threads to get ready */ |
f7820f311663
8071908: Port internal Diagnostic Command tests and test framework to jtreg
miauno
parents:
diff
changeset
|
98 |
waitForBarrier(readyBarrier); |
f7820f311663
8071908: Port internal Diagnostic Command tests and test framework to jtreg
miauno
parents:
diff
changeset
|
99 |
|
f7820f311663
8071908: Port internal Diagnostic Command tests and test framework to jtreg
miauno
parents:
diff
changeset
|
100 |
/* Execute */ |
f7820f311663
8071908: Port internal Diagnostic Command tests and test framework to jtreg
miauno
parents:
diff
changeset
|
101 |
OutputAnalyzer output = executor.execute("Thread.print" + (jucLocks ? " -l=true" : "")); |
f7820f311663
8071908: Port internal Diagnostic Command tests and test framework to jtreg
miauno
parents:
diff
changeset
|
102 |
|
f7820f311663
8071908: Port internal Diagnostic Command tests and test framework to jtreg
miauno
parents:
diff
changeset
|
103 |
/* Signal that we've got the thread dump */ |
f7820f311663
8071908: Port internal Diagnostic Command tests and test framework to jtreg
miauno
parents:
diff
changeset
|
104 |
waitForBarrier(doneBarrier); |
f7820f311663
8071908: Port internal Diagnostic Command tests and test framework to jtreg
miauno
parents:
diff
changeset
|
105 |
|
f7820f311663
8071908: Port internal Diagnostic Command tests and test framework to jtreg
miauno
parents:
diff
changeset
|
106 |
/* |
f7820f311663
8071908: Port internal Diagnostic Command tests and test framework to jtreg
miauno
parents:
diff
changeset
|
107 |
* Example output (trimmed) with arrows indicating the rows we are looking for: |
f7820f311663
8071908: Port internal Diagnostic Command tests and test framework to jtreg
miauno
parents:
diff
changeset
|
108 |
* |
f7820f311663
8071908: Port internal Diagnostic Command tests and test framework to jtreg
miauno
parents:
diff
changeset
|
109 |
* ... |
f7820f311663
8071908: Port internal Diagnostic Command tests and test framework to jtreg
miauno
parents:
diff
changeset
|
110 |
* "Thread-2" #24 prio=5 os_prio=0 tid=0x00007f913411f800 nid=0x4fc9 waiting on condition [0x00007f91fbffe000] |
f7820f311663
8071908: Port internal Diagnostic Command tests and test framework to jtreg
miauno
parents:
diff
changeset
|
111 |
* java.lang.Thread.State: WAITING (parking) |
f7820f311663
8071908: Port internal Diagnostic Command tests and test framework to jtreg
miauno
parents:
diff
changeset
|
112 |
* at sun.misc.Unsafe.park(Native Method) |
f7820f311663
8071908: Port internal Diagnostic Command tests and test framework to jtreg
miauno
parents:
diff
changeset
|
113 |
* - parking to wait for <0x000000071a0868a8> (a java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject) |
f7820f311663
8071908: Port internal Diagnostic Command tests and test framework to jtreg
miauno
parents:
diff
changeset
|
114 |
* at java.util.concurrent.locks.LockSupport.park(LockSupport.java:175) |
f7820f311663
8071908: Port internal Diagnostic Command tests and test framework to jtreg
miauno
parents:
diff
changeset
|
115 |
* at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2039) |
f7820f311663
8071908: Port internal Diagnostic Command tests and test framework to jtreg
miauno
parents:
diff
changeset
|
116 |
* at java.util.concurrent.CyclicBarrier.dowait(CyclicBarrier.java:234) |
f7820f311663
8071908: Port internal Diagnostic Command tests and test framework to jtreg
miauno
parents:
diff
changeset
|
117 |
* at java.util.concurrent.CyclicBarrier.await(CyclicBarrier.java:362) |
f7820f311663
8071908: Port internal Diagnostic Command tests and test framework to jtreg
miauno
parents:
diff
changeset
|
118 |
* at Print.waitForBarrier(Print.java:26) |
f7820f311663
8071908: Port internal Diagnostic Command tests and test framework to jtreg
miauno
parents:
diff
changeset
|
119 |
* at Print.access$000(Print.java:18) |
f7820f311663
8071908: Port internal Diagnostic Command tests and test framework to jtreg
miauno
parents:
diff
changeset
|
120 |
* at Print$LockThread.run(Print.java:58) |
f7820f311663
8071908: Port internal Diagnostic Command tests and test framework to jtreg
miauno
parents:
diff
changeset
|
121 |
* |
f7820f311663
8071908: Port internal Diagnostic Command tests and test framework to jtreg
miauno
parents:
diff
changeset
|
122 |
* --> Locked ownable synchronizers: |
f7820f311663
8071908: Port internal Diagnostic Command tests and test framework to jtreg
miauno
parents:
diff
changeset
|
123 |
* --> - <0x000000071a294930> (a java.util.concurrent.locks.ReentrantLock$NonfairSync) |
f7820f311663
8071908: Port internal Diagnostic Command tests and test framework to jtreg
miauno
parents:
diff
changeset
|
124 |
* |
f7820f311663
8071908: Port internal Diagnostic Command tests and test framework to jtreg
miauno
parents:
diff
changeset
|
125 |
* "Thread-1" #23 prio=5 os_prio=0 tid=0x00007f913411e800 nid=0x4fc8 waiting on condition [0x00007f9200113000] |
f7820f311663
8071908: Port internal Diagnostic Command tests and test framework to jtreg
miauno
parents:
diff
changeset
|
126 |
* java.lang.Thread.State: WAITING (parking) |
f7820f311663
8071908: Port internal Diagnostic Command tests and test framework to jtreg
miauno
parents:
diff
changeset
|
127 |
* at sun.misc.Unsafe.park(Native Method) |
f7820f311663
8071908: Port internal Diagnostic Command tests and test framework to jtreg
miauno
parents:
diff
changeset
|
128 |
* - parking to wait for <0x000000071a0868a8> (a java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject) |
f7820f311663
8071908: Port internal Diagnostic Command tests and test framework to jtreg
miauno
parents:
diff
changeset
|
129 |
* at java.util.concurrent.locks.LockSupport.park(LockSupport.java:175) |
f7820f311663
8071908: Port internal Diagnostic Command tests and test framework to jtreg
miauno
parents:
diff
changeset
|
130 |
* at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2039) |
f7820f311663
8071908: Port internal Diagnostic Command tests and test framework to jtreg
miauno
parents:
diff
changeset
|
131 |
* at java.util.concurrent.CyclicBarrier.dowait(CyclicBarrier.java:234) |
f7820f311663
8071908: Port internal Diagnostic Command tests and test framework to jtreg
miauno
parents:
diff
changeset
|
132 |
* at java.util.concurrent.CyclicBarrier.await(CyclicBarrier.java:362) |
f7820f311663
8071908: Port internal Diagnostic Command tests and test framework to jtreg
miauno
parents:
diff
changeset
|
133 |
* at Print.waitForBarrier(Print.java:26) |
f7820f311663
8071908: Port internal Diagnostic Command tests and test framework to jtreg
miauno
parents:
diff
changeset
|
134 |
* at Print.access$000(Print.java:18) |
f7820f311663
8071908: Port internal Diagnostic Command tests and test framework to jtreg
miauno
parents:
diff
changeset
|
135 |
* at Print$MonitorThread.run(Print.java:42) |
f7820f311663
8071908: Port internal Diagnostic Command tests and test framework to jtreg
miauno
parents:
diff
changeset
|
136 |
* --> - locked <0x000000071a294390> (a java.lang.Object) |
f7820f311663
8071908: Port internal Diagnostic Command tests and test framework to jtreg
miauno
parents:
diff
changeset
|
137 |
* |
f7820f311663
8071908: Port internal Diagnostic Command tests and test framework to jtreg
miauno
parents:
diff
changeset
|
138 |
* Locked ownable synchronizers: |
f7820f311663
8071908: Port internal Diagnostic Command tests and test framework to jtreg
miauno
parents:
diff
changeset
|
139 |
* - None |
f7820f311663
8071908: Port internal Diagnostic Command tests and test framework to jtreg
miauno
parents:
diff
changeset
|
140 |
* |
f7820f311663
8071908: Port internal Diagnostic Command tests and test framework to jtreg
miauno
parents:
diff
changeset
|
141 |
* "MainThread" #22 prio=5 os_prio=0 tid=0x00007f923015b000 nid=0x4fc7 in Object.wait() [0x00007f9200840000] |
f7820f311663
8071908: Port internal Diagnostic Command tests and test framework to jtreg
miauno
parents:
diff
changeset
|
142 |
* java.lang.Thread.State: WAITING (on object monitor) |
f7820f311663
8071908: Port internal Diagnostic Command tests and test framework to jtreg
miauno
parents:
diff
changeset
|
143 |
* at java.lang.Object.wait(Native Method) |
f7820f311663
8071908: Port internal Diagnostic Command tests and test framework to jtreg
miauno
parents:
diff
changeset
|
144 |
* - waiting on <0x000000071a70ad98> (a java.lang.UNIXProcess) |
f7820f311663
8071908: Port internal Diagnostic Command tests and test framework to jtreg
miauno
parents:
diff
changeset
|
145 |
* at java.lang.Object.wait(Object.java:502) |
f7820f311663
8071908: Port internal Diagnostic Command tests and test framework to jtreg
miauno
parents:
diff
changeset
|
146 |
* at java.lang.UNIXProcess.waitFor(UNIXProcess.java:397) |
f7820f311663
8071908: Port internal Diagnostic Command tests and test framework to jtreg
miauno
parents:
diff
changeset
|
147 |
* - locked <0x000000071a70ad98> (a java.lang.UNIXProcess) |
f7820f311663
8071908: Port internal Diagnostic Command tests and test framework to jtreg
miauno
parents:
diff
changeset
|
148 |
* at com.oracle.java.testlibrary.dcmd.JcmdExecutor.executeImpl(JcmdExecutor.java:32) |
f7820f311663
8071908: Port internal Diagnostic Command tests and test framework to jtreg
miauno
parents:
diff
changeset
|
149 |
* at com.oracle.java.testlibrary.dcmd.CommandExecutor.execute(CommandExecutor.java:24) |
f7820f311663
8071908: Port internal Diagnostic Command tests and test framework to jtreg
miauno
parents:
diff
changeset
|
150 |
* --> at Print.run(Print.java:74) |
f7820f311663
8071908: Port internal Diagnostic Command tests and test framework to jtreg
miauno
parents:
diff
changeset
|
151 |
* at Print.file(Print.java:112) |
f7820f311663
8071908: Port internal Diagnostic Command tests and test framework to jtreg
miauno
parents:
diff
changeset
|
152 |
* ... |
f7820f311663
8071908: Port internal Diagnostic Command tests and test framework to jtreg
miauno
parents:
diff
changeset
|
153 |
|
f7820f311663
8071908: Port internal Diagnostic Command tests and test framework to jtreg
miauno
parents:
diff
changeset
|
154 |
*/ |
f7820f311663
8071908: Port internal Diagnostic Command tests and test framework to jtreg
miauno
parents:
diff
changeset
|
155 |
output.shouldMatch(".*at " + Pattern.quote(PrintTest.class.getName()) + "\\.run.*"); |
f7820f311663
8071908: Port internal Diagnostic Command tests and test framework to jtreg
miauno
parents:
diff
changeset
|
156 |
output.shouldMatch(".*- locked <0x\\p{XDigit}+> \\(a " + Pattern.quote(mThread.lock.getClass().getName()) + "\\).*"); |
f7820f311663
8071908: Port internal Diagnostic Command tests and test framework to jtreg
miauno
parents:
diff
changeset
|
157 |
|
f7820f311663
8071908: Port internal Diagnostic Command tests and test framework to jtreg
miauno
parents:
diff
changeset
|
158 |
String jucLockPattern1 = ".*Locked ownable synchronizers:.*"; |
f7820f311663
8071908: Port internal Diagnostic Command tests and test framework to jtreg
miauno
parents:
diff
changeset
|
159 |
String jucLockPattern2 = ".*- <0x\\p{XDigit}+> \\(a " + Pattern.quote(lThread.lock.getClass().getName()) + ".*"; |
f7820f311663
8071908: Port internal Diagnostic Command tests and test framework to jtreg
miauno
parents:
diff
changeset
|
160 |
|
f7820f311663
8071908: Port internal Diagnostic Command tests and test framework to jtreg
miauno
parents:
diff
changeset
|
161 |
if (jucLocks) { |
f7820f311663
8071908: Port internal Diagnostic Command tests and test framework to jtreg
miauno
parents:
diff
changeset
|
162 |
output.shouldMatch(jucLockPattern1); |
f7820f311663
8071908: Port internal Diagnostic Command tests and test framework to jtreg
miauno
parents:
diff
changeset
|
163 |
output.shouldMatch(jucLockPattern2); |
f7820f311663
8071908: Port internal Diagnostic Command tests and test framework to jtreg
miauno
parents:
diff
changeset
|
164 |
} else { |
f7820f311663
8071908: Port internal Diagnostic Command tests and test framework to jtreg
miauno
parents:
diff
changeset
|
165 |
output.shouldNotMatch(jucLockPattern1); |
f7820f311663
8071908: Port internal Diagnostic Command tests and test framework to jtreg
miauno
parents:
diff
changeset
|
166 |
output.shouldNotMatch(jucLockPattern2); |
f7820f311663
8071908: Port internal Diagnostic Command tests and test framework to jtreg
miauno
parents:
diff
changeset
|
167 |
} |
f7820f311663
8071908: Port internal Diagnostic Command tests and test framework to jtreg
miauno
parents:
diff
changeset
|
168 |
} |
f7820f311663
8071908: Port internal Diagnostic Command tests and test framework to jtreg
miauno
parents:
diff
changeset
|
169 |
|
f7820f311663
8071908: Port internal Diagnostic Command tests and test framework to jtreg
miauno
parents:
diff
changeset
|
170 |
@Test |
f7820f311663
8071908: Port internal Diagnostic Command tests and test framework to jtreg
miauno
parents:
diff
changeset
|
171 |
public void jmx() { |
f7820f311663
8071908: Port internal Diagnostic Command tests and test framework to jtreg
miauno
parents:
diff
changeset
|
172 |
run(new JMXExecutor()); |
f7820f311663
8071908: Port internal Diagnostic Command tests and test framework to jtreg
miauno
parents:
diff
changeset
|
173 |
} |
f7820f311663
8071908: Port internal Diagnostic Command tests and test framework to jtreg
miauno
parents:
diff
changeset
|
174 |
} |