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 maybeRelocation = "-XX:ArchiveRelocationMode=0";
65 String alwaysRelocation = "-XX:ArchiveRelocationMode=1";
66 String runRelocArg = run_reloc ? alwaysRelocation : maybeRelocation;
67 String logArg = "-Xlog:cds=debug,cds+reloc=debug,cds+heap";
68 String unlockArg = "-XX:+UnlockDiagnosticVMOptions";
69 String nmtArg = "-XX:NativeMemoryTracking=detail";
70
71 OutputAnalyzer out = TestCommon.dump(appJar,
72 TestCommon.list(mainClass),
73 unlockArg, logArg, nmtArg);
74 out.shouldContain("Relocating archive from");
75
76 TestCommon.run("-cp", appJar, unlockArg, runRelocArg, logArg, mainClass)
77 .assertNormalExit(output -> {
78 if (run_reloc) {
79 output.shouldContain("ArchiveRelocationMode == 1: always map archive(s) at an alternative address")
80 .shouldContain("Try to map archive(s) at an alternative address");
81 } else {
82 output.shouldContain("ArchiveRelocationMode: 0");
83 }
84 });
85 }
86 }
|
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 maybeRelocation = "-XX:ArchiveRelocationMode=0";
65 String alwaysRelocation = "-XX:ArchiveRelocationMode=1";
66 String runRelocArg = run_reloc ? alwaysRelocation : maybeRelocation;
67 String logArg = "-Xlog:cds=debug,cds+reloc=debug,cds+heap";
68 String unlockArg = "-XX:+UnlockDiagnosticVMOptions";
69 String nmtArg = "-XX:NativeMemoryTracking=detail";
70
71 OutputAnalyzer out = TestCommon.dump(appJar,
72 TestCommon.list(mainClass),
73 unlockArg, logArg, nmtArg);
74 out.shouldContain("Relocating archive from");
75
76 TestCommon.run("-cp", appJar, unlockArg, runRelocArg, logArg, mainClass)
77 .assertNormalExit(output -> {
78 if (run_reloc) {
79 output.shouldContain("ArchiveRelocationMode == 1: always map archive(s) at an alternative address")
80 .shouldContain("Try to map archive(s) at an alternative address");
81 } else {
82 output.shouldContain("ArchiveRelocationMode: 0");
83 }
84 });
85 }
86 }
|