59 } 60 if (Files.notExists(Paths.get("jtreg_classes", "jdk", "test", "lib", "apps", "LingeredApp.class"))) { 61 throw new RuntimeException("jtreg_classes/jdk/test/lib/apps/LingeredApp.class not found"); 62 } 63 if (Files.notExists(Paths.get("jtreg_classes", "sun", "net", "util", "URLUtil.class"))) { 64 throw new RuntimeException("jtreg_classes/sun/net/util/URLUtil.class not found"); 65 } 66 67 pb = ProcessTools.createJavaProcessBuilder( 68 "-Dsun.jvm.hotspot.tools.jcore.outputDir=jtreg_classes2", 69 "-Dsun.jvm.hotspot.tools.jcore.PackageNameFilter.pkgList=jdk,sun", 70 "-m", "jdk.hotspot.agent/sun.jvm.hotspot.tools.jcore.ClassDump", String.valueOf(lingeredAppPid)); 71 output = new OutputAnalyzer(pb.start()); 72 output.shouldHaveExitValue(0); 73 if (Files.exists(Paths.get("jtreg_classes2", "java", "math", "BigInteger.class"))) { 74 throw new RuntimeException("jtreg_classes2/java/math/BigInteger.class not expected"); 75 } 76 if (Files.notExists(Paths.get("jtreg_classes2", "sun", "util", "calendar", "BaseCalendar.class"))) { 77 throw new RuntimeException("jtreg_classes2/sun/util/calendar/BaseCalendar.class not found"); 78 } 79 if (Files.notExists(Paths.get("jtreg_classes2", "jdk", "internal", "vm", "PostVMInitHook.class"))) { 80 throw new RuntimeException("jtreg_classes2/jdk/internal/vm/PostVMInitHook.class not found"); 81 } 82 } 83 84 public static void main(String[] args) throws Exception { 85 if (!Platform.shouldSAAttach()) { 86 // Silently skip the test if we don't have enough permissions to attach 87 System.out.println("SA attach not expected to work - test skipped."); 88 return; 89 } 90 91 LingeredApp theApp = null; 92 try { 93 theApp = LingeredApp.startApp(); 94 long pid = theApp.getPid(); 95 System.out.println("Started LingeredApp with pid " + pid); 96 dumpClass(pid); 97 } catch (Exception ex) { 98 throw new RuntimeException("Test ERROR " + ex, ex); 99 } finally { 100 LingeredApp.stopApp(theApp); | 59 } 60 if (Files.notExists(Paths.get("jtreg_classes", "jdk", "test", "lib", "apps", "LingeredApp.class"))) { 61 throw new RuntimeException("jtreg_classes/jdk/test/lib/apps/LingeredApp.class not found"); 62 } 63 if (Files.notExists(Paths.get("jtreg_classes", "sun", "net", "util", "URLUtil.class"))) { 64 throw new RuntimeException("jtreg_classes/sun/net/util/URLUtil.class not found"); 65 } 66 67 pb = ProcessTools.createJavaProcessBuilder( 68 "-Dsun.jvm.hotspot.tools.jcore.outputDir=jtreg_classes2", 69 "-Dsun.jvm.hotspot.tools.jcore.PackageNameFilter.pkgList=jdk,sun", 70 "-m", "jdk.hotspot.agent/sun.jvm.hotspot.tools.jcore.ClassDump", String.valueOf(lingeredAppPid)); 71 output = new OutputAnalyzer(pb.start()); 72 output.shouldHaveExitValue(0); 73 if (Files.exists(Paths.get("jtreg_classes2", "java", "math", "BigInteger.class"))) { 74 throw new RuntimeException("jtreg_classes2/java/math/BigInteger.class not expected"); 75 } 76 if (Files.notExists(Paths.get("jtreg_classes2", "sun", "util", "calendar", "BaseCalendar.class"))) { 77 throw new RuntimeException("jtreg_classes2/sun/util/calendar/BaseCalendar.class not found"); 78 } 79 if (Files.notExists(Paths.get("jtreg_classes2", "jdk", "internal", "loader", "BootLoader.class"))) { 80 throw new RuntimeException("jtreg_classes2/jdk/internal/loader/BootLoader.class not found"); 81 } 82 } 83 84 public static void main(String[] args) throws Exception { 85 if (!Platform.shouldSAAttach()) { 86 // Silently skip the test if we don't have enough permissions to attach 87 System.out.println("SA attach not expected to work - test skipped."); 88 return; 89 } 90 91 LingeredApp theApp = null; 92 try { 93 theApp = LingeredApp.startApp(); 94 long pid = theApp.getPid(); 95 System.out.println("Started LingeredApp with pid " + pid); 96 dumpClass(pid); 97 } catch (Exception ex) { 98 throw new RuntimeException("Test ERROR " + ex, ex); 99 } finally { 100 LingeredApp.stopApp(theApp); |