11/*
2- * Copyright (c) 2013, 2020 , Oracle and/or its affiliates. All rights reserved.
2+ * Copyright (c) 2013, 2022 , Oracle and/or its affiliates. All rights reserved.
33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44 *
55 * This code is free software; you can redistribute it and/or modify it
3232 * @library /test/lib
3333 * @modules java.base/jdk.internal.misc
3434 * java.management
35- * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:CompressedClassSpaceSize=50m gc.metaspace.CompressedClassSpaceSizeInJmapHeap
35+ * @run main/timeout=240 gc.metaspace.CompressedClassSpaceSizeInJmapHeap
3636 */
3737
3838import jdk .test .lib .JDKToolLauncher ;
3939import jdk .test .lib .Platform ;
40+ import jdk .test .lib .apps .LingeredApp ;
4041import jdk .test .lib .process .OutputAnalyzer ;
4142import jdk .test .lib .process .ProcessTools ;
4243import jdk .test .lib .SA .SATestUtils ;
@@ -55,7 +56,9 @@ public static void main(String[] args) throws Exception {
5556 return ;
5657 }
5758
58- String pid = Long .toString (ProcessTools .getProcessId ());
59+ LingeredApp theApp = new LingeredApp ();
60+ LingeredApp .startApp (List .of ("-XX:CompressedClassSpaceSize=50m" ), theApp );
61+ String pid = Long .toString (theApp .getPid ());
5962
6063 JDKToolLauncher jmap = JDKToolLauncher .create ("jhsdb" )
6164 .addToolArg ("jmap" )
@@ -75,6 +78,8 @@ public static void main(String[] args) throws Exception {
7578 OutputAnalyzer output = new OutputAnalyzer (read (out ));
7679 output .shouldContain ("CompressedClassSpaceSize = 52428800 (50.0MB)" );
7780 out .delete ();
81+
82+ LingeredApp .stopApp (theApp );
7883 }
7984
8085 private static void run (ProcessBuilder pb ) throws Exception {
0 commit comments