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=48m gc.metaspace.CompressedClassSpaceSizeInJmapHeap
35+ * @run main/timeout=240 gc.metaspace.CompressedClassSpaceSizeInJmapHeap
3636 */
3737
3838import jdk .test .lib .JDKToolLauncher ;
39+ import jdk .test .lib .apps .LingeredApp ;
3940import jdk .test .lib .process .OutputAnalyzer ;
4041import jdk .test .lib .process .ProcessTools ;
4142import jdk .test .lib .SA .SATestUtils ;
@@ -49,7 +50,9 @@ public class CompressedClassSpaceSizeInJmapHeap {
4950 public static void main (String [] args ) throws Exception {
5051 SATestUtils .skipIfCannotAttach (); // throws SkippedException if attach not expected to work.
5152
52- String pid = Long .toString (ProcessTools .getProcessId ());
53+ LingeredApp theApp = new LingeredApp ();
54+ LingeredApp .startApp (theApp , "-XX:CompressedClassSpaceSize=48m" );
55+ String pid = Long .toString (theApp .getPid ());
5356
5457 JDKToolLauncher jmap = JDKToolLauncher .create ("jhsdb" )
5558 .addToolArg ("jmap" )
@@ -69,6 +72,8 @@ public static void main(String[] args) throws Exception {
6972 OutputAnalyzer output = new OutputAnalyzer (read (out ));
7073 output .shouldContain ("CompressedClassSpaceSize = 50331648 (48.0MB)" );
7174 out .delete ();
75+
76+ LingeredApp .stopApp (theApp );
7277 }
7378
7479 private static void run (ProcessBuilder pb ) throws Exception {
0 commit comments