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