1
1
/*
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.
3
3
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4
4
*
5
5
* This code is free software; you can redistribute it and/or modify it
32
32
* @library /test/lib
33
33
* @modules java.base/jdk.internal.misc
34
34
* java.management
35
- * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:CompressedClassSpaceSize=48m gc.metaspace.CompressedClassSpaceSizeInJmapHeap
35
+ * @run main/timeout=240 gc.metaspace.CompressedClassSpaceSizeInJmapHeap
36
36
*/
37
37
38
38
import jdk .test .lib .JDKToolLauncher ;
39
+ import jdk .test .lib .apps .LingeredApp ;
39
40
import jdk .test .lib .process .OutputAnalyzer ;
40
41
import jdk .test .lib .process .ProcessTools ;
41
42
import jdk .test .lib .SA .SATestUtils ;
@@ -49,7 +50,9 @@ public class CompressedClassSpaceSizeInJmapHeap {
49
50
public static void main (String [] args ) throws Exception {
50
51
SATestUtils .skipIfCannotAttach (); // throws SkippedException if attach not expected to work.
51
52
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 ());
53
56
54
57
JDKToolLauncher jmap = JDKToolLauncher .create ("jhsdb" )
55
58
.addToolArg ("jmap" )
@@ -69,6 +72,8 @@ public static void main(String[] args) throws Exception {
69
72
OutputAnalyzer output = new OutputAnalyzer (read (out ));
70
73
output .shouldContain ("CompressedClassSpaceSize = 50331648 (48.0MB)" );
71
74
out .delete ();
75
+
76
+ LingeredApp .stopApp (theApp );
72
77
}
73
78
74
79
private static void run (ProcessBuilder pb ) throws Exception {
0 commit comments