< prev index next >

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

Print this page

 71             File classFile = new File(APP_SLASH_CLASSNAME + ".class");
 72             if (!classFile.exists()) {
 73                 throw new RuntimeException("FAILED: Cannot find dumped .class file");
 74             }
 75 
 76             // Run javap on the generated class file to make sure it's valid.
 77             JDKToolLauncher launcher = JDKToolLauncher.createUsingTestJDK("javap");
 78             launcher.addVMArgs(Utils.getTestJavaOpts());
 79             // Let javap print additional info, e.g., StackMapTable
 80             launcher.addToolArg("-verbose");
 81             launcher.addToolArg(classFile.toString());
 82             System.out.println("> javap " + classFile.toString());
 83             List<String> cmdStringList = Arrays.asList(launcher.getCommand());
 84             ProcessBuilder pb = new ProcessBuilder(cmdStringList);
 85             Process javap = pb.start();
 86             OutputAnalyzer out = new OutputAnalyzer(javap);
 87             javap.waitFor();
 88             System.out.println(out.getStdout());
 89             System.err.println(out.getStderr());
 90             out.shouldHaveExitValue(0);
 91             out.shouldMatch("public class " + APP_DOT_CLASSNAME);
 92             // StackMapTable might not be generated for a class
 93             // containing only methods with sequential control flows.
 94             // But the class used here (LingeredApp) is not such a case.
 95             out.shouldContain("StackMapTable:");
 96             out.shouldContain("BootstrapMethods:");
 97             out.shouldNotContain("Error:");
 98         } catch (SkippedException se) {
 99             throw se;
100         } catch (Exception ex) {
101             throw new RuntimeException("Test ERROR " + ex, ex);
102         } finally {
103             LingeredApp.stopApp(theApp);
104         }
105         System.out.println("Test PASSED");
106     }
107 }

 71             File classFile = new File(APP_SLASH_CLASSNAME + ".class");
 72             if (!classFile.exists()) {
 73                 throw new RuntimeException("FAILED: Cannot find dumped .class file");
 74             }
 75 
 76             // Run javap on the generated class file to make sure it's valid.
 77             JDKToolLauncher launcher = JDKToolLauncher.createUsingTestJDK("javap");
 78             launcher.addVMArgs(Utils.getTestJavaOpts());
 79             // Let javap print additional info, e.g., StackMapTable
 80             launcher.addToolArg("-verbose");
 81             launcher.addToolArg(classFile.toString());
 82             System.out.println("> javap " + classFile.toString());
 83             List<String> cmdStringList = Arrays.asList(launcher.getCommand());
 84             ProcessBuilder pb = new ProcessBuilder(cmdStringList);
 85             Process javap = pb.start();
 86             OutputAnalyzer out = new OutputAnalyzer(javap);
 87             javap.waitFor();
 88             System.out.println(out.getStdout());
 89             System.err.println(out.getStderr());
 90             out.shouldHaveExitValue(0);
 91             out.shouldMatch("public identity class " + APP_DOT_CLASSNAME);
 92             // StackMapTable might not be generated for a class
 93             // containing only methods with sequential control flows.
 94             // But the class used here (LingeredApp) is not such a case.
 95             out.shouldContain("StackMapTable:");
 96             out.shouldContain("BootstrapMethods:");
 97             out.shouldNotContain("Error:");
 98         } catch (SkippedException se) {
 99             throw se;
100         } catch (Exception ex) {
101             throw new RuntimeException("Test ERROR " + ex, ex);
102         } finally {
103             LingeredApp.stopApp(theApp);
104         }
105         System.out.println("Test PASSED");
106     }
107 }
< prev index next >