51
52 static int caseCount = 0;
53
54 // run_reloc - force relocation of archive during run time?
55 // Note: relocation always happens during dumping.
56 static void test(boolean run_reloc) throws Exception {
57 caseCount += 1;
58 System.out.println("============================================================");
59 System.out.println("case = " + caseCount + ", run_reloc = " + run_reloc);
60 System.out.println("============================================================");
61
62 String appJar = ClassFileInstaller.getJarPath("hello.jar");
63 String mainClass = "Hello";
64 String forceRelocation = "-XX:ArchiveRelocationMode=1";
65 String runRelocArg = run_reloc ? forceRelocation : "-showversion";
66 String logArg = "-Xlog:cds=debug,cds+reloc=debug,cds+heap";
67 String unlockArg = "-XX:+UnlockDiagnosticVMOptions";
68 String nmtArg = "-XX:NativeMemoryTracking=detail";
69
70 OutputAnalyzer out = TestCommon.dump(appJar,
71 TestCommon.list(mainClass),
72 unlockArg, logArg, nmtArg);
73 out.shouldContain("Relocating archive from");
74
75 TestCommon.run("-cp", appJar, unlockArg, runRelocArg, logArg, mainClass)
76 .assertNormalExit(output -> {
77 if (run_reloc) {
78 output.shouldContain("Try to map archive(s) at an alternative address");
79 }
80 });
81 }
82 }
|
51
52 static int caseCount = 0;
53
54 // run_reloc - force relocation of archive during run time?
55 // Note: relocation always happens during dumping.
56 static void test(boolean run_reloc) throws Exception {
57 caseCount += 1;
58 System.out.println("============================================================");
59 System.out.println("case = " + caseCount + ", run_reloc = " + run_reloc);
60 System.out.println("============================================================");
61
62 String appJar = ClassFileInstaller.getJarPath("hello.jar");
63 String mainClass = "Hello";
64 String forceRelocation = "-XX:ArchiveRelocationMode=1";
65 String runRelocArg = run_reloc ? forceRelocation : "-showversion";
66 String logArg = "-Xlog:cds=debug,cds+reloc=debug,cds+heap";
67 String unlockArg = "-XX:+UnlockDiagnosticVMOptions";
68 String nmtArg = "-XX:NativeMemoryTracking=detail";
69
70 OutputAnalyzer out = TestCommon.dump(appJar,
71 TestCommon.list(mainClass),
72 unlockArg, logArg, nmtArg);
73 out.shouldContain("Relocating archive from");
74
75 TestCommon.run("-cp", appJar, unlockArg, runRelocArg, logArg, mainClass)
76 .assertNormalExit(output -> {
77 if (run_reloc) {
78 output.shouldContain("Try to map archive(s) at an alternative address");
79 }
80 });
81 }
82 }
|