test/hotspot/jtreg/runtime/SharedArchiveFile/NonBootLoaderClasses.java
changeset 52218 111ba072921b
parent 51990 6003e034cdd8
child 53636 962ed57b29c9
--- a/test/hotspot/jtreg/runtime/SharedArchiveFile/NonBootLoaderClasses.java	Mon Oct 22 13:31:42 2018 -0700
+++ b/test/hotspot/jtreg/runtime/SharedArchiveFile/NonBootLoaderClasses.java	Mon Oct 22 14:31:10 2018 -0700
@@ -34,7 +34,6 @@
 import jdk.test.lib.cds.CDSOptions;
 import jdk.test.lib.cds.CDSTestUtils;
 import jdk.test.lib.process.OutputAnalyzer;
-import jdk.test.lib.process.ProcessTools;
 
 public class NonBootLoaderClasses {
     public static void main(String[] args) throws Exception {
@@ -50,16 +49,16 @@
         CDSTestUtils.createArchiveAndCheck(opts);
 
         // Print the shared dictionary and inspect the output
-        ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
-                "-cp", "\"\"",
+        opts = (new CDSOptions())
+            .setUseVersion(false)
+            .addSuffix( "-cp", "\"\"",
                 "-XX:+UnlockDiagnosticVMOptions", "-XX:SharedArchiveFile=./" + archiveName,
                 "-XX:+PrintSharedArchiveAndExit", "-XX:+PrintSharedDictionary");
-        OutputAnalyzer out = CDSTestUtils.executeAndLog(pb, "print-shared-archive");
-        CDSTestUtils.checkMappingFailure(out);
-
-        out.shouldContain("archive is valid")
-            .shouldHaveExitValue(0)               // Should report success in error code.
-            .shouldContain(PLATFORM_CLASS.replace('/', '.'))
-            .shouldContain(APP_CLASS.replace('/', '.'));
+        CDSTestUtils.run(opts)
+            .assertNormalExit(output -> {
+                output.shouldContain("archive is valid");
+                output.shouldContain(PLATFORM_CLASS.replace('/', '.'));
+                output.shouldContain(APP_CLASS.replace('/', '.'));
+            });
    }
 }