1 /*
2 * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
150 }
151 } catch ( InterruptedException e ) {
152 throw new RuntimeException("Test failed - process interrupted");
153 }
154 System.out.println("Completed: " + cmdLine);
155 }
156
157 /*
158 * Execute a process with an -agentpath or -agentlib command option
159 * plus any set of other java options.
160 */
161 public void runit(String class_name, String vm_options[])
162 {
163 String jre_home = System.getProperty("java.home");
164 String sdk_home = (jre_home.endsWith("jre") ?
165 (jre_home + File.separator + "..") :
166 jre_home );
167 String cdir = System.getProperty("test.classes", ".");
168 String os_arch = System.getProperty("os.arch");
169 String os_name = System.getProperty("os.name");
170 boolean d64 = os_name.equals("SunOS") && (
171 os_arch.equals("sparcv9") ||
172 os_arch.equals("amd64"));
173 String isa_dir = d64?(File.separator+os_arch):"";
174 String java = jre_home
175 + File.separator + "bin" + isa_dir
176 + File.separator + "java";
177 String jhat = sdk_home + File.separator + "bin"
178 + File.separator + "jhat";
179 /* Array of strings to be passed in for exec:
180 * 1. java
181 * 2. -Dtest.classes=.
182 * 3. -d64 (optional)
183 * 4. -Xcheck:jni (Just because it finds bugs)
184 * 5. -Xverify:all (Make sure verification is on full blast)
185 * 6. -agent
186 * vm_options
187 * 7+i. classname
188 */
189 int nvm_options = 0;
190 if ( vm_options != null ) nvm_options = vm_options.length;
191 String cmd[] = new String[1 + (d64?1:0) + 7 + nvm_options];
192 int i,j;
193
194 i = 0;
195 cmd[i++] = java;
196 cmd[i++] = "-cp";
197 cmd[i++] = cdir;
198 cmd[i++] = "-Dtest.classes=" + cdir;
199 if ( d64 ) {
200 cmd[i++] = "-d64";
201 }
202 cmd[i++] = "-Xcheck:jni";
203 cmd[i++] = "-Xverify:all";
204 dumpfile= cdir + File.separator + class_name + ".hdump";
205 cmd[i++] = "-agentlib:hprof=" + all_hprof_options
206 + ",format=b,file=" + dumpfile;
207 /* Add any special VM options */
208 for ( j = 0; j < nvm_options; j++ ) {
209 cmd[i++] = vm_options[j];
210 }
211 /* Add classname */
212 cmd[i++] = class_name;
213
214 /* Execute process */
215 execute(cmd);
216
217 /* Run jhat */
218 String jhat_cmd[] = new String[4];
219 jhat_cmd[0] = jhat;
220 jhat_cmd[1] = "-debug";
221 jhat_cmd[2] = "2";
|
1 /*
2 * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
150 }
151 } catch ( InterruptedException e ) {
152 throw new RuntimeException("Test failed - process interrupted");
153 }
154 System.out.println("Completed: " + cmdLine);
155 }
156
157 /*
158 * Execute a process with an -agentpath or -agentlib command option
159 * plus any set of other java options.
160 */
161 public void runit(String class_name, String vm_options[])
162 {
163 String jre_home = System.getProperty("java.home");
164 String sdk_home = (jre_home.endsWith("jre") ?
165 (jre_home + File.separator + "..") :
166 jre_home );
167 String cdir = System.getProperty("test.classes", ".");
168 String os_arch = System.getProperty("os.arch");
169 String os_name = System.getProperty("os.name");
170 String java = jre_home
171 + File.separator + "bin"
172 + File.separator + "java";
173 String jhat = sdk_home + File.separator + "bin"
174 + File.separator + "jhat";
175 /* Array of strings to be passed in for exec:
176 * 1. java
177 * 2. -Dtest.classes=.
178 * 3. -Xcheck:jni (Just because it finds bugs)
179 * 4. -Xverify:all (Make sure verification is on full blast)
180 * 5. -agent
181 * vm_options
182 * 6+i. classname
183 */
184 int nvm_options = 0;
185 if ( vm_options != null ) nvm_options = vm_options.length;
186 String cmd[] = new String[1 + 7 + nvm_options];
187 int i,j;
188
189 i = 0;
190 cmd[i++] = java;
191 cmd[i++] = "-cp";
192 cmd[i++] = cdir;
193 cmd[i++] = "-Dtest.classes=" + cdir;
194 cmd[i++] = "-Xcheck:jni";
195 cmd[i++] = "-Xverify:all";
196 dumpfile= cdir + File.separator + class_name + ".hdump";
197 cmd[i++] = "-agentlib:hprof=" + all_hprof_options
198 + ",format=b,file=" + dumpfile;
199 /* Add any special VM options */
200 for ( j = 0; j < nvm_options; j++ ) {
201 cmd[i++] = vm_options[j];
202 }
203 /* Add classname */
204 cmd[i++] = class_name;
205
206 /* Execute process */
207 execute(cmd);
208
209 /* Run jhat */
210 String jhat_cmd[] = new String[4];
211 jhat_cmd[0] = jhat;
212 jhat_cmd[1] = "-debug";
213 jhat_cmd[2] = "2";
|