changeset 49009 | 1ecb986334cb |
parent 47216 | 71c04702a3d5 |
49008:d777541fceba | 49009:1ecb986334cb |
---|---|
1 /* |
1 /* |
2 * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. |
7 * published by the Free Software Foundation. |
24 /** |
24 /** |
25 * @test |
25 * @test |
26 * @summary Test Method.variables() and the like. |
26 * @summary Test Method.variables() and the like. |
27 * @author Robert Field |
27 * @author Robert Field |
28 * |
28 * |
29 * @run build JDIScaffold VMConnection |
29 * @run build TestScaffold VMConnection |
30 * @run compile -g Vars.java |
30 * @run compile -g Vars.java |
31 * @run driver Vars |
31 * @run driver Vars |
32 */ |
32 */ |
33 |
33 |
34 import com.sun.jdi.*; |
34 import com.sun.jdi.*; |
66 } |
66 } |
67 |
67 |
68 /* |
68 /* |
69 * "Vars" test runs TestVars and makes LocalVariable queries |
69 * "Vars" test runs TestVars and makes LocalVariable queries |
70 */ |
70 */ |
71 public class Vars extends JDIScaffold { |
71 public class Vars extends TestScaffold { |
72 final String[] args; |
|
73 |
72 |
74 boolean failed = false; |
73 boolean failed = false; |
75 |
74 |
76 Vars(String args[]) { |
75 Vars(String args[]) { |
77 super(); |
76 super(args); |
78 this.args = args; |
|
79 } |
77 } |
80 |
78 |
81 public static void main(String[] args) throws Exception { |
79 public static void main(String[] args) throws Exception { |
82 new Vars(args).runTests(); |
80 new Vars(args).runTests(); |
83 } |
81 } |
142 System.out.println(" got: " + got); |
140 System.out.println(" got: " + got); |
143 } |
141 } |
144 } |
142 } |
145 |
143 |
146 protected void runTests() throws Exception { |
144 protected void runTests() throws Exception { |
147 List argList = new ArrayList(Arrays.asList(args)); |
|
148 argList.add("TestVars"); |
|
149 System.out.println("run args: " + argList); |
|
150 connect((String[])argList.toArray(args)); |
|
151 waitForVMStart(); |
|
152 |
|
153 /* |
145 /* |
154 * Get to a point where the classes are loaded. |
146 * Get to a point where the classes are loaded. |
155 */ |
147 */ |
156 BreakpointEvent bp = resumeTo("TestVars", "hi", "()V"); |
148 BreakpointEvent bp = startTo("TestVars", "hi", "()V"); |
157 |
149 |
158 /* |
150 /* |
159 * These classes should have no line numbers, except for |
151 * These classes should have no line numbers, except for |
160 * one in the implicit constructor. |
152 * one in the implicit constructor. |
161 */ |
153 */ |
194 test2(method, VARIABLES, "normal/variables", "sh,lo,st", "st,sh,lo"); |
186 test2(method, VARIABLES, "normal/variables", "sh,lo,st", "st,sh,lo"); |
195 test(method, BYNAME, "normal/variablesByName", "st"); |
187 test(method, BYNAME, "normal/variablesByName", "st"); |
196 test(method, ARGUMENTS, "normal/arguments", "sh,lo"); |
188 test(method, ARGUMENTS, "normal/arguments", "sh,lo"); |
197 |
189 |
198 // Allow application to complete |
190 // Allow application to complete |
199 resumeToVMDeath(); |
191 resumeToVMDisconnect(); |
200 |
192 |
201 if (failed) { |
193 if (failed) { |
202 throw new Exception("Vars: failed"); |
194 throw new Exception("Vars: failed"); |
203 } else { |
195 } else { |
204 System.out.println("Vars: passed"); |
196 System.out.println("Vars: passed"); |