< prev index next >

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

Print this page

        

@@ -36,18 +36,21 @@
  * @run main/othervm ClhsdbJstack
  */
 
 public class ClhsdbJstack {
 
-    public static void main(String[] args) throws Exception {
-        System.out.println("Starting ClhsdbJstack test");
-
+    private static void testJstack(boolean withXcomp) throws Exception {
         LingeredApp theApp = null;
         try {
             ClhsdbLauncher test = new ClhsdbLauncher();
-            theApp = LingeredApp.startApp();
-            System.out.println("Started LingeredApp with pid " + theApp.getPid());
+            theApp = withXcomp ? LingeredApp.startApp(List.of("-Xcomp"))
+                               : LingeredApp.startApp();
+            System.out.print("Started LingeredApp ");
+            if (withXcomp) {
+                System.out.print("(-Xcomp) ");
+            }
+            System.out.println("with pid " + theApp.getPid());
 
             List<String> cmds = List.of("jstack -v");
 
             Map<String, List<String>> expStrMap = new HashMap<>();
             expStrMap.put("jstack -v", List.of(

@@ -59,12 +62,18 @@
                     "Method*",
                     "LingeredApp.main"));
 
             test.run(theApp.getPid(), cmds, expStrMap, null);
         } catch (Exception ex) {
-            throw new RuntimeException("Test ERROR " + ex, ex);
+            throw new RuntimeException("Test ERROR (with -Xcomp=" + withXcomp + ") "+ ex, ex);
         } finally {
             LingeredApp.stopApp(theApp);
         }
+    }
+
+    public static void main(String[] args) throws Exception {
+        System.out.println("Starting ClhsdbJstack test");
+        testJstack(false);
+        testJstack(true);
         System.out.println("Test PASSED");
     }
 }
< prev index next >