< prev index next >

test/hotspot/jtreg/runtime/appcds/dynamicArchive/NoClassToArchive.java

Print this page

        

@@ -59,25 +59,23 @@
         String topArchiveName = getNewArchiveName("top2");
         String baseArchiveName = getNewArchiveName("base");
         doTestCustomBase(baseArchiveName, topArchiveName);
     }
 
-    private static void checkWarning(OutputAnalyzer output) throws Exception {
-        if (output.getStdout().contains("jrt:/") || output.getStdout().contains("unsafe anonymous")) {
-            System.out.println("test skipped: this platform uses non-archived classes when running -version");
-        } else {
-            output.shouldContain(warningMessage);
-        }
-    }
-
     private static void doTest(String baseArchiveName, String topArchiveName) throws Exception {
         dump2(baseArchiveName, topArchiveName,
              "-Xlog:cds",
              "-Xlog:cds+dynamic=debug",
              "-Xlog:class+load=trace",
              "-version")
-            .assertNormalExit(output -> checkWarning(output));
+            .assertNormalExit(output -> {
+                    if (output.getStdout().contains("jrt:/")) {
+                        System.out.println("test skipped: this platform uses non-archived classes when running -version");
+                    } else {
+                        output.shouldContain(warningMessage);
+                    }
+                });
 
         dump2(baseArchiveName, topArchiveName,
              "-Xlog:cds",
              "-Xlog:cds+dynamic=debug",
              "-Xlog:class+load=trace",

@@ -103,13 +101,11 @@
         // create a custom base archive based on the class list
         dumpBaseArchive(baseArchiveName, "-XX:SharedClassListFile=" + classList);
 
         // create a dynamic archive with the custom base archive
         // no class should be included in the dynamic archive
-        dump2(baseArchiveName, topArchiveName,
-              "-Xlog:cds",
-              "-Xlog:cds+dynamic=debug",
-              "-Xlog:class+load=trace",
-              "-version")
-            .assertNormalExit(out -> checkWarning(out));
+        dump2(baseArchiveName, topArchiveName, "-version")
+            .assertNormalExit(out -> {
+                    out.shouldMatch(warningMessage);
+                });
     }
 }
< prev index next >