< prev index next >

test/hotspot/jtreg/runtime/cds/appcds/ArchiveRelocationTest.java

Print this page

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,aot+heap";
68         String unlockArg = "-XX:+UnlockDiagnosticVMOptions";
69         String nmtArg = "-XX:NativeMemoryTracking=detail";
70         String relocMsg1 = "ArchiveRelocationMode == 1: always map archive(s) at an alternative address";
71         String relocMsg2 = "Try to map archive(s) at an alternative address";
72 
73         OutputAnalyzer out = TestCommon.dump(appJar,
74                                              TestCommon.list(mainClass),
75                                              unlockArg, logArg, nmtArg);
76         out.shouldContain("Relocating archive from");
77 
78         TestCommon.run("-cp", appJar, unlockArg, runRelocArg, logArg,  mainClass)
79             .assertNormalExit(output -> {
80                     if (run_reloc) {
81                         if (!output.contains(relocMsg1) && !output.contains(relocMsg2)) {
82                             throw new RuntimeException("Relocation messages \"" + relocMsg1 +
83                                 "\" and \"" + relocMsg2 + "\" are missing from the output");
84                         }
85                     } else {
86                         output.shouldContain("ArchiveRelocationMode: 0");
87                     }
88                 });
89     }
90 }

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,aot+heap";
68         String unlockArg = "-XX:+UnlockDiagnosticVMOptions";
69         String nmtArg = "-XX:NativeMemoryTracking=detail";
70         String relocMsg1 = "ArchiveRelocationMode == 1: always map archive(s) at an alternative address";
71         String relocMsg2 = "Try to map archive(s) at an alternative address";
72 
73         OutputAnalyzer out = TestCommon.dump(appJar,
74                 TestCommon.list(mainClass),
75                 unlockArg, logArg, nmtArg);
76         out.shouldContain("Relocating archive from");
77 
78         TestCommon.run("-cp", appJar, unlockArg, runRelocArg, logArg,  mainClass)
79                 .assertNormalExit(output -> {
80                     if (run_reloc) {
81                         if (!output.contains(relocMsg1) && !output.contains(relocMsg2)) {
82                             throw new RuntimeException("Relocation messages \"" + relocMsg1 +
83                                 "\" and \"" + relocMsg2 + "\" are missing from the output");
84                         }
85                     } else {
86                         output.shouldContain("ArchiveRelocationMode: 0");
87                     }
88                 });
89     }
90 }
< prev index next >