< prev index next >

test/sun/tools/jstack/BasicJStackTest.java

Print this page




  46     }
  47 
  48     private static void testJstackNoArgs() throws Exception {
  49         OutputAnalyzer output = jstack();
  50         output.shouldHaveExitValue(0);
  51     }
  52 
  53     private static void testJstack_l() throws Exception {
  54         OutputAnalyzer output = jstack("-l");
  55         output.shouldHaveExitValue(0);
  56     }
  57 
  58     private static OutputAnalyzer jstack(String... toolArgs) throws Exception {
  59         JDKToolLauncher launcher = JDKToolLauncher.createUsingTestJDK("jstack");
  60         launcher.addVMArg("-XX:+UsePerfData");
  61         if (toolArgs != null) {
  62             for (String toolArg : toolArgs) {
  63                 launcher.addToolArg(toolArg);
  64             }
  65         }
  66         launcher.addToolArg(Integer.toString(ProcessTools.getProcessId()));
  67 
  68         processBuilder.command(launcher.getCommand());
  69         System.out.println(Arrays.toString(processBuilder.command().toArray()).replace(",", ""));
  70         OutputAnalyzer output = ProcessTools.executeProcess(processBuilder);
  71         System.out.println(output.getOutput());
  72 
  73         return output;
  74     }
  75 
  76 }


  46     }
  47 
  48     private static void testJstackNoArgs() throws Exception {
  49         OutputAnalyzer output = jstack();
  50         output.shouldHaveExitValue(0);
  51     }
  52 
  53     private static void testJstack_l() throws Exception {
  54         OutputAnalyzer output = jstack("-l");
  55         output.shouldHaveExitValue(0);
  56     }
  57 
  58     private static OutputAnalyzer jstack(String... toolArgs) throws Exception {
  59         JDKToolLauncher launcher = JDKToolLauncher.createUsingTestJDK("jstack");
  60         launcher.addVMArg("-XX:+UsePerfData");
  61         if (toolArgs != null) {
  62             for (String toolArg : toolArgs) {
  63                 launcher.addToolArg(toolArg);
  64             }
  65         }
  66         launcher.addToolArg(Long.toString(ProcessTools.getProcessId()));
  67 
  68         processBuilder.command(launcher.getCommand());
  69         System.out.println(Arrays.toString(processBuilder.command().toArray()).replace(",", ""));
  70         OutputAnalyzer output = ProcessTools.executeProcess(processBuilder);
  71         System.out.println(output.getOutput());
  72 
  73         return output;
  74     }
  75 
  76 }
< prev index next >