jdk.testlibrary.OutputAnalyzer Java Examples
The following examples show how to use
jdk.testlibrary.OutputAnalyzer.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ProviderTest.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
/** * Runs the actual tests in the nested class TestMain. * We need to run the tests in a separate process, * because we need to add to the classpath. */ private static void runTests() throws Throwable { final String sep = File.separator; String testClassPath = System.getProperty("test.class.path", ""); String testClasses = System.getProperty("test.classes", "") + sep; String jdkLib = System.getProperty("test.jdk", ".") + sep + "lib" + sep; // Need to add SimpleProvider.jar to classpath. String classpath = testClassPath + File.pathSeparator + testClasses + "SimpleProvider.jar"; String[] args = { "-classpath", classpath, "ProviderTest$TestMain" }; OutputAnalyzer output = ProcessTools.executeTestJvm(args); output.shouldHaveExitValue(0); }
Example #2
Source File: JstatdTest.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
/** * Verifies output form jps contains pids and programs' name information. * The function will discard any lines that come before the first line with pid. * This can happen if the JVM outputs a warning message for some reason * before running jps. * * The output can look like: * 35536 Jstatd * 35417 Main * 31103 org.eclipse.equinox.launcher_1.3.0.v20120522-1813.jar */ private void verifyJpsOutput(OutputAnalyzer output) throws Exception { output.shouldHaveExitValue(0); assertFalse(output.getOutput().isEmpty(), "Output should not be empty"); boolean foundFirstLineWithPid = false; String[] lines = output.getOutput().split(Utils.NEW_LINE); for (String line : lines) { if (!foundFirstLineWithPid) { foundFirstLineWithPid = line.matches(JPS_OUTPUT_REGEX); continue; } assertTrue(line.matches(JPS_OUTPUT_REGEX), "Output does not match the pattern" + Utils.NEW_LINE + line); } assertTrue(foundFirstLineWithPid, "Invalid output"); }
Example #3
Source File: TempDirTest.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
/** * Runs the actual tests in nested class TestMain. * The reason for running the tests in a separate process * is that we need to modify the class path and * the -Djava.io.tmpdir property. */ private static void launchTests(long pid, Path clientTmpDir) throws Throwable { final String sep = File.separator; String classpath = System.getProperty("test.class.path", ""); String[] tmpDirArg = null; if (clientTmpDir != null) { tmpDirArg = new String [] {"-Djava.io.tmpdir=" + clientTmpDir}; } // Arguments : [-Djava.io.tmpdir=] -classpath cp TempDirTest$TestMain pid String[] args = RunnerUtil.concat( tmpDirArg, new String[] { "-classpath", classpath, "TempDirTest$TestMain", Long.toString(pid) }); OutputAnalyzer output = ProcessTools.executeTestJvm(args); output.shouldHaveExitValue(0); }
Example #4
Source File: Utils.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
public static OutputAnalyzer executeKeytoolCommand(String[] command, int exitCode) { String[] keytoolCmd = new String[command.length + 1]; OutputAnalyzer output = null; try { keytoolCmd[0] = JDKToolFinder.getJDKTool(KEYTOOL); System.arraycopy(command, 0, keytoolCmd, 1, command.length); output = ProcessTools.executeCommand(keytoolCmd); output.shouldHaveExitValue(exitCode); out.println("Executed keytool command sucessfully:" + Arrays.toString(keytoolCmd)); } catch (Throwable e) { e.printStackTrace(System.err); throw new RuntimeException("Keytool Command execution failed : " + Arrays.toString(keytoolCmd), e); } return output; }
Example #5
Source File: Utils.java From dragonwell8_jdk with GNU General Public License v2.0 | 6 votes |
public static OutputAnalyzer executeKeytoolCommand(String[] command, int exitCode) { String[] keytoolCmd = new String[command.length + 1]; OutputAnalyzer output = null; try { keytoolCmd[0] = JDKToolFinder.getJDKTool(KEYTOOL); System.arraycopy(command, 0, keytoolCmd, 1, command.length); output = ProcessTools.executeCommand(keytoolCmd); output.shouldHaveExitValue(exitCode); out.println("Executed keytool command sucessfully:" + Arrays.toString(keytoolCmd)); } catch (Throwable e) { e.printStackTrace(System.err); throw new RuntimeException("Keytool Command execution failed : " + Arrays.toString(keytoolCmd), e); } return output; }
Example #6
Source File: JstatdTest.java From openjdk-8-source with GNU General Public License v2.0 | 6 votes |
/** * Parse pid from jps output */ private String parsePid(String tool, OutputAnalyzer output) throws Exception { String[] lines = output.getOutput().split(Utils.NEW_LINE); String pid = null; int count = 0; String processName = tool; if (tool == "rmiregistry") { processName = "registryimpl"; } for (String line : lines) { if (line.toLowerCase().matches("^\\d+\\s{1}" + processName + "$")) { pid = line.split(" ")[0]; count++; } } if (count > 1) { throw new Exception("Expected one " + tool + " process, got " + count + ". Test will be canceled."); } return pid; }
Example #7
Source File: TestJpsJar.java From jdk8u_jdk with GNU General Public License v2.0 | 6 votes |
public static void main(String[] args) throws Throwable { String testJdk = System.getProperty("test.jdk", "?"); String testSrc = System.getProperty("test.src", "?"); File jar = JpsHelper.buildJar("JpsBase"); List<String> cmd = new ArrayList<>(); cmd.addAll(JpsHelper.getVmArgs()); cmd.add("-Dtest.jdk=" + testJdk); cmd.add("-Dtest.src=" + testSrc); cmd.add("-jar"); cmd.add(jar.getAbsolutePath()); cmd.add("monkey"); ProcessBuilder processBuilder = ProcessTools.createJavaProcessBuilder(cmd.toArray(new String[cmd.size()])); OutputAnalyzer output = new OutputAnalyzer(processBuilder.start()); System.out.println(output.getOutput()); output.shouldHaveExitValue(0); }
Example #8
Source File: BasicTests.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
/** * Runs the actual tests in nested class TestMain. * The reason for running the tests in a separate process * is that we need to modify the class path. */ private static void runTests(long pid) throws Throwable { final String sep = File.separator; // Need to add jdk/lib/tools.jar to classpath. String classpath = System.getProperty("test.class.path", ""); String testClassDir = System.getProperty("test.classes", "") + sep; // Argumenta : -classpath cp BasicTests$TestMain pid agent badagent redefineagent String[] args = { "-classpath", classpath, "BasicTests$TestMain", Long.toString(pid), testClassDir + "Agent.jar", testClassDir + "BadAgent.jar", testClassDir + "RedefineAgent.jar" }; OutputAnalyzer output = ProcessTools.executeTestJvm(args); output.shouldHaveExitValue(0); }
Example #9
Source File: JstatdTest.java From dragonwell8_jdk with GNU General Public License v2.0 | 6 votes |
/** * Depending on test settings command line can look like: * * jps -J-XX:+UsePerfData hostname * jps -J-XX:+UsePerfData hostname:port * jps -J-XX:+UsePerfData hostname/serverName * jps -J-XX:+UsePerfData hostname:port/serverName */ private OutputAnalyzer runJps() throws Exception { JDKToolLauncher launcher = JDKToolLauncher.createUsingTestJDK("jps"); launcher.addVMArg("-XX:+UsePerfData"); // Run jps with -v flag to obtain -Dparent.pid.<pid> launcher.addToolArg("-v"); launcher.addToolArg(getDestination()); String[] cmd = launcher.getCommand(); log("Start jps", cmd); ProcessBuilder processBuilder = new ProcessBuilder(cmd); OutputAnalyzer output = new OutputAnalyzer(processBuilder.start()); System.out.println(output.getOutput()); return output; }
Example #10
Source File: TimestampCheck.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
static OutputAnalyzer signVerbose( String path, // TSA URL path String oldJar, String newJar, String alias, // signer String...extra) throws Exception { which++; System.out.println("\n>> Test #" + which); List<String> args = new ArrayList<>(); args.add("-strict"); args.add("-verbose"); args.add("-debug"); args.add("-signedjar"); args.add(newJar); args.add(oldJar); args.add(alias); if (path != null) { args.add("-tsa"); args.add(host + path); } args.addAll(Arrays.asList(extra)); return jarsigner(args); }
Example #11
Source File: JpsHelper.java From hottub with GNU General Public License v2.0 | 6 votes |
/** * Start jps utility with VM args and tool arguments */ public static OutputAnalyzer jps(List<String> vmArgs, List<String> toolArgs) throws Exception { JDKToolLauncher launcher = JDKToolLauncher.createUsingTestJDK("jps"); if (vmArgs != null) { for (String vmArg : vmArgs) { launcher.addVMArg(vmArg); } } if (toolArgs != null) { for (String toolArg : toolArgs) { launcher.addToolArg(toolArg); } } ProcessBuilder processBuilder = new ProcessBuilder(launcher.getCommand()); System.out.println(Arrays.toString(processBuilder.command().toArray()).replace(",", "")); OutputAnalyzer output = new OutputAnalyzer(processBuilder.start()); System.out.println(output.getOutput()); return output; }
Example #12
Source File: NoPremainAgentTest.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
public static void main(String[] a) throws Exception { String testArgs = String.format( "-javaagent:NoPremainAgent.jar -classpath %s DummyMain", System.getProperty("test.classes", ".")); ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( Utils.addTestJavaOpts(testArgs.split("\\s+"))); System.out.println("testjvm.cmd:" + Utils.getCommandLine(pb)); OutputAnalyzer output = new OutputAnalyzer(pb.start()); System.out.println("testjvm.stdout:" + output.getStdout()); System.out.println("testjvm.stderr:" + output.getStderr()); output.stderrShouldContain("java.lang.NoSuchMethodException"); if (0 == output.getExitValue()) { throw new RuntimeException("Expected error but got exit value 0"); } }
Example #13
Source File: JstatdTest.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 6 votes |
/** * Verifies output form jps contains pids and programs' name information. * The function will discard any lines that come before the first line with pid. * This can happen if the JVM outputs a warning message for some reason * before running jps. * * The output can look like: * 35536 Jstatd * 35417 Main * 31103 org.eclipse.equinox.launcher_1.3.0.v20120522-1813.jar */ private void verifyJpsOutput(OutputAnalyzer output) throws Exception { output.shouldHaveExitValue(0); assertFalse(output.getOutput().isEmpty(), "Output should not be empty"); boolean foundFirstLineWithPid = false; String[] lines = output.getOutput().split(Utils.NEW_LINE); for (String line : lines) { if (!foundFirstLineWithPid) { foundFirstLineWithPid = line.matches(JPS_OUTPUT_REGEX); continue; } assertTrue(line.matches(JPS_OUTPUT_REGEX), "Output does not match the pattern" + Utils.NEW_LINE + line); } assertTrue(foundFirstLineWithPid, "Invalid output"); }
Example #14
Source File: NoPremainAgentTest.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
public static void main(String[] a) throws Exception { String testArgs = String.format( "-javaagent:NoPremainAgent.jar -classpath %s DummyMain", System.getProperty("test.classes", ".")); ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( Utils.addTestJavaOpts(testArgs.split("\\s+"))); System.out.println("testjvm.cmd:" + Utils.getCommandLine(pb)); OutputAnalyzer output = new OutputAnalyzer(pb.start()); System.out.println("testjvm.stdout:" + output.getStdout()); System.out.println("testjvm.stderr:" + output.getStderr()); output.stderrShouldContain("java.lang.NoSuchMethodException"); if (0 == output.getExitValue()) { throw new RuntimeException("Expected error but got exit value 0"); } }
Example #15
Source File: PremainClassTest.java From openjdk-8-source with GNU General Public License v2.0 | 6 votes |
public static void main(String[] a) throws Exception { String testArgs = String.format( "-javaagent:%s/Agent.jar -classpath %s DummyMain", System.getProperty("test.src"), System.getProperty("test.classes", ".")); ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( Utils.addTestJavaOpts(testArgs.split("\\s+"))); System.out.println("testjvm.cmd:" + Utils.getCommandLine(pb)); OutputAnalyzer output = new OutputAnalyzer(pb.start()); System.out.println("testjvm.stdout:" + output.getStdout()); System.out.println("testjvm.stderr:" + output.getStderr()); output.shouldHaveExitValue(0); output.stdoutShouldContain("premain running"); output.stdoutShouldContain("Hello from DummyMain!"); }
Example #16
Source File: PremainClassTest.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
public static void main(String[] a) throws Exception { String testArgs = String.format( "-javaagent:%s/Agent.jar -classpath %s DummyMain", System.getProperty("test.src"), System.getProperty("test.classes", ".")); ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( Utils.addTestJavaOpts(testArgs.split("\\s+"))); System.out.println("testjvm.cmd:" + Utils.getCommandLine(pb)); OutputAnalyzer output = new OutputAnalyzer(pb.start()); System.out.println("testjvm.stdout:" + output.getStdout()); System.out.println("testjvm.stderr:" + output.getStderr()); output.shouldHaveExitValue(0); output.stdoutShouldContain("premain running"); output.stdoutShouldContain("Hello from DummyMain!"); }
Example #17
Source File: ProviderTest.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
/** * Runs the actual tests in the nested class TestMain. * We need to run the tests in a separate process, * because we need to add to the classpath. */ private static void runTests() throws Throwable { final String sep = File.separator; String testClassPath = System.getProperty("test.class.path", ""); String testClasses = System.getProperty("test.classes", "") + sep; String jdkLib = System.getProperty("test.jdk", ".") + sep + "lib" + sep; // Need to add SimpleProvider.jar and tools.jar to classpath. String classpath = testClassPath + File.pathSeparator + testClasses + "SimpleProvider.jar" + File.pathSeparator + jdkLib + "tools.jar"; String[] args = { "-classpath", classpath, "ProviderTest$TestMain" }; OutputAnalyzer output = ProcessTools.executeTestJvm(args); output.shouldHaveExitValue(0); }
Example #18
Source File: WeakAlg.java From dragonwell8_jdk with GNU General Public License v2.0 | 6 votes |
static void checkGenCRL(String alias, String options, String bad) { OutputAnalyzer oa = kt("-gencrl -alias " + alias + " -id 1 -file " + alias + ".crl " + options); if (bad == null) { oa.shouldNotContain("Warning"); } else { oa.shouldContain("Warning") .shouldMatch("The generated CRL.*" + bad + ".*risk"); } oa = kt("-printcrl -file " + alias + ".crl"); if (bad == null) { oa.shouldNotContain("Warning") .shouldContain("Verified by " + alias + " in keystore") .shouldNotContain("(weak"); } else { oa.shouldContain("Warning:") .shouldMatch("The CRL.*" + bad + ".*risk") .shouldContain("Verified by " + alias + " in keystore") .shouldContain(bad + " (weak)"); } }
Example #19
Source File: BasicTests.java From jdk8u_jdk with GNU General Public License v2.0 | 6 votes |
/** * Runs the actual tests in nested class TestMain. * The reason for running the tests in a separate process * is that we need to modify the class path. */ private static void runTests(int pid) throws Throwable { final String sep = File.separator; // Need to add jdk/lib/tools.jar to classpath. String classpath = System.getProperty("test.class.path", "") + File.pathSeparator + System.getProperty("test.jdk", ".") + sep + "lib" + sep + "tools.jar"; String testClassDir = System.getProperty("test.classes", "") + sep; // Argumenta : -classpath cp BasicTests$TestMain pid agent badagent redefineagent String[] args = { "-classpath", classpath, "BasicTests$TestMain", Integer.toString(pid), testClassDir + "Agent.jar", testClassDir + "BadAgent.jar", testClassDir + "RedefineAgent.jar" }; OutputAnalyzer output = ProcessTools.executeTestJvm(args); output.shouldHaveExitValue(0); }
Example #20
Source File: PremainClassTest.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
public static void main(String[] a) throws Exception { String testArgs = String.format( "-javaagent:%s/Agent.jar -classpath %s DummyMain", System.getProperty("test.src"), System.getProperty("test.classes", ".")); ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( Utils.addTestJavaOpts(testArgs.split("\\s+"))); System.out.println("testjvm.cmd:" + Utils.getCommandLine(pb)); OutputAnalyzer output = new OutputAnalyzer(pb.start()); System.out.println("testjvm.stdout:" + output.getStdout()); System.out.println("testjvm.stderr:" + output.getStderr()); output.shouldHaveExitValue(0); output.stdoutShouldContain("premain running"); output.stdoutShouldContain("Hello from DummyMain!"); }
Example #21
Source File: RunUtil.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
/** * Runs a test in a separate JVM. * command line like: * {test_jdk}/bin/java {defaultopts} -cp {test.class.path} {testopts} main * * {defaultopts} are the default java options set by the framework. * Default GC options in {defaultopts} may be removed. * This is used when the test specifies its own GC options. * * @param main Name of the main class. * @param clearGcOpts true if the default GC options should be removed. * @param testOpts java options specified by the test. */ private static void runTest(String main, boolean clearGcOpts, String... testOpts) throws Throwable { List<String> opts = new ArrayList<>(); opts.add(JDKToolFinder.getJDKTool("java")); opts.addAll(Arrays.asList(Utils.getTestJavaOpts())); opts.add("-cp"); opts.add(System.getProperty("test.class.path", "test.class.path")); opts.add("-XX:+PrintGCDetails"); if (clearGcOpts) { opts = Utils.removeGcOpts(opts); } opts.addAll(Arrays.asList(testOpts)); opts.add(main); OutputAnalyzer output = ProcessTools.executeProcess(opts.toArray(new String[0])); output.shouldHaveExitValue(0); if (output.getStdout().indexOf(successMessage) < 0) { throw new Exception("output missing '" + successMessage + "'"); } }
Example #22
Source File: TestJpsClass.java From hottub with GNU General Public License v2.0 | 6 votes |
public static void main(String[] args) throws Throwable { String testJdk = System.getProperty("test.jdk", "?"); String testSrc = System.getProperty("test.src", "?"); String testClassPath = System.getProperty("test.class.path", "?"); List<String> cmd = new ArrayList<>(); cmd.addAll(JpsHelper.getVmArgs()); cmd.add("-Dtest.jdk=" + testJdk); cmd.add("-Dtest.src=" + testSrc); cmd.add("-cp"); cmd.add(testClassPath); cmd.add("JpsBase"); cmd.add("monkey"); ProcessBuilder processBuilder = ProcessTools.createJavaProcessBuilder(cmd.toArray(new String[cmd.size()])); OutputAnalyzer output = new OutputAnalyzer(processBuilder.start()); System.out.println(output.getOutput()); output.shouldHaveExitValue(0); }
Example #23
Source File: TestJpsJarRelative.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
public static void main(String[] args) throws Throwable { String testJdk = System.getProperty("test.jdk", "?"); String testSrc = System.getProperty("test.src", "?"); File jar = JpsHelper.buildJar("JpsBase"); List<String> cmd = new ArrayList<>(); cmd.addAll(JpsHelper.getVmArgs()); cmd.add("-Dtest.jdk=" + testJdk); cmd.add("-Dtest.src=" + testSrc); cmd.add("-jar"); cmd.add("." + File.separator + jar.getName()); cmd.add("monkey"); ProcessBuilder processBuilder = ProcessTools.createJavaProcessBuilder(cmd.toArray(new String[cmd.size()])); OutputAnalyzer output = new OutputAnalyzer(processBuilder.start()); System.out.println(output.getOutput()); output.shouldHaveExitValue(0); }
Example #24
Source File: Test.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
protected void checkVerifying(OutputAnalyzer analyzer, int expectedExitCode, String... warnings) { analyzer.shouldHaveExitValue(expectedExitCode); int count = 0; for (String warning : warnings) { if (warning.startsWith("!")) { analyzer.shouldNotContain(warning.substring(1)); } else { count++; analyzer.shouldContain(warning); } } if (count > 0) { analyzer.shouldMatch(WARNING_OR_ERROR); } if (expectedExitCode == 0) { analyzer.shouldContain(JAR_VERIFIED); } else { analyzer.shouldContain(JAR_VERIFIED_WITH_SIGNER_ERRORS); } }
Example #25
Source File: TempDirTest.java From dragonwell8_jdk with GNU General Public License v2.0 | 6 votes |
/** * Runs the actual tests in nested class TestMain. * The reason for running the tests in a separate process * is that we need to modify the class path and * the -Djava.io.tmpdir property. */ private static void launchTests(int pid, Path clientTmpDir) throws Throwable { final String sep = File.separator; // Need to add jdk/lib/tools.jar to classpath. String classpath = System.getProperty("test.class.path", "") + File.pathSeparator + System.getProperty("test.jdk", ".") + sep + "lib" + sep + "tools.jar"; String[] tmpDirArg = null; if (clientTmpDir != null) { tmpDirArg = new String [] {"-Djava.io.tmpdir=" + clientTmpDir}; } // Arguments : [-Djava.io.tmpdir=] -classpath cp TempDirTest$TestMain pid String[] args = RunnerUtil.concat( tmpDirArg, new String[] { "-classpath", classpath, "TempDirTest$TestMain", Integer.toString(pid) }); OutputAnalyzer output = ProcessTools.executeTestJvm(args); output.shouldHaveExitValue(0); }
Example #26
Source File: JstatdTest.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
/** * Parse pid from jps output */ private String parsePid(String tool, OutputAnalyzer output) throws Exception { String[] lines = output.getOutput().split(Utils.NEW_LINE); String pid = null; int count = 0; String processName = tool; if (tool == "rmiregistry") { processName = "registryimpl"; } Pattern toolInJpsPattern = Pattern.compile("^\\d+\\s{1}" + processName + "\\s{1}.*-dparent\\.pid\\." + ProcessTools.getProcessId() + ".*"); for (String line : lines) { if (toolInJpsPattern.matcher(line.toLowerCase()).matches()) { pid = line.split(" ")[0]; count++; } } if (count > 1) { throw new Exception("Expected one " + tool + " process, got " + count + ". Test will be canceled."); } return pid; }
Example #27
Source File: SuspendNoFlagTest.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
public static void main(String[] args) throws Throwable { OutputAnalyzer output = ProcessTools.executeTestJvm("-classpath", TEST_CLASSES, "-agentlib:jdwp=transport=dt_socket,server=y,suspend=n", "HelloWorld"); output.shouldHaveExitValue(0); }
Example #28
Source File: TestJstatdUsage.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
private static void testUsage(String option) throws Exception { JDKToolLauncher launcher = JDKToolLauncher.createUsingTestJDK("jstatd"); launcher.addToolArg(option); ProcessBuilder processBuilder = new ProcessBuilder(launcher.getCommand()); OutputAnalyzer output = new OutputAnalyzer(processBuilder.start()); output.shouldContain("usage: jstatd [-nr] [-p port] [-n rminame]"); output.shouldHaveExitValue(1); }
Example #29
Source File: PostThruProxy.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
private static String getHostname() { try { OutputAnalyzer oa = ProcessTools.executeCommand("hostname"); return oa.getOutput().trim(); } catch (Throwable e) { throw new RuntimeException("Get hostname failed.", e); } }
Example #30
Source File: TestJcmdSanity.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
/** * jcmd -J-XX:+UsePerfData pid help */ private static void testJcmdPidHelp() throws Exception { OutputAnalyzer output = JcmdBase.jcmd(VM_ARGS, new String[] {"help"}); output.shouldHaveExitValue(0); output.shouldNotContain("Exception"); output.shouldContain(Integer.toString(ProcessTools.getProcessId()) + ":"); matchJcmdCommands(output); output.shouldContain("For more information about a specific command use 'help <command>'."); }