test/gc/metaspace/ClassMetaspaceSizeInJmapHeap.java

Print this page
rev 4236 : 8009408: gc/metaspace/ClassMetaspaceSizeInJmapHeap.java fails with "exit code 1"

@@ -23,26 +23,30 @@
 
 /*
  * @test ClassMetaspaceSizeInJmapHeap
  * @bug 8004924
  * @summary Checks that jmap -heap contains the flag ClassMetaspaceSize
- * @library /testlibrary
+ * @library /testlibrary /gc/testlibrary
  * @run main/othervm -XX:ClassMetaspaceSize=50m ClassMetaspaceSizeInJmapHeap
  */
 
 import com.oracle.java.testlibrary.*;
+import com.oracle.java.testlibrary.gc.*;
+
 import java.nio.file.*;
 import java.io.File;
 import java.nio.charset.Charset;
 import java.util.List;
 
 public class ClassMetaspaceSizeInJmapHeap {
     public static void main(String[] args) throws Exception {
         String pid = Integer.toString(ProcessTools.getProcessId());
 
-        ProcessBuilder pb = new ProcessBuilder();
-        pb.command(JDKToolFinder.getJDKTool("jmap"), "-heap",  pid);
+        JmapLauncher jmap = new JmapLauncher();
+        jmap.setJmapArguments("-heap", pid);
+
+        ProcessBuilder pb = new ProcessBuilder(jmap.getCommand());
 
         File out = new File("ClassMetaspaceSizeInJmapHeap.stdout.txt");
         pb.redirectOutput(out);
 
         File err = new File("ClassMetaspaceSizeInJmapHeap.stderr.txt");