< prev index next >

test/hotspot/jtreg/serviceability/sa/ClhsdbJstack.java

Print this page




  21  * questions.
  22  */
  23 
  24 import java.util.HashMap;
  25 import java.util.List;
  26 import java.util.Map;
  27 
  28 import jdk.test.lib.apps.LingeredApp;
  29 import jdk.test.lib.Platform;
  30 
  31 /*
  32  * @test
  33  * @bug 8190198
  34  * @summary Test clhsdb Jstack command
  35  * @library /test/lib
  36  * @run main/othervm ClhsdbJstack
  37  */
  38 
  39 public class ClhsdbJstack {
  40 
  41     public static void main(String[] args) throws Exception {
  42         System.out.println("Starting ClhsdbJstack test");
  43 
  44         LingeredApp theApp = null;
  45         try {
  46             ClhsdbLauncher test = new ClhsdbLauncher();
  47             theApp = LingeredApp.startApp();
  48             System.out.println("Started LingeredApp with pid " + theApp.getPid());





  49 
  50             List<String> cmds = List.of("jstack -v");
  51 
  52             Map<String, List<String>> expStrMap = new HashMap<>();
  53             expStrMap.put("jstack -v", List.of(
  54                     "No deadlocks found",
  55                     "Common-Cleaner",
  56                     "Signal Dispatcher",
  57                     "java.lang.ref.Finalizer$FinalizerThread.run",
  58                     "java.lang.ref.Reference",
  59                     "Method*",
  60                     "LingeredApp.main"));
  61 
  62             test.run(theApp.getPid(), cmds, expStrMap, null);
  63         } catch (Exception ex) {
  64             throw new RuntimeException("Test ERROR " + ex, ex);
  65         } finally {
  66             LingeredApp.stopApp(theApp);
  67         }






  68         System.out.println("Test PASSED");
  69     }
  70 }


  21  * questions.
  22  */
  23 
  24 import java.util.HashMap;
  25 import java.util.List;
  26 import java.util.Map;
  27 
  28 import jdk.test.lib.apps.LingeredApp;
  29 import jdk.test.lib.Platform;
  30 
  31 /*
  32  * @test
  33  * @bug 8190198
  34  * @summary Test clhsdb Jstack command
  35  * @library /test/lib
  36  * @run main/othervm ClhsdbJstack
  37  */
  38 
  39 public class ClhsdbJstack {
  40 
  41     private static void testJstack(boolean withXcomp) throws Exception {


  42         LingeredApp theApp = null;
  43         try {
  44             ClhsdbLauncher test = new ClhsdbLauncher();
  45             theApp = withXcomp ? LingeredApp.startApp(List.of("-Xcomp"))
  46                                : LingeredApp.startApp();
  47             System.out.print("Started LingeredApp ");
  48             if (withXcomp) {
  49                 System.out.print("(-Xcomp) ");
  50             }
  51             System.out.println("with pid " + theApp.getPid());
  52 
  53             List<String> cmds = List.of("jstack -v");
  54 
  55             Map<String, List<String>> expStrMap = new HashMap<>();
  56             expStrMap.put("jstack -v", List.of(
  57                     "No deadlocks found",
  58                     "Common-Cleaner",
  59                     "Signal Dispatcher",
  60                     "java.lang.ref.Finalizer$FinalizerThread.run",
  61                     "java.lang.ref.Reference",
  62                     "Method*",
  63                     "LingeredApp.main"));
  64 
  65             test.run(theApp.getPid(), cmds, expStrMap, null);
  66         } catch (Exception ex) {
  67             throw new RuntimeException("Test ERROR (with -Xcomp=" + withXcomp + ") "+ ex, ex);
  68         } finally {
  69             LingeredApp.stopApp(theApp);
  70         }
  71     }
  72 
  73     public static void main(String[] args) throws Exception {
  74         System.out.println("Starting ClhsdbJstack test");
  75         testJstack(false);
  76         testJstack(true);
  77         System.out.println("Test PASSED");
  78     }
  79 }
< prev index next >