Skip to content

Commit b956b89

Browse files
committed
Merge master jdk-17.0.13+6 into openj9-staging
Signed-off-by: J9 Build <[email protected]>
2 parents 81ec611 + 5155c93 commit b956b89

File tree

2 files changed

+163
-0
lines changed

2 files changed

+163
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
/*
2+
* Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved.
3+
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4+
*
5+
* This code is free software; you can redistribute it and/or modify it
6+
* under the terms of the GNU General Public License version 2 only, as
7+
* published by the Free Software Foundation.
8+
*
9+
* This code is distributed in the hope that it will be useful, but WITHOUT
10+
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11+
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12+
* version 2 for more details (a copy is included in the LICENSE file that
13+
* accompanied this code).
14+
*
15+
* You should have received a copy of the GNU General Public License version
16+
* 2 along with this work; if not, write to the Free Software Foundation,
17+
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18+
*
19+
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20+
* or visit www.oracle.com if you need additional information or have any
21+
* questions.
22+
*/
23+
24+
/*
25+
* @test
26+
* @bug 8338139
27+
* @summary Basic unit test of ClassLoadingMXBean.set/isVerbose() when
28+
* related unified logging is enabled.
29+
*
30+
* @run main/othervm -Xlog:class+load=trace:file=vm.log TestVerboseClassLoading false
31+
* @run main/othervm -Xlog:class+load=debug:file=vm.log TestVerboseClassLoading false
32+
* @run main/othervm -Xlog:class+load=info:file=vm.log TestVerboseClassLoading false
33+
*
34+
* @run main/othervm -Xlog:class+load=trace TestVerboseClassLoading false
35+
* @run main/othervm -Xlog:class+load=debug TestVerboseClassLoading false
36+
* @run main/othervm -Xlog:class+load=info TestVerboseClassLoading false
37+
* @run main/othervm -Xlog:class+load=warning TestVerboseClassLoading false
38+
* @run main/othervm -Xlog:class+load=error TestVerboseClassLoading false
39+
* @run main/othervm -Xlog:class+load=off TestVerboseClassLoading false
40+
*
41+
* @run main/othervm -Xlog:class+load*=trace TestVerboseClassLoading true
42+
* @run main/othervm -Xlog:class+load*=debug TestVerboseClassLoading true
43+
* @run main/othervm -Xlog:class+load*=info TestVerboseClassLoading true
44+
* @run main/othervm -Xlog:class+load*=warning TestVerboseClassLoading false
45+
* @run main/othervm -Xlog:class+load*=error TestVerboseClassLoading false
46+
* @run main/othervm -Xlog:class+load*=off TestVerboseClassLoading false
47+
*
48+
* @run main/othervm -Xlog:class+load*=info,class+load=trace TestVerboseClassLoading true
49+
* @run main/othervm -Xlog:class+load*=info,class+load=debug TestVerboseClassLoading true
50+
* @run main/othervm -Xlog:class+load*=info,class+load=info TestVerboseClassLoading true
51+
* @run main/othervm -Xlog:class+load*=info,class+load=warning TestVerboseClassLoading false
52+
* @run main/othervm -Xlog:class+load*=info,class+load=error TestVerboseClassLoading false
53+
* @run main/othervm -Xlog:class+load*=info,class+load=off TestVerboseClassLoading false
54+
*
55+
* @run main/othervm -Xlog:all=trace:file=vm.log TestVerboseClassLoading false
56+
*/
57+
58+
import java.lang.management.ManagementFactory;
59+
import java.lang.management.ClassLoadingMXBean;
60+
61+
public class TestVerboseClassLoading {
62+
63+
public static void main(String[] args) throws Exception {
64+
ClassLoadingMXBean mxBean = ManagementFactory.getClassLoadingMXBean();
65+
boolean expected = Boolean.parseBoolean(args[0]);
66+
boolean initial = mxBean.isVerbose();
67+
if (expected != initial) {
68+
throw new Error("Initial verbosity setting was unexpectedly " + initial);
69+
}
70+
mxBean.setVerbose(false);
71+
if (mxBean.isVerbose()) {
72+
throw new Error("Verbosity was still enabled");
73+
}
74+
mxBean.setVerbose(true);
75+
if (!mxBean.isVerbose()) {
76+
throw new Error("Verbosity was still disabled");
77+
}
78+
// Turn off again as a double-check and also to avoid excessive logging
79+
mxBean.setVerbose(false);
80+
if (mxBean.isVerbose()) {
81+
throw new Error("Verbosity was still enabled");
82+
}
83+
}
84+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
/*
2+
* Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved.
3+
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4+
*
5+
* This code is free software; you can redistribute it and/or modify it
6+
* under the terms of the GNU General Public License version 2 only, as
7+
* published by the Free Software Foundation.
8+
*
9+
* This code is distributed in the hope that it will be useful, but WITHOUT
10+
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11+
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12+
* version 2 for more details (a copy is included in the LICENSE file that
13+
* accompanied this code).
14+
*
15+
* You should have received a copy of the GNU General Public License version
16+
* 2 along with this work; if not, write to the Free Software Foundation,
17+
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18+
*
19+
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20+
* or visit www.oracle.com if you need additional information or have any
21+
* questions.
22+
*/
23+
24+
/*
25+
* @test
26+
* @bug 8338139
27+
* @summary Basic unit test of TestVerboseMemory.set/isVerbose() when
28+
* related unified logging is enabled.
29+
*
30+
* @run main/othervm -Xlog:gc=trace:file=vm.log TestVerboseMemory false
31+
* @run main/othervm -Xlog:gc=debug:file=vm.log TestVerboseMemory false
32+
* @run main/othervm -Xlog:gc=info:file=vm.log TestVerboseMemory false
33+
*
34+
* @run main/othervm -Xlog:gc=off TestVerboseMemory false
35+
* @run main/othervm -Xlog:gc=error TestVerboseMemory false
36+
* @run main/othervm -Xlog:gc=warning TestVerboseMemory false
37+
*
38+
* @run main/othervm -Xlog:gc=info TestVerboseMemory true
39+
* @run main/othervm -Xlog:gc=trace TestVerboseMemory true
40+
* @run main/othervm -Xlog:gc=debug TestVerboseMemory true
41+
*
42+
* @run main/othervm -Xlog:gc*=info TestVerboseMemory true
43+
* @run main/othervm -Xlog:gc*=debug TestVerboseMemory true
44+
* @run main/othervm -Xlog:gc*=trace TestVerboseMemory true
45+
*
46+
* @run main/othervm -Xlog:gc=info,gc+init=off TestVerboseMemory true
47+
* @run main/othervm -Xlog:gc=off,gc+init=info TestVerboseMemory false
48+
* @run main/othervm -Xlog:gc,gc+init TestVerboseMemory true
49+
*
50+
* @run main/othervm -Xlog:all=trace:file=vm.log TestVerboseMemory false
51+
*/
52+
53+
import java.lang.management.ManagementFactory;
54+
import java.lang.management.MemoryMXBean;
55+
56+
public class TestVerboseMemory {
57+
58+
public static void main(String[] args) throws Exception {
59+
MemoryMXBean mxBean = ManagementFactory.getMemoryMXBean();
60+
boolean expected = Boolean.parseBoolean(args[0]);
61+
boolean initial = mxBean.isVerbose();
62+
if (expected != initial) {
63+
throw new Error("Initial verbosity setting was unexpectedly " + initial);
64+
}
65+
mxBean.setVerbose(false);
66+
if (mxBean.isVerbose()) {
67+
throw new Error("Verbosity was still enabled");
68+
}
69+
mxBean.setVerbose(true);
70+
if (!mxBean.isVerbose()) {
71+
throw new Error("Verbosity was still disabled");
72+
}
73+
// Turn off again as a double-check and also to avoid excessive logging
74+
mxBean.setVerbose(false);
75+
if (mxBean.isVerbose()) {
76+
throw new Error("Verbosity was still enabled");
77+
}
78+
}
79+
}

0 commit comments

Comments
 (0)