author | ihse |
Tue, 09 May 2017 12:57:30 +0200 | |
changeset 45028 | b0ea3c0bfb81 |
parent 44423 | 306c020eb154 |
permissions | -rw-r--r-- |
2 | 1 |
#!/bin/sh |
2 |
||
3 |
# |
|
45028
b0ea3c0bfb81
8179889: Fix typographic errors in copyright headers
ihse
parents:
44423
diff
changeset
|
4 |
# Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved. |
2 | 5 |
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
6 |
# |
|
7 |
# This code is free software; you can redistribute it and/or modify it |
|
8 |
# under the terms of the GNU General Public License version 2 only, as |
|
9 |
# published by the Free Software Foundation. |
|
10 |
# |
|
11 |
# This code is distributed in the hope that it will be useful, but WITHOUT |
|
12 |
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
13 |
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
14 |
# version 2 for more details (a copy is included in the LICENSE file that |
|
15 |
# accompanied this code). |
|
16 |
# |
|
17 |
# You should have received a copy of the GNU General Public License version |
|
18 |
# 2 along with this work; if not, write to the Free Software Foundation, |
|
19 |
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
20 |
# |
|
5506 | 21 |
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
22 |
# or visit www.oracle.com if you need additional information or have any |
|
23 |
# questions. |
|
2 | 24 |
# |
25 |
||
44423 | 26 |
# @test |
27 |
# @bug 6224859 |
|
28 |
# @key intermittent |
|
29 |
# @summary JDWP: Mixing application suspends and debugger suspends can cause hangs |
|
30 |
# @author Jim Holmlund |
|
31 |
# |
|
32 |
# @run build TestScaffold VMConnection TargetListener TargetAdapter |
|
33 |
# @run shell MixedSuspendTest.sh |
|
2 | 34 |
|
35 |
classname=MixedSuspendTarg |
|
36 |
||
37 |
createJavaFile() |
|
38 |
{ |
|
39 |
cat <<EOF > $classname.java.1 |
|
40 |
||
41 |
import java.util.*; |
|
42 |
||
43 |
public class $classname extends Thread { |
|
44 |
||
45 |
static volatile boolean started = true; |
|
46 |
static String lock = "startLock"; |
|
47 |
||
48 |
public static void main(String[] args){ |
|
49 |
System.out.println("Howdy from MixedSuspendTarg"); |
|
50 |
||
51 |
MixedSuspendTarg mytarg = new MixedSuspendTarg(); |
|
52 |
||
53 |
synchronized(lock) { |
|
54 |
mytarg.start(); |
|
55 |
try { |
|
56 |
lock.wait(); |
|
57 |
} catch(InterruptedException ee) { |
|
58 |
} |
|
59 |
} |
|
60 |
mytarg.suspend(); |
|
61 |
bkpt(); |
|
62 |
System.out.println("Debuggee: resuming thread"); |
|
63 |
||
64 |
// If the bug occurs, this resume hangs in the back-end |
|
65 |
mytarg.resume(); |
|
66 |
System.out.println("Debuggee: resumed thread"); |
|
67 |
synchronized(lock) { |
|
68 |
started = false; |
|
69 |
} |
|
70 |
System.out.println("Debuggee: exitting, started = " + started); |
|
71 |
} |
|
72 |
||
73 |
public void run() { |
|
74 |
synchronized(lock) { |
|
75 |
lock.notifyAll(); |
|
76 |
} |
|
77 |
while (true) { |
|
78 |
synchronized(lock) { |
|
79 |
if (!started) { |
|
80 |
break; |
|
81 |
} |
|
82 |
int i = 0; |
|
83 |
} |
|
84 |
} |
|
44423 | 85 |
|
2 | 86 |
System.out.println("Debuggee: end of thread"); |
87 |
} |
|
88 |
||
89 |
static void bkpt() { |
|
90 |
//System.out.println("bkpt reached, thread = " + this.getName()); |
|
91 |
int i = 0; // @1 breakpoint |
|
92 |
} |
|
93 |
} |
|
94 |
||
95 |
EOF |
|
96 |
} |
|
97 |
||
98 |
dojdbCmds() |
|
99 |
{ |
|
100 |
setBkpts @1 |
|
101 |
runToBkpt @1 |
|
23046
0b0407b1e2a5
6946101: ShellScaffold.sh based tests can issue "write error: Broken pipe" messages
iignatyev
parents:
5506
diff
changeset
|
102 |
cmd allowExit cont |
2 | 103 |
} |
104 |
||
105 |
||
106 |
mysetup() |
|
107 |
{ |
|
108 |
if [ -z "$TESTSRC" ] ; then |
|
109 |
TESTSRC=. |
|
110 |
fi |
|
111 |
||
112 |
for ii in . $TESTSRC $TESTSRC/.. ; do |
|
113 |
if [ -r "$ii/ShellScaffold.sh" ] ; then |
|
44423 | 114 |
. $ii/ShellScaffold.sh |
2 | 115 |
break |
116 |
fi |
|
117 |
done |
|
118 |
} |
|
119 |
||
120 |
# You could replace this next line with the contents |
|
121 |
# of ShellScaffold.sh and this script will run just the same. |
|
122 |
mysetup |
|
123 |
||
124 |
runit |
|
125 |
## This test fails by timing out. |
|
126 |
pass |