author | amenkov |
Fri, 12 Oct 2018 10:08:11 -0700 | |
changeset 52110 | 65efb9c57fef |
parent 51648 | b7b69bc93a2d |
permissions | -rw-r--r-- |
51648
b7b69bc93a2d
8210243: [TEST] rewrite com/sun/jdi shell tests to java version - step3
amenkov
parents:
diff
changeset
|
1 |
/* |
b7b69bc93a2d
8210243: [TEST] rewrite com/sun/jdi shell tests to java version - step3
amenkov
parents:
diff
changeset
|
2 |
* Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved. |
b7b69bc93a2d
8210243: [TEST] rewrite com/sun/jdi shell tests to java version - step3
amenkov
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
b7b69bc93a2d
8210243: [TEST] rewrite com/sun/jdi shell tests to java version - step3
amenkov
parents:
diff
changeset
|
4 |
* |
b7b69bc93a2d
8210243: [TEST] rewrite com/sun/jdi shell tests to java version - step3
amenkov
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
b7b69bc93a2d
8210243: [TEST] rewrite com/sun/jdi shell tests to java version - step3
amenkov
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
b7b69bc93a2d
8210243: [TEST] rewrite com/sun/jdi shell tests to java version - step3
amenkov
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
b7b69bc93a2d
8210243: [TEST] rewrite com/sun/jdi shell tests to java version - step3
amenkov
parents:
diff
changeset
|
8 |
* |
b7b69bc93a2d
8210243: [TEST] rewrite com/sun/jdi shell tests to java version - step3
amenkov
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
b7b69bc93a2d
8210243: [TEST] rewrite com/sun/jdi shell tests to java version - step3
amenkov
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
b7b69bc93a2d
8210243: [TEST] rewrite com/sun/jdi shell tests to java version - step3
amenkov
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
b7b69bc93a2d
8210243: [TEST] rewrite com/sun/jdi shell tests to java version - step3
amenkov
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
b7b69bc93a2d
8210243: [TEST] rewrite com/sun/jdi shell tests to java version - step3
amenkov
parents:
diff
changeset
|
13 |
* accompanied this code). |
b7b69bc93a2d
8210243: [TEST] rewrite com/sun/jdi shell tests to java version - step3
amenkov
parents:
diff
changeset
|
14 |
* |
b7b69bc93a2d
8210243: [TEST] rewrite com/sun/jdi shell tests to java version - step3
amenkov
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
b7b69bc93a2d
8210243: [TEST] rewrite com/sun/jdi shell tests to java version - step3
amenkov
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
b7b69bc93a2d
8210243: [TEST] rewrite com/sun/jdi shell tests to java version - step3
amenkov
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
b7b69bc93a2d
8210243: [TEST] rewrite com/sun/jdi shell tests to java version - step3
amenkov
parents:
diff
changeset
|
18 |
* |
b7b69bc93a2d
8210243: [TEST] rewrite com/sun/jdi shell tests to java version - step3
amenkov
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
b7b69bc93a2d
8210243: [TEST] rewrite com/sun/jdi shell tests to java version - step3
amenkov
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
b7b69bc93a2d
8210243: [TEST] rewrite com/sun/jdi shell tests to java version - step3
amenkov
parents:
diff
changeset
|
21 |
* questions. |
b7b69bc93a2d
8210243: [TEST] rewrite com/sun/jdi shell tests to java version - step3
amenkov
parents:
diff
changeset
|
22 |
*/ |
b7b69bc93a2d
8210243: [TEST] rewrite com/sun/jdi shell tests to java version - step3
amenkov
parents:
diff
changeset
|
23 |
|
b7b69bc93a2d
8210243: [TEST] rewrite com/sun/jdi shell tests to java version - step3
amenkov
parents:
diff
changeset
|
24 |
/* |
b7b69bc93a2d
8210243: [TEST] rewrite com/sun/jdi shell tests to java version - step3
amenkov
parents:
diff
changeset
|
25 |
* @test |
b7b69bc93a2d
8210243: [TEST] rewrite com/sun/jdi shell tests to java version - step3
amenkov
parents:
diff
changeset
|
26 |
* @bug 4690242 4695338 |
b7b69bc93a2d
8210243: [TEST] rewrite com/sun/jdi shell tests to java version - step3
amenkov
parents:
diff
changeset
|
27 |
* @summary TTY: jdb throws NullPointerException when printing local variables |
b7b69bc93a2d
8210243: [TEST] rewrite com/sun/jdi shell tests to java version - step3
amenkov
parents:
diff
changeset
|
28 |
* @comment converted from test/jdk/com/sun/jdi/NullLocalVariable.sh |
b7b69bc93a2d
8210243: [TEST] rewrite com/sun/jdi shell tests to java version - step3
amenkov
parents:
diff
changeset
|
29 |
* |
b7b69bc93a2d
8210243: [TEST] rewrite com/sun/jdi shell tests to java version - step3
amenkov
parents:
diff
changeset
|
30 |
* @library /test/lib |
b7b69bc93a2d
8210243: [TEST] rewrite com/sun/jdi shell tests to java version - step3
amenkov
parents:
diff
changeset
|
31 |
* @compile -g NullLocalVariable.java |
b7b69bc93a2d
8210243: [TEST] rewrite com/sun/jdi shell tests to java version - step3
amenkov
parents:
diff
changeset
|
32 |
* @run main/othervm NullLocalVariable |
b7b69bc93a2d
8210243: [TEST] rewrite com/sun/jdi shell tests to java version - step3
amenkov
parents:
diff
changeset
|
33 |
*/ |
b7b69bc93a2d
8210243: [TEST] rewrite com/sun/jdi shell tests to java version - step3
amenkov
parents:
diff
changeset
|
34 |
|
b7b69bc93a2d
8210243: [TEST] rewrite com/sun/jdi shell tests to java version - step3
amenkov
parents:
diff
changeset
|
35 |
import jdk.test.lib.process.OutputAnalyzer; |
b7b69bc93a2d
8210243: [TEST] rewrite com/sun/jdi shell tests to java version - step3
amenkov
parents:
diff
changeset
|
36 |
import lib.jdb.JdbCommand; |
b7b69bc93a2d
8210243: [TEST] rewrite com/sun/jdi shell tests to java version - step3
amenkov
parents:
diff
changeset
|
37 |
import lib.jdb.JdbTest; |
b7b69bc93a2d
8210243: [TEST] rewrite com/sun/jdi shell tests to java version - step3
amenkov
parents:
diff
changeset
|
38 |
|
b7b69bc93a2d
8210243: [TEST] rewrite com/sun/jdi shell tests to java version - step3
amenkov
parents:
diff
changeset
|
39 |
class NullLocalVariableTarg { |
b7b69bc93a2d
8210243: [TEST] rewrite com/sun/jdi shell tests to java version - step3
amenkov
parents:
diff
changeset
|
40 |
public static final void main(String args[]) { |
b7b69bc93a2d
8210243: [TEST] rewrite com/sun/jdi shell tests to java version - step3
amenkov
parents:
diff
changeset
|
41 |
try { |
b7b69bc93a2d
8210243: [TEST] rewrite com/sun/jdi shell tests to java version - step3
amenkov
parents:
diff
changeset
|
42 |
System.out.println("hi!"); // @1 breakpoint |
b7b69bc93a2d
8210243: [TEST] rewrite com/sun/jdi shell tests to java version - step3
amenkov
parents:
diff
changeset
|
43 |
} catch (Exception e) { |
b7b69bc93a2d
8210243: [TEST] rewrite com/sun/jdi shell tests to java version - step3
amenkov
parents:
diff
changeset
|
44 |
e.printStackTrace(); |
b7b69bc93a2d
8210243: [TEST] rewrite com/sun/jdi shell tests to java version - step3
amenkov
parents:
diff
changeset
|
45 |
} finally { |
b7b69bc93a2d
8210243: [TEST] rewrite com/sun/jdi shell tests to java version - step3
amenkov
parents:
diff
changeset
|
46 |
System.out.println("done"); |
b7b69bc93a2d
8210243: [TEST] rewrite com/sun/jdi shell tests to java version - step3
amenkov
parents:
diff
changeset
|
47 |
} |
b7b69bc93a2d
8210243: [TEST] rewrite com/sun/jdi shell tests to java version - step3
amenkov
parents:
diff
changeset
|
48 |
} |
b7b69bc93a2d
8210243: [TEST] rewrite com/sun/jdi shell tests to java version - step3
amenkov
parents:
diff
changeset
|
49 |
} |
b7b69bc93a2d
8210243: [TEST] rewrite com/sun/jdi shell tests to java version - step3
amenkov
parents:
diff
changeset
|
50 |
|
b7b69bc93a2d
8210243: [TEST] rewrite com/sun/jdi shell tests to java version - step3
amenkov
parents:
diff
changeset
|
51 |
public class NullLocalVariable extends JdbTest { |
b7b69bc93a2d
8210243: [TEST] rewrite com/sun/jdi shell tests to java version - step3
amenkov
parents:
diff
changeset
|
52 |
public static void main(String argv[]) { |
b7b69bc93a2d
8210243: [TEST] rewrite com/sun/jdi shell tests to java version - step3
amenkov
parents:
diff
changeset
|
53 |
new NullLocalVariable().run(); |
b7b69bc93a2d
8210243: [TEST] rewrite com/sun/jdi shell tests to java version - step3
amenkov
parents:
diff
changeset
|
54 |
} |
b7b69bc93a2d
8210243: [TEST] rewrite com/sun/jdi shell tests to java version - step3
amenkov
parents:
diff
changeset
|
55 |
|
b7b69bc93a2d
8210243: [TEST] rewrite com/sun/jdi shell tests to java version - step3
amenkov
parents:
diff
changeset
|
56 |
private NullLocalVariable() { |
b7b69bc93a2d
8210243: [TEST] rewrite com/sun/jdi shell tests to java version - step3
amenkov
parents:
diff
changeset
|
57 |
super(DEBUGGEE_CLASS); |
b7b69bc93a2d
8210243: [TEST] rewrite com/sun/jdi shell tests to java version - step3
amenkov
parents:
diff
changeset
|
58 |
} |
b7b69bc93a2d
8210243: [TEST] rewrite com/sun/jdi shell tests to java version - step3
amenkov
parents:
diff
changeset
|
59 |
|
b7b69bc93a2d
8210243: [TEST] rewrite com/sun/jdi shell tests to java version - step3
amenkov
parents:
diff
changeset
|
60 |
private static final String DEBUGGEE_CLASS = NullLocalVariableTarg.class.getName(); |
b7b69bc93a2d
8210243: [TEST] rewrite com/sun/jdi shell tests to java version - step3
amenkov
parents:
diff
changeset
|
61 |
|
b7b69bc93a2d
8210243: [TEST] rewrite com/sun/jdi shell tests to java version - step3
amenkov
parents:
diff
changeset
|
62 |
@Override |
b7b69bc93a2d
8210243: [TEST] rewrite com/sun/jdi shell tests to java version - step3
amenkov
parents:
diff
changeset
|
63 |
protected void runCases() { |
b7b69bc93a2d
8210243: [TEST] rewrite com/sun/jdi shell tests to java version - step3
amenkov
parents:
diff
changeset
|
64 |
setBreakpointsFromTestSource("NullLocalVariable.java", 1); |
b7b69bc93a2d
8210243: [TEST] rewrite com/sun/jdi shell tests to java version - step3
amenkov
parents:
diff
changeset
|
65 |
// Run to breakpoint #1 |
b7b69bc93a2d
8210243: [TEST] rewrite com/sun/jdi shell tests to java version - step3
amenkov
parents:
diff
changeset
|
66 |
jdb.command(JdbCommand.run()); |
b7b69bc93a2d
8210243: [TEST] rewrite com/sun/jdi shell tests to java version - step3
amenkov
parents:
diff
changeset
|
67 |
|
b7b69bc93a2d
8210243: [TEST] rewrite com/sun/jdi shell tests to java version - step3
amenkov
parents:
diff
changeset
|
68 |
jdb.command(JdbCommand.next()); |
b7b69bc93a2d
8210243: [TEST] rewrite com/sun/jdi shell tests to java version - step3
amenkov
parents:
diff
changeset
|
69 |
jdb.command(JdbCommand.next()); |
b7b69bc93a2d
8210243: [TEST] rewrite com/sun/jdi shell tests to java version - step3
amenkov
parents:
diff
changeset
|
70 |
jdb.command(JdbCommand.locals()); |
b7b69bc93a2d
8210243: [TEST] rewrite com/sun/jdi shell tests to java version - step3
amenkov
parents:
diff
changeset
|
71 |
jdb.contToExit(1); |
b7b69bc93a2d
8210243: [TEST] rewrite com/sun/jdi shell tests to java version - step3
amenkov
parents:
diff
changeset
|
72 |
|
b7b69bc93a2d
8210243: [TEST] rewrite com/sun/jdi shell tests to java version - step3
amenkov
parents:
diff
changeset
|
73 |
new OutputAnalyzer(getDebuggeeOutput()) |
b7b69bc93a2d
8210243: [TEST] rewrite com/sun/jdi shell tests to java version - step3
amenkov
parents:
diff
changeset
|
74 |
.shouldNotContain("Internal exception"); |
b7b69bc93a2d
8210243: [TEST] rewrite com/sun/jdi shell tests to java version - step3
amenkov
parents:
diff
changeset
|
75 |
} |
b7b69bc93a2d
8210243: [TEST] rewrite com/sun/jdi shell tests to java version - step3
amenkov
parents:
diff
changeset
|
76 |
} |