Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/openjdk-multiarch-jdk8u
Path: blob/aarch64-shenandoah-jdk8u272-b10/hotspot/test/gc/shenandoah/options/TestVerboseGC.java
32285 views
1
/*
2
* Copyright (c) 2017, 2018, Red Hat, Inc. All rights reserved.
3
*
4
* This code is free software; you can redistribute it and/or modify it
5
* under the terms of the GNU General Public License version 2 only, as
6
* published by the Free Software Foundation.
7
*
8
* This code is distributed in the hope that it will be useful, but WITHOUT
9
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
11
* version 2 for more details (a copy is included in the LICENSE file that
12
* accompanied this code).
13
*
14
* You should have received a copy of the GNU General Public License version
15
* 2 along with this work; if not, write to the Free Software Foundation,
16
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
17
*
18
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
19
* or visit www.oracle.com if you need additional information or have any
20
* questions.
21
*
22
*/
23
24
/*
25
* @test TestVerboseGC
26
* @summary Test that Shenandoah reacts properly on -verbose:gc
27
* @key gc
28
* @library /testlibrary
29
*
30
* @run driver TestVerboseGC
31
*/
32
33
import com.oracle.java.testlibrary.*;
34
35
public class TestVerboseGC {
36
static volatile Object sink;
37
38
public static void main(String[] args) throws Exception {
39
if (args.length > 0) {
40
for (int c = 0; c < 1_000; c++) {
41
sink = new byte[1_000_000];
42
Thread.sleep(1);
43
}
44
return;
45
}
46
47
{
48
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:+UnlockExperimentalVMOptions",
49
"-XX:+UseShenandoahGC",
50
"-Xmx128m",
51
TestVerboseGC.class.getName(),
52
"test");
53
OutputAnalyzer output = new OutputAnalyzer(pb.start());
54
output.shouldNotContain("Concurrent marking");
55
output.shouldNotContain("Collectable Garbage");
56
output.shouldNotContain("GC STATISTICS");
57
output.shouldHaveExitValue(0);
58
}
59
60
{
61
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:+UnlockExperimentalVMOptions",
62
"-XX:+UseShenandoahGC",
63
"-Xmx128m",
64
"-verbose:gc",
65
TestVerboseGC.class.getName(),
66
"test");
67
OutputAnalyzer output = new OutputAnalyzer(pb.start());
68
output.shouldContain("Concurrent marking");
69
output.shouldNotContain("Collectable Garbage");
70
output.shouldContain("GC STATISTICS");
71
output.shouldHaveExitValue(0);
72
}
73
74
{
75
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:+UnlockExperimentalVMOptions",
76
"-XX:+UseShenandoahGC",
77
"-Xmx128m",
78
"-XX:+PrintGC",
79
TestVerboseGC.class.getName(),
80
"test");
81
OutputAnalyzer output = new OutputAnalyzer(pb.start());
82
output.shouldContain("Concurrent marking");
83
output.shouldNotContain("Collectable Garbage");
84
output.shouldContain("GC STATISTICS");
85
output.shouldHaveExitValue(0);
86
}
87
88
{
89
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:+UnlockExperimentalVMOptions",
90
"-XX:+UseShenandoahGC",
91
"-Xmx128m",
92
"-XX:+PrintGCDetails",
93
TestVerboseGC.class.getName(),
94
"test");
95
OutputAnalyzer output = new OutputAnalyzer(pb.start());
96
output.shouldContain("Concurrent marking");
97
output.shouldContain("Collectable Garbage");
98
output.shouldContain("GC STATISTICS");
99
output.shouldHaveExitValue(0);
100
}
101
}
102
}
103
104