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 String java = jre_home 172 + File.separator + "bin" 173 + File.separator + "java"; 174 String jhat = sdk_home + File.separator + "bin" 175 + File.separator + "jhat"; 176 /* Array of strings to be passed in for exec: 177 * 1. java 178 * 2. -Dtest.classes=. 179 * 3. -d64 (optional) 180 * 4. -Xcheck:jni (Just because it finds bugs) 181 * 5. -Xverify:all (Make sure verification is on full blast) 182 * 6. -agent 183 * vm_options 184 * 7+i. classname 185 */ 186 int nvm_options = 0; 187 if ( vm_options != null ) nvm_options = vm_options.length; 188 String cmd[] = new String[1 + (d64?1:0) + 7 + nvm_options]; 189 int i,j; 190 191 i = 0; 192 cmd[i++] = java; 193 cmd[i++] = "-cp"; 194 cmd[i++] = cdir; 195 cmd[i++] = "-Dtest.classes=" + cdir; 196 if ( d64 ) { 197 cmd[i++] = "-d64"; 198 } 199 cmd[i++] = "-Xcheck:jni"; 200 cmd[i++] = "-Xverify:all"; 201 dumpfile= cdir + File.separator + class_name + ".hdump"; 202 cmd[i++] = "-agentlib:hprof=" + all_hprof_options 203 + ",format=b,file=" + dumpfile; 204 /* Add any special VM options */ 205 for ( j = 0; j < nvm_options; j++ ) { 206 cmd[i++] = vm_options[j]; 207 } 208 /* Add classname */ 209 cmd[i++] = class_name; 210 211 /* Execute process */ 212 execute(cmd); 213 214 /* Run jhat */ 215 String jhat_cmd[] = new String[4]; 216 jhat_cmd[0] = jhat; 217 jhat_cmd[1] = "-debug"; 218 jhat_cmd[2] = "2"; | 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"; |