Search in sources :

Example 41 with OutputAnalyzer

use of jdk.testlibrary.OutputAnalyzer in project jdk8u_jdk by JetBrains.

the class TestJcmdSanity method testJcmdPidHelpHelp.

/**
     * jcmd -J-XX:+UsePerfData pid help help
     */
private static void testJcmdPidHelpHelp() throws Exception {
    OutputAnalyzer output = JcmdBase.jcmd(VM_ARGS, new String[] { "help", "help" });
    output.shouldHaveExitValue(0);
    verifyOutputAgainstFile(output);
}
Also used : OutputAnalyzer(jdk.testlibrary.OutputAnalyzer)

Example 42 with OutputAnalyzer

use of jdk.testlibrary.OutputAnalyzer in project jdk8u_jdk by JetBrains.

the class TestJcmdSanity method testJcmdPid_f.

/**
     * jcmd -J-XX:+UsePerfData pid -f dcmd-script.txt
     */
private static void testJcmdPid_f() throws Exception {
    File scrpitFile = new File(TEST_SRC, "dcmd-script.txt");
    OutputAnalyzer output = JcmdBase.jcmd(VM_ARGS, new String[] { "-f", scrpitFile.getAbsolutePath() });
    output.shouldHaveExitValue(0);
    verifyOutputAgainstFile(output);
}
Also used : OutputAnalyzer(jdk.testlibrary.OutputAnalyzer) File(java.io.File)

Example 43 with OutputAnalyzer

use of jdk.testlibrary.OutputAnalyzer in project jdk8u_jdk by JetBrains.

the class JstatdTest method runToolsAndVerify.

private void runToolsAndVerify() throws Exception {
    OutputAnalyzer output = runJps();
    verifyJpsOutput(output);
    output = runJstat();
    verifyJstatOutput(output);
}
Also used : OutputAnalyzer(jdk.testlibrary.OutputAnalyzer)

Example 44 with OutputAnalyzer

use of jdk.testlibrary.OutputAnalyzer in project jdk8u_jdk by JetBrains.

the class TestJstatdUsage method testUsage.

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);
}
Also used : JDKToolLauncher(jdk.testlibrary.JDKToolLauncher) OutputAnalyzer(jdk.testlibrary.OutputAnalyzer)

Example 45 with OutputAnalyzer

use of jdk.testlibrary.OutputAnalyzer in project jdk8u_jdk by JetBrains.

the class TestJpsJarRelative method main.

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);
}
Also used : ArrayList(java.util.ArrayList) OutputAnalyzer(jdk.testlibrary.OutputAnalyzer) File(java.io.File)

Aggregations

OutputAnalyzer (jdk.testlibrary.OutputAnalyzer)54 File (java.io.File)5 JDKToolLauncher (jdk.testlibrary.JDKToolLauncher)5 ArrayList (java.util.ArrayList)4 PortUnreachableException (java.net.PortUnreachableException)1 LocateRegistry (java.rmi.registry.LocateRegistry)1 Registry (java.rmi.registry.Registry)1 KeyStore (java.security.KeyStore)1 X509Certificate (java.security.cert.X509Certificate)1 Date (java.util.Date)1 HashMap (java.util.HashMap)1 List (java.util.List)1 MissingResourceException (java.util.MissingResourceException)1 ProcessThread (jdk.testlibrary.ProcessThread)1