/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/* DemoRun:
*
* Support classes for java jvmti demo tests
*
*/
/*
* Helper class to direct process output to a StringBuffer
*/
/* Create MyInputStream that saves all output to a StringBuffer */
}
/* Dump the buffer */
x.println("<end of buffer>");
}
/* Check to see if a pattern is inside the output. */
}
/* Runs as a separate thread capturing all output in a StringBuffer */
public void run() {
try {
byte b[] = new byte[100];
for (;;) {
if (n < 0) {
break;
}
}
}
}
/*
* Main JVMTI Demo Run class.
*/
public class DemoRun {
/* Create a Demo run process */
{
}
/*
* Execute a process with an -agentpath or -agentlib command option
*/
{
}
/*
* Execute a process with an -agentpath or -agentlib command option
* plus any set of other java options.
*/
{
jre_home );
/* Array of strings to be passed in for exec:
* 1. java
* 2. -Dtest.classes=.
* 3. -d64 (optional)
* 4. -Xcheck:jni (Just because it finds bugs)
* 5. -Xverify:all (Make sure verification is on full blast)
* 6. -agent
* vm_options
* 7+i. classname
*/
int nvm_options = 0;
int exitStatus;
int i,j;
i = 0;
cmdLine = "";
cmdLine += " ";
cmdLine += " ";
cmdLine += " ";
if ( d64 ) {
cmdLine += " ";
}
cmdLine += " ";
cmdLine += " ";
if ( hprof ) {
/* Load hprof with -agentlib since it's part of jre */
cmdLine += " ";
} else {
cmdLine += " ";
}
/* Add any special VM options */
for ( j = 0; j < nvm_options; j++ ) {
cmdLine += " ";
}
/* Add classname */
cmdLine += " ";
/* Begin process */
Process p;
try {
} catch ( IOException e ) {
throw new RuntimeException("Test failed - exec got IO exception");
}
/* Save process output in StringBuffers */
/* Wait for process to complete, and if exit code is non-zero we fail */
try {
exitStatus = p.waitFor();
if ( exitStatus != 0) {
throw new RuntimeException("Test failed - " +
"exit return code non-zero " +
}
} catch ( InterruptedException e ) {
throw new RuntimeException("Test failed - process interrupted");
}
}
/* Does the pattern appear in the output of this process */
{
}
}