author | amenkov |
Fri, 21 Sep 2018 11:28:14 -0700 | |
changeset 51837 | 46ca82c15f6c |
parent 47216 | 71c04702a3d5 |
permissions | -rw-r--r-- |
2 | 1 |
#!/bin/sh |
2 |
||
3 |
# |
|
45028
b0ea3c0bfb81
8179889: Fix typographic errors in copyright headers
ihse
parents:
40468
diff
changeset
|
4 |
# Copyright (c) 2002, 2014, 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 |
||
26 |
# @test |
|
27 |
# @bug 4671838 |
|
28 |
# @summary TTY: surprising ExceptionSpec.resolveEventRequest() wildcard results |
|
29 |
# @author Tim Bell |
|
30 |
# |
|
32018
91c91b3d50a0
8132094: Mark intermittently failuring core-svc tests
ykantser
parents:
31909
diff
changeset
|
31 |
# @key intermittent |
2 | 32 |
# @run shell CatchPatternTest.sh |
33 |
classname=CatchPatternTestTarg |
|
34 |
createJavaFile() |
|
35 |
{ |
|
36 |
cat <<EOF > $classname.java.1 |
|
37 |
public class $classname { |
|
38 |
public void bark(int i) { |
|
23057 | 39 |
System.out.println(" bark: " + i); |
40 |
switch (i) { |
|
41 |
case 0: |
|
42 |
throw new IllegalArgumentException("IllegalArgumentException"); |
|
43 |
case 1: |
|
44 |
throw new ArithmeticException("ArithmeticException"); |
|
45 |
case 2: |
|
46 |
throw new IllegalMonitorStateException("IllegalMonitorStateException"); |
|
47 |
case 3: |
|
48 |
throw new IndexOutOfBoundsException("IndexOutOfBoundsException"); |
|
49 |
default: |
|
50 |
throw new Error("should not happen"); |
|
51 |
} |
|
2 | 52 |
} |
53 |
public void loop(int max) { |
|
23057 | 54 |
for (int i = 0; i <= max; i++) { |
55 |
try { |
|
56 |
bark(i); |
|
57 |
} catch(RuntimeException re) { |
|
58 |
System.out.println(" loop: " + re.getMessage() + |
|
59 |
" caught and ignored."); |
|
60 |
} |
|
61 |
} |
|
2 | 62 |
} |
63 |
public void partOne() { |
|
64 |
loop(2); |
|
23057 | 65 |
System.out.println("partOne completed"); |
2 | 66 |
} |
67 |
public void partTwo() { |
|
68 |
loop(3); |
|
23057 | 69 |
System.out.println("partTwo completed"); |
2 | 70 |
} |
71 |
public static void main(String[] args) { |
|
23057 | 72 |
System.out.println("Howdy!"); |
2 | 73 |
$classname my = new $classname(); |
23057 | 74 |
my.partOne(); |
75 |
my.partTwo(); |
|
76 |
System.out.println("Goodbye from $classname!"); |
|
2 | 77 |
} |
78 |
} |
|
79 |
EOF |
|
80 |
} |
|
81 |
||
82 |
# This is called to feed cmds to jdb. |
|
83 |
dojdbCmds() |
|
84 |
{ |
|
85 |
#set -x |
|
86 |
cmd stop in ${classname}.main |
|
87 |
cmd stop in ${classname}.partTwo |
|
88 |
runToBkpt |
|
89 |
cmd ignore uncaught java.lang.Throwable |
|
40468
ae9bae97a312
8164012: com/sun/jdi/CatchPatternTest.sh fails on jdk9/hs with Required output "Exception occurred: java.lang.IllegalMonitorStateException" not found
sla
parents:
32018
diff
changeset
|
90 |
# Instead of matching java.lang.I* we use two more specific |
ae9bae97a312
8164012: com/sun/jdi/CatchPatternTest.sh fails on jdk9/hs with Required output "Exception occurred: java.lang.IllegalMonitorStateException" not found
sla
parents:
32018
diff
changeset
|
91 |
# patterns here. The reason is to avoid matching IncompatibleClassChangeError |
ae9bae97a312
8164012: com/sun/jdi/CatchPatternTest.sh fails on jdk9/hs with Required output "Exception occurred: java.lang.IllegalMonitorStateException" not found
sla
parents:
32018
diff
changeset
|
92 |
# (or the subclass NoSuchMethodError) thrown by the |
ae9bae97a312
8164012: com/sun/jdi/CatchPatternTest.sh fails on jdk9/hs with Required output "Exception occurred: java.lang.IllegalMonitorStateException" not found
sla
parents:
32018
diff
changeset
|
93 |
# java.lang.invoke infrastructure. |
ae9bae97a312
8164012: com/sun/jdi/CatchPatternTest.sh fails on jdk9/hs with Required output "Exception occurred: java.lang.IllegalMonitorStateException" not found
sla
parents:
32018
diff
changeset
|
94 |
cmd catch all java.lang.Il* |
ae9bae97a312
8164012: com/sun/jdi/CatchPatternTest.sh fails on jdk9/hs with Required output "Exception occurred: java.lang.IllegalMonitorStateException" not found
sla
parents:
32018
diff
changeset
|
95 |
cmd catch all java.lang.Ind* |
2 | 96 |
cmd cont |
97 |
cmd cont |
|
98 |
cmd cont |
|
99 |
cmd ignore all java.lang.I* |
|
23046
0b0407b1e2a5
6946101: ShellScaffold.sh based tests can issue "write error: Broken pipe" messages
iignatyev
parents:
5506
diff
changeset
|
100 |
cmd allowExit cont |
2 | 101 |
} |
102 |
||
103 |
mysetup() |
|
104 |
{ |
|
105 |
if [ -z "$TESTSRC" ] ; then |
|
106 |
TESTSRC=. |
|
107 |
fi |
|
108 |
||
109 |
for ii in . $TESTSRC $TESTSRC/.. ; do |
|
110 |
if [ -r "$ii/ShellScaffold.sh" ] ; then |
|
45028
b0ea3c0bfb81
8179889: Fix typographic errors in copyright headers
ihse
parents:
40468
diff
changeset
|
111 |
. $ii/ShellScaffold.sh |
2 | 112 |
break |
113 |
fi |
|
114 |
done |
|
115 |
} |
|
116 |
||
117 |
# You could replace this next line with the contents |
|
118 |
# of ShellScaffold.sh and this script will run just the same. |
|
119 |
mysetup |
|
120 |
||
121 |
runit |
|
122 |
# |
|
123 |
jdbFailIfNotPresent "Exception occurred: java.lang.IllegalArgumentException" |
|
124 |
jdbFailIfNotPresent "Exception occurred: java.lang.IllegalMonitorStateException" |
|
125 |
jdbFailIfPresent "Exception occurred: ArithmeticException" |
|
126 |
jdbFailIfPresent "Exception occurred: IndexOutOfBoundsException" |
|
127 |
jdbFailIfPresent "Exception occurred: IllegalStateException" |
|
128 |
jdbFailIfPresent "should not happen" |
|
129 |
debuggeeFailIfNotPresent "partOne completed" |
|
130 |
debuggeeFailIfNotPresent "partTwo completed" |
|
131 |
# |
|
132 |
pass |