undefect. CWE-407 — 63 sites patched across 27 ecosystems

Authors: russell@unturf.com · brackishbert@gmail.com · foxhop.net · TimeHexOn.com

Patches, unit tests, benchmarks, whitepaper, and outreach briefs.
Public domain — no copyright claimed. Use freely.
This commit is contained in:
russell@unturf.com 2026-03-26 17:11:57 -04:00
commit 0a580b313d
70422 changed files with 17213626 additions and 0 deletions

View file

@ -0,0 +1,119 @@
/*
* Copyright (c) 2014, 2023, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/**
* @test
* @bug 8035668
* @requires vm.flagless
* @library /test/lib
* @summary Test checks case when target application finishes execution and jstat didn't complete work.
jstat is started with interval = 100 (jstat -compiler 100) and monitored application finishes
after 500ms. This shouldn't cause crash or hang in target application or in jstat.
* @modules java.management
* @build JStatInterval
* @run main JStatInterval
*/
import jdk.test.lib.JDKToolLauncher;
import jdk.test.lib.Utils;
import jdk.test.lib.process.ProcessTools;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
public class JStatInterval {
private static final String READY = "READY";
private static final String ERROR = "!ERROR";
public static class Application {
public static void main(String[] args) {
try {
System.out.println(READY);
System.out.flush();
int exitCode = System.in.read();
Thread.sleep(500);
System.exit(exitCode);
} catch (Exception e) {
System.out.println(ERROR);
System.out.flush();
throw new Error(e);
}
}
}
public static void main(String[] args) throws Exception {
ProcessBuilder pb = ProcessTools.createTestJavaProcessBuilder(
"-XX:+UsePerfData",
Application.class.getName()
);
AtomicBoolean error = new AtomicBoolean(false);
Process app = ProcessTools.startProcess(
"application",
pb,
line -> {
if (line.equals(READY)) {
return true;
} else if (line.equals(ERROR)) {
error.set(true);
return true;
}
return false;
},
10,
TimeUnit.SECONDS
);
if (error.get()) {
throw new Error("Unable to start the monitored application.");
}
String pidStr = String.valueOf(app.pid());
JDKToolLauncher l = JDKToolLauncher.createUsingTestJDK("jstat");
l.addVMArgs(Utils.getTestJavaOpts());
l.addToolArg("-compiler");
l.addToolArg(pidStr);
l.addToolArg("100");
ProcessBuilder jstatDef = new ProcessBuilder(l.getCommand());
Process jstat = ProcessTools.startProcess(
"jstat",
jstatDef,
line -> {
if (line.trim().toLowerCase().startsWith("compiled")) {
return true;
}
return false;
},
10,
TimeUnit.SECONDS
);
app.getOutputStream().write(0);
app.getOutputStream().flush();
if (app.waitFor() != 0) {
throw new Error("Error detected upon exiting the monitored application with active jstat");
}
if (jstat.waitFor() != 0) {
throw new Error("Error detected in jstat when monitored application has exited prematurely");
}
}
}

View file

@ -0,0 +1,2 @@
modules = jdk.jcmd

View file

@ -0,0 +1,30 @@
#
# matching the following output specified as a pattern that verifies
# that the numerical values conform to a specific pattern, rather than
# specific values.
#
# Loaded Bytes Unloaded Bytes Time
# 407 436.3 0 0.0 0.36
BEGIN {
headerlines=0; datalines=0; totallines=0
}
/^Loaded Bytes Unloaded Bytes Time $/ {
headerlines++;
}
/^[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+$/ {
datalines++;
}
{ totallines++; print $0 }
END {
if ((headerlines == 1) && (datalines == 1)) {
exit 0
}
else {
exit 1
}
}

View file

@ -0,0 +1,32 @@
#
# matching the following output specified as a pattern that verifies
# that the numerical values conform to a specific pattern, rather than
# specific values.
#
# Loaded Time Inited Time Shared Kbytes LoadTime SysClass Kbytes LoadTime Lookup Parse Linked Time Verified Time AppClass Kbytes AppCL DefineClass Time FindClass Time Delegation URLCL Read
# 956 0.115 777 0.032 0 0.0 0.000 956 3437.5 0.085 0.013 0.045 918 0.032 917 0.011 13 1.0 0.003 1 0.000 1 0.004 0.005 0.000
# 941 0.214 870 0.080 0 0.0 0.000 1014 4331.2 0.127 0.000 0.000 941 0.080 77 0.005 165 249.1 0.044 97 0.035 - - - -
#
BEGIN {
headerlines=0; datalines=0; totallines=0
}
/^Loaded Time Inited Time Shared Kbytes LoadTime SysClass Kbytes LoadTime Lookup Parse Linked Time Verified Time AppClass Kbytes AppCL DefineClass Time FindClass Time Delegation URLCL Read$/ {
headerlines++;
}
/^[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+[ ]*[0-9]+\.[0-9][ ]*[0-9]+\.[0-9]+[ ]*[0-9]+[ ]*[0-9]+\.[0-9][ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+[ ]*[0-9]+\.[0-9][ ]*[0-9]+\.[0-9]+[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+|-[ ]*([0-9]+\.[0-9]+)|-[ ]*([0-9]+\.[0-9]+)|-[ ]*([0-9]+\.[0-9]+)|-$/ {
datalines++;
}
{ totallines++; print $0 }
END {
if ((headerlines == 1) && (datalines == 1)) {
exit 0
}
else {
exit 1
}
}

View file

@ -0,0 +1,39 @@
#
# matching the following output specified as a pattern that verifies
# that the numerical values conform to a specific pattern, rather than
# specific values.
#
# Compiled Failed Invalid Time FailedType FailedMethod
# 38 0 0 0.41 0
BEGIN {
headerlines=0; datalines=0; totallines=0
}
/^Compiled Failed Invalid Time FailedType FailedMethod$/ {
headerlines++;
}
# note - the FailedMethod column is not matched very thoroughly by the
# following pattern. We just check for zero or more spaces after the
# FailedType column and the for any sequence of characters for the
# FailedMethod column. Better checking would verify an optional string of
# characters that follows class/method name patterns. However, it's very
# difficult to generate any data in this column under normal circumstances.
#
/^[ ]*[0-9]+[ ]*[0-9]+[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+[ ]*.*$/ {
datalines++;
}
{ totallines++; print $0 }
END {
if ((headerlines == 1) && (datalines == 1)) {
exit 0
}
else {
exit 1
}
}

View file

@ -0,0 +1,32 @@
#
# matching the following output specified as a pattern that verifies
# that the numerical values conform to a specific pattern, rather than
# specific values.
#
# -gcutil
#
# S0 S1 E O M CCS YGC YGCT FGC FGCT CGC CGCT GCT
# 0.00 0.00 0.00 47.17 97.15 92.31 20 0.335 696 334.382 2 0.069 334.786
BEGIN {
headerlines=0; datalines=0; totallines=0
}
/^ S0 S1 E O M CCS YGC YGCT FGC FGCT CGC CGCT GCT $/ {
headerlines++;
}
/^[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+$/ {
datalines++;
}
{ totallines++; print $0 }
END {
if ((headerlines == 1) && (datalines == 1)) {
exit 0
}
else {
exit 1
}
}

View file

@ -0,0 +1,37 @@
#
# matching the following output specified as a pattern that verifies
# that the numerical values conform to a specific pattern, rather than
# specific values.
#
# -gccapacity 0
#
# NGCMN NGCMX NGC S0C S1C EC OGCMN OGCMX OGC OC MCMN MCMX MC CCSMN CCSMX CCSC YGC FGC CGC
# 0.0 4194304.0 6144.0 0.0 2048.0 4096.0 0.0 4194304.0 2048.0 2048.0 0.0 1056768.0 7680.0 0.0 1048576.0 768.0 4 0 0
#
# -J-XX:+UseParallelGC -gccapacity 0
#
# NGCMN NGCMX NGC S0C S1C EC OGCMN OGCMX OGC OC MCMN MCMX MC CCSMN CCSMX CCSC YGC FGC CGC
# 1536.0 1397760.0 8192.0 1024.0 512.0 3072.0 512.0 2796544.0 5632.0 5632.0 0.0 1056768.0 8320.0 0.0 1048576.0 896.0 5 0 -
BEGIN {
headerlines=0; datalines=0; totallines=0
}
/^ NGCMN NGCMX NGC S0C S1C EC OGCMN OGCMX OGC OC MCMN MCMX MC CCSMN CCSMX CCSC YGC FGC CGC $/ {
headerlines++;
}
/^[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+[ ]*[0-9]+[ ]*(-|[0-9]+)$/ {
datalines++;
}
{ totallines++; print $0 }
END {
if ((headerlines == 1) && (datalines == 1)) {
exit 0
}
else {
exit 1
}
}

View file

@ -0,0 +1,45 @@
#
# matching the following output specified as a pattern that verifies
# that the numerical values conform to a specific pattern, rather than
# specific values.
#
# -gccause 0
#
# S0 S1 E O M CCS YGC YGCT FGC FGCT CGC CGCT GCT LGCC GCC
# 0.00 54.68 0.00 0.00 94.02 84.11 4 0.269 0 0.000 0 0.000 0.269 G1 Evacuation Pause No GC
#
# -J-XX:+UseSerialGC -gccause 0
#
# S0 S1 E O M CCS YGC YGCT FGC FGCT CGC CGCT GCT LGCC GCC
# 78.14 0.00 68.23 15.57 94.69 88.17 4 0.204 0 0.000 - - 0.204 Allocation Failure No GC
BEGIN {
headerlines=0; datalines=0; totallines=0
}
/^ S0 S1 E O M CCS YGC YGCT FGC FGCT CGC CGCT GCT LGCC GCC $/ {
headerlines++;
}
# The following pattern does not verify the validity of the gc cause
# string as the values can vary depending on conditions out of our
# control. To accomodate this variability, the pattern matcher simply
# detects that there are two strings that match a specific pattern
# where the first character is a letter followed by a sequence of zero
# or more letters and spaces. It also provides for the ".", "(", and ")"
# characters to allow for the string "System.gc()".
#
/^[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*([0-9]+\.[0-9]+)|-[ ]*([0-9]+\.[0-9]+)|-[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*([0-9]+)|-[ ]*([0-9]+\.[0-9]+)|-[ ]*[0-9]+\.[0-9]+[ ]*[a-zA-Z]+[a-zA-Z \.\(\)]*[ ]*[a-zA-Z]+[a-zA-Z \.\(\)]*$/ {
datalines++;
}
{ totallines++; print $0 }
END {
if ((headerlines == 1) && (datalines == 1)) {
exit 0
}
else {
exit 1
}
}

View file

@ -0,0 +1,37 @@
#
# matching the following output specified as a pattern that verifies
# that the numerical values conform to a specific pattern, rather than
# specific values.
#
# -gcmetacapacity 0
#
# MCMN MCMX MC CCSMN CCSMX CCSC YGC FGC FGCT CGC CGCT GCT
# 0.0 1056768.0 8832.0 0.0 1048576.0 896.0 5 0 0.000 0 0.000 0.245
#
# -J-XX:+UseParallelGC -gcmetacapacity 0
#
# MCMN MCMX MC CCSMN CCSMX CCSC YGC FGC FGCT CGC CGCT GCT
# 0.0 1056768.0 8064.0 0.0 1048576.0 896.0 4 0 0.000 - - 0.113
BEGIN {
headerlines=0; datalines=0; totallines=0
}
/^ MCMN MCMX MC CCSMN CCSMX CCSC YGC FGC FGCT CGC CGCT GCT $/ {
headerlines++;
}
/^[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*(-|[0-9]+)[ ]*(-|[0-9]+\.[0-9]+)[ ]*[0-9]+\.[0-9]+$/ {
datalines++;
}
{ totallines++; print $0 }
END {
if ((headerlines == 1) && (datalines == 1)) {
exit 0
}
else {
exit 1
}
}

View file

@ -0,0 +1,37 @@
#
# matching the following output specified as a pattern that verifies
# that the numerical values conform to a specific pattern, rather than
# specific values.
#
# -gcnewcapacity 0
#
# NGCMN NGCMX NGC S0CMX S0C S1CMX S1C ECMX EC YGC FGC CGC
# 0.0 4194304.0 6144.0 0.0 0.0 4194304.0 2048.0 4194304.0 4096.0 4 0 0
#
# -J-XX:+UseParallelGC -gcnewcapacity 0
#
# NGCMN NGCMX NGC S0CMX S0C S1CMX S1C ECMX EC YGC FGC CGC
# 1536.0 1397760.0 7168.0 465920.0 512.0 465920.0 512.0 1396736.0 6144.0 4 0 -
BEGIN {
headerlines=0; datalines=0; totallines=0
}
/^ NGCMN NGCMX NGC S0CMX S0C S1CMX S1C ECMX EC YGC FGC CGC $/ {
headerlines++;
}
/^[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+[ ]*[0-9]+[ ]*(-|[0-9]+)$/ {
datalines++;
}
{ totallines++; print $0 }
END {
if ((headerlines == 1) && (datalines == 1)) {
exit 0
}
else {
exit 1
}
}

View file

@ -0,0 +1,38 @@
#
# matching the following output specified as a pattern that verifies
# that the numerical values conform to a specific pattern, rather than
# specific values.
#
# -gcnew 0
#
# S0C S1C S0U S1U TT MTT DSS EC EU YGC YGCT
# 0.0 2048.0 0.0 1113.5 15 15 1024.0 4096.0 0.0 4 0.228
#
# -J-XX:+UseParallelGC -gcnew 0
#
# S0C S1C S0U S1U TT MTT DSS EC EU YGC YGCT
# 1024.0 512.0 0.0 512.0 6 15 1024.0 3072.0 830.1 5 0.164
BEGIN {
headerlines=0; datalines=0; totallines=0
}
/^ S0C S1C S0U S1U TT MTT DSS EC EU YGC YGCT $/ {
headerlines++;
}
/^[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+$/ {
datalines++;
}
{ totallines++; print $0 }
END {
if ((headerlines == 1) && (datalines == 1) && (totallines == 2)) {
exit 0
}
else {
exit 1
}
}

View file

@ -0,0 +1,37 @@
#
# matching the following output specified as a pattern that verifies
# that the numerical values conform to a specific pattern, rather than
# specific values.
#
# -gcoldcapacity 0
#
# OGCMN OGCMX OGC OC YGC FGC FGCT CGC CGCT GCT
# 0.0 4194304.0 2048.0 2048.0 5 0 0.000 0 0.000 0.407
#
# -J-XX:+UseParallelGC -gcoldcpacity 0
#
# OGCMN OGCMX OGC OC YGC FGC FGCT CGC CGCT GCT
# 512.0 2796544.0 5632.0 5632.0 5 0 0.000 - - 0.180
BEGIN {
headerlines=0; datalines=0; totallines=0
}
/^ OGCMN OGCMX OGC OC YGC FGC FGCT CGC CGCT GCT $/ {
headerlines++;
}
/^[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*(-|[0-9]+)[ ]*(-|[0-9]+\.[0-9]+)[ ]*[0-9]+\.[0-9]+$/ {
datalines++;
}
{ totallines++; print $0 }
END {
if ((headerlines == 1) && (datalines == 1)) {
exit 0
}
else {
exit 1
}
}

View file

@ -0,0 +1,37 @@
#
# matching the following output specified as a pattern that verifies
# that the numerical values conform to a specific pattern, rather than
# specific values.
#
# -gcold 0
#
# MC MU CCSC CCSU OC OU YGC FGC FGCT CGC CGCT GCT
# 7680.0 7202.3 768.0 638.6 2048.0 0.0 4 0 0.000 0 0.000 0.240
#
# -J-XX:+UseParallelGC -gcold 0
#
# MC MU CCSC CCSU OC OU YGC FGC FGCT CGC CGCT GCT
# 8320.0 7759.4 896.0 718.3 5632.0 904.1 5 0 0.000 - - 0.175
BEGIN {
headerlines=0; datalines=0; totallines=0
}
/^ MC MU CCSC CCSU OC OU YGC FGC FGCT CGC CGCT GCT $/ {
headerlines++;
}
/^[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*(-|[0-9]+)[ ]*(-|[0-9]+\.[0-9]+)[ ]*[0-9]+\.[0-9]+$/ {
datalines++;
}
{ totallines++; print $0 }
END {
if ((headerlines == 1) && (datalines == 1)) {
exit 0
}
else {
exit 1
}
}

View file

@ -0,0 +1,38 @@
#
# matching the following output specified as a pattern that verifies
# that the numerical values conform to a specific pattern, rather than
# specific values.
#
# -gc 0
#
# S0C S1C S0U S1U EC EU OC OU MC MU CCSC CCSU YGC YGCT FGC FGCT CGC CGCT GCT
# 0.0 2048.0 0.0 1079.5 4096.0 0.0 2048.0 0.0 7680.0 7378.6 768.0 664.7 4 0.140 0 0.000 0 0.000 0.140
#
# -J-XX:+UseParallelGC -gc 0
#
# S0C S1C S0U S1U EC EU OC OU MC MU CCSC CCSU YGC YGCT FGC FGCT CGC CGCT GCT
# 512.0 512.0 512.0 0.0 6144.0 634.8 5632.0 748.1 8320.0 7851.5 896.0 730.2 4 0.171 0 0.000 - - 0.171
BEGIN {
headerlines=0; datalines=0; totallines=0
}
/^ S0C S1C S0U S1U EC EU OC OU MC MU CCSC CCSU YGC YGCT FGC FGCT CGC CGCT GCT $/ {
headerlines++;
}
/^[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*(-|[0-9]+)[ ]*(-|[0-9]+\.[0-9]+)[ ]*[0-9]+\.[0-9]+$/ {
datalines++;
}
{ totallines++; print $0 }
END {
if ((headerlines == 1) && (datalines == 1)) {
exit 0
}
else {
exit 1
}
}

Binary file not shown.

View file

@ -0,0 +1,36 @@
# Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
# @test
# @bug 4990825
# @run shell jstatClassOutput1.sh
# @summary Test that output of 'jstat -class 0' has expected line counts
. ${TESTSRC-.}/../../jvmstat/testlibrary/utils.sh
setup
verify_os
JSTAT="${TESTJAVA}/bin/jstat"
${JSTAT} ${COMMON_JSTAT_FLAGS} -class 0 2>&1 | awk -f ${TESTSRC}/classOutput1.awk

View file

@ -0,0 +1,36 @@
#
# Copyright (c) 2010, 2018, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
# @test
# @bug 6959965
# @run shell jstatClassloadOutput1.sh
# @summary Test that output of 'jstat -classload 0' has expected line counts
. ${TESTSRC-.}/../../jvmstat/testlibrary/utils.sh
setup
verify_os
JSTAT="${TESTJAVA}/bin/jstat"
${JSTAT} ${COMMON_JSTAT_FLAGS} -classload -J-Djstat.showUnsupported=true 0 2>&1 | awk -f ${TESTSRC}/classloadOutput1.awk

View file

@ -0,0 +1,36 @@
#
# Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
# @test
# @bug 4990825
# @run shell jstatCompilerOutput1.sh
# @summary Test that output of 'jstat -compiler 0' has expected line counts
. ${TESTSRC-.}/../../jvmstat/testlibrary/utils.sh
setup
verify_os
JSTAT="${TESTJAVA}/bin/jstat"
${JSTAT} ${COMMON_JSTAT_FLAGS} -compiler 0 2>&1 | awk -f ${TESTSRC}/compilerOutput1.awk

View file

@ -0,0 +1,53 @@
#
# Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
# @test
# @bug 4990825
# @run shell jstatFileURITest1.sh
# @summary Test that output of 'jstat -gcutil file:path' has expected line counts
. ${TESTSRC-.}/../../jvmstat/testlibrary/utils.sh
setup
JSTAT="${TESTJAVA}/bin/jstat"
RC=0
OS=`uname -s`
case ${OS} in
Windows*)
# work-around for strange problems trying to translate back slash
# characters into forward slash characters in an effort to convert
# TESTSRC into a canonical form useable as URI path.
cp ${TESTSRC}/hsperfdata_3433 .
${JSTAT} ${COMMON_JSTAT_FLAGS} -gcutil file:/`pwd`/hsperfdata_3433 2>&1 | awk -f ${TESTSRC}/fileURITest1.awk
RC=$?
rm -f hsperfdata_3433 2>&1 > /dev/null
;;
*)
${JSTAT} ${COMMON_JSTAT_FLAGS} -gcutil file:${TESTSRC}/hsperfdata_3433 2>&1 | awk -f ${TESTSRC}/fileURITest1.awk
RC=$?
;;
esac
echo ${RC}

View file

@ -0,0 +1,42 @@
#
# Copyright (c) 2004, 2025, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
# @test
# @bug 4990825
# @run shell jstatGcCapacityOutput1.sh
# @summary Test that output of 'jstat -gccapacity 0' has expected line counts
. ${TESTSRC-.}/../../jvmstat/testlibrary/utils.sh
setup
verify_os
JSTAT="${TESTJAVA}/bin/jstat"
${JSTAT} ${COMMON_JSTAT_FLAGS} -gccapacity 0 2>&1 | awk -f ${TESTSRC}/gcCapacityOutput1.awk
RC=$?
if [ $RC -ne 0 ]; then
exit $RC
fi
${JSTAT} ${COMMON_JSTAT_FLAGS} -J-XX:+UseParallelGC -gccapacity 0 2>&1 | awk -f ${TESTSRC}/gcCapacityOutput1.awk

View file

@ -0,0 +1,46 @@
#
# Copyright (c) 2004, 2025, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
# @test
# @bug 4990825
# @run shell jstatGcCauseOutput1.sh
# @summary Test that output of 'jstat -gccause 0' has expected line counts
. ${TESTSRC-.}/../../jvmstat/testlibrary/utils.sh
setup
verify_os
JSTAT="${TESTJAVA}/bin/jstat"
# Explicitly use serial gc because if this tests runs on a server
# class machine, ergonomics will automatically use UseParallelGC.
# The UseParallelGC collector does not currently update the gc cause counters.
${JSTAT} ${COMMON_JSTAT_FLAGS} -gccause 0 2>&1 | awk -f ${TESTSRC}/gcCauseOutput1.awk
RC=$?
if [ $RC -ne 0 ]; then
exit $RC
fi
${JSTAT} ${COMMON_JSTAT_FLAGS} -J-XX:+UseSerialGC -gccause 0 2>&1 | awk -f ${TESTSRC}/gcCauseOutput1.awk

View file

@ -0,0 +1,42 @@
#
# Copyright (c) 2013, 2025, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
# @test
# @bug 4990825
# @run shell jstatGcMetaCapacityOutput1.sh
# @summary Test that output of 'jstat -gcmetacapacity 0' has expected line counts
. ${TESTSRC-.}/../../jvmstat/testlibrary/utils.sh
setup
verify_os
JSTAT="${TESTJAVA}/bin/jstat"
${JSTAT} ${COMMON_JSTAT_FLAGS} -gcmetacapacity 0 2>&1 | awk -f ${TESTSRC}/gcMetaCapacityOutput1.awk
RC=$?
if [ $RC -ne 0 ]; then
exit $RC
fi
${JSTAT} ${COMMON_JSTAT_FLAGS} -J-XX:+UseParallelGC -gcmetacapacity 0 2>&1 | awk -f ${TESTSRC}/gcMetaCapacityOutput1.awk

View file

@ -0,0 +1,42 @@
#
# Copyright (c) 2004, 2025, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
# @test
# @bug 4990825
# @run shell jstatGcNewCapacityOutput1.sh
# @summary Test that output of 'jstat -gcnewcapacity 0' has expected line counts
. ${TESTSRC-.}/../../jvmstat/testlibrary/utils.sh
setup
verify_os
JSTAT="${TESTJAVA}/bin/jstat"
${JSTAT} ${COMMON_JSTAT_FLAGS} -gcnewcapacity 0 2>&1 | awk -f ${TESTSRC}/gcNewCapacityOutput1.awk
RC=$?
if [ $RC -ne 0 ]; then
exit $RC
fi
${JSTAT} ${COMMON_JSTAT_FLAGS} -J-XX:+UseParallelGC -gcnewcapacity 0 2>&1 | awk -f ${TESTSRC}/gcNewCapacityOutput1.awk

View file

@ -0,0 +1,42 @@
#
# Copyright (c) 2004, 2025, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
# @test
# @bug 4990825
# @run shell jstatGcNewOutput1.sh
# @summary Test that output of 'jstat -gcnew 0' has expected line counts
. ${TESTSRC-.}/../../jvmstat/testlibrary/utils.sh
setup
verify_os
JSTAT="${TESTJAVA}/bin/jstat"
${JSTAT} ${COMMON_JSTAT_FLAGS} -gcnew 0 2>&1 | awk -f ${TESTSRC}/gcNewOutput1.awk
RC=$?
if [ $RC -ne 0 ]; then
exit $RC
fi
${JSTAT} ${COMMON_JSTAT_FLAGS} -J-XX:+UseParallelGC -gcnew 0 2>&1 | awk -f ${TESTSRC}/gcNewOutput1.awk

View file

@ -0,0 +1,42 @@
#
# Copyright (c) 2004, 2025, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
# @test
# @bug 4990825
# @run shell jstatGcOldCapacityOutput1.sh
# @summary Test that output of 'jstat -gcoldcapcaity 0' has expected line counts
. ${TESTSRC-.}/../../jvmstat/testlibrary/utils.sh
setup
verify_os
JSTAT="${TESTJAVA}/bin/jstat"
${JSTAT} ${COMMON_JSTAT_FLAGS} -gcoldcapacity 0 2>&1 | awk -f ${TESTSRC}/gcOldCapacityOutput1.awk
RC=$?
if [ $RC -ne 0 ]; then
exit $RC
fi
${JSTAT} ${COMMON_JSTAT_FLAGS} -J-XX:+UseParallelGC -gcoldcapacity 0 2>&1 | awk -f ${TESTSRC}/gcOldCapacityOutput1.awk

View file

@ -0,0 +1,42 @@
#
# Copyright (c) 2004, 2025, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
# @test
# @bug 4990825
# @run shell jstatGcOldOutput1.sh
# @summary Test that output of 'jstat -gcold 0' has expected line counts
. ${TESTSRC-.}/../../jvmstat/testlibrary/utils.sh
setup
verify_os
JSTAT="${TESTJAVA}/bin/jstat"
${JSTAT} ${COMMON_JSTAT_FLAGS} -gcold 0 2>&1 | awk -f ${TESTSRC}/gcOldOutput1.awk
RC=$?
if [ $RC -ne 0 ]; then
exit $RC
fi
${JSTAT} ${COMMON_JSTAT_FLAGS} -J-XX:+UseParallelGC -gcold 0 2>&1 | awk -f ${TESTSRC}/gcOldOutput1.awk

View file

@ -0,0 +1,42 @@
#
# Copyright (c) 2004, 2025, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
# @test
# @bug 4990825
# @run shell jstatGcOutput1.sh
# @summary Test that output of 'jstat -gc 0' has expected line counts
. ${TESTSRC-.}/../../jvmstat/testlibrary/utils.sh
setup
verify_os
JSTAT="${TESTJAVA}/bin/jstat"
${JSTAT} ${COMMON_JSTAT_FLAGS} -gc 0 2>&1 | awk -f ${TESTSRC}/gcOutput1.awk
RC=$?
if [ $RC -ne 0 ]; then
exit $RC
fi
${JSTAT} ${COMMON_JSTAT_FLAGS} -J-XX:+UseParallelGC -gc 0 2>&1 | awk -f ${TESTSRC}/gcOutput1.awk

View file

@ -0,0 +1,75 @@
#
# Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
# @test
# @bug 4990825 6364329
# @run shell jstatHelp.sh
# @summary Test that output of 'jstat -?', 'jstat -h', 'jstat --help' and 'jstat' matches the usage.out file
. ${TESTSRC-.}/../../jvmstat/testlibrary/utils.sh
setup
JSTAT="${TESTJAVA}/bin/jstat"
rm -f jstat.out 2>/dev/null
${JSTAT} -J-XX:+UsePerfData -? > jstat.out 2>&1
diff -w jstat.out ${TESTSRC}/usage.out
if [ $? != 0 ]
then
echo "Output of jstat -? differs from expected output. Failed."
exit 1
fi
rm -f jstat.out 2>/dev/null
${JSTAT} -J-XX:+UsePerfData --help > jstat.out 2>&1
diff -w jstat.out ${TESTSRC}/usage.out
if [ $? != 0 ]
then
echo "Output of jstat -h differs from expected output. Failed."
exit 1
fi
rm -f jstat.out 2>/dev/null
${JSTAT} -J-XX:+UsePerfData --help > jstat.out 2>&1
diff -w jstat.out ${TESTSRC}/usage.out
if [ $? != 0 ]
then
echo "Output of jstat --help differs from expected output. Failed."
exit 1
fi
rm -f jstat.out 2>/dev/null
${JSTAT} -J-XX:+UsePerfData > jstat.out 2>&1
diff -w jstat.out ${TESTSRC}/usage.out
if [ $? != 0 ]
then
echo "Output of jstat differs from expected output. Failed."
exit 1
fi
exit 0

View file

@ -0,0 +1,42 @@
#
# Copyright (c) 2004, 2025, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
# @test
# @bug 4990825
# @run shell jstatLineCounts1.sh
# @summary Test that output of 'jstat -gcutil 0 250 5' has expected line counts
. ${TESTSRC-.}/../../jvmstat/testlibrary/utils.sh
setup
verify_os
JSTAT="${TESTJAVA}/bin/jstat"
${JSTAT} ${COMMON_JSTAT_FLAGS} -gcutil 0 250 5 2>&1 | awk -f ${TESTSRC}/lineCounts1.awk
RC=$?
if [ $RC -ne 0 ]; then
exit $RC
fi
${JSTAT} ${COMMON_JSTAT_FLAGS} -J-XX:+UseParallelGC -gcutil 0 250 5 2>&1 | awk -f ${TESTSRC}/lineCounts1.awk

View file

@ -0,0 +1,42 @@
#
# Copyright (c) 2004, 2025, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
# @test
# @bug 4990825
# @run shell jstatLineCounts2.sh
# @summary Test that output of 'jstat -gcutil 0' has expected line counts
. ${TESTSRC-.}/../../jvmstat/testlibrary/utils.sh
setup
verify_os
JSTAT="${TESTJAVA}/bin/jstat"
${JSTAT} ${COMMON_JSTAT_FLAGS} -gcutil 0 2>&1 | awk -f ${TESTSRC}/lineCounts2.awk
RC=$?
if [ $RC -ne 0 ]; then
exit $RC
fi
${JSTAT} ${COMMON_JSTAT_FLAGS} -J-XX:+UseParallelGC -gcutil 0 2>&1 | awk -f ${TESTSRC}/lineCounts2.awk

View file

@ -0,0 +1,42 @@
#
# Copyright (c) 2004, 2025, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
# @test
# @bug 4990825
# @run shell jstatLineCounts3.sh
# @summary Test that output of 'jstat -gcutil -h 10 250 10' has expected line counts
. ${TESTSRC-.}/../../jvmstat/testlibrary/utils.sh
setup
verify_os
JSTAT="${TESTJAVA}/bin/jstat"
${JSTAT} ${COMMON_JSTAT_FLAGS} -gcutil -h 10 0 250 10 2>&1 | awk -f ${TESTSRC}/lineCounts3.awk
RC=$?
if [ $RC -ne 0 ]; then
exit $RC
fi
${JSTAT} ${COMMON_JSTAT_FLAGS} -J-XX:+UseParallelGC -gcutil -h 10 0 250 10 2>&1 | awk -f ${TESTSRC}/lineCounts3.awk

View file

@ -0,0 +1,42 @@
#
# Copyright (c) 2004, 2025, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
# @test
# @bug 4990825
# @run shell jstatLineCounts4.sh
# @summary Test that output of 'jstat -gcutil -h 10 250 11' has expected line counts
. ${TESTSRC-.}/../../jvmstat/testlibrary/utils.sh
setup
verify_os
JSTAT="${TESTJAVA}/bin/jstat"
${JSTAT} ${COMMON_JSTAT_FLAGS} -gcutil -h 10 0 250 11 2>&1 | awk -f ${TESTSRC}/lineCounts4.awk
RC=$?
if [ $RC -ne 0 ]; then
exit $RC
fi
${JSTAT} ${COMMON_JSTAT_FLAGS} -J-XX:+UseParallelGC -gcutil -h 10 0 250 11 2>&1 | awk -f ${TESTSRC}/lineCounts4.awk

View file

@ -0,0 +1,40 @@
#
# Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
# @test
# @bug 4990825
# @run shell jstatOptions1.sh
# @summary Test that output of 'jstat -options matches the usage.out file
. ${TESTSRC-.}/../../jvmstat/testlibrary/utils.sh
setup
JSTAT="${TESTJAVA}/bin/jstat"
rm -f jstat.out1 jstat.out2 2>/dev/null
${JSTAT} ${COMMON_JSTAT_FLAGS} -options > jstat.out1 2>&1
${JSTAT} ${COMMON_JSTAT_FLAGS} -options -J-Djstat.showUnsupported=true > jstat.out2 2>&1
diff -w jstat.out1 ${TESTSRC}/options1.out
diff -w jstat.out2 ${TESTSRC}/options2.out

View file

@ -0,0 +1,38 @@
#
# Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
# @test
# @bug 4990825
# @run shell jstatPrintCompilationOutput1.sh
# @summary Test that output of 'jstat -printcompilation 0' has expected line counts
. ${TESTSRC-.}/../../jvmstat/testlibrary/utils.sh
setup
verify_os
JSTAT="${TESTJAVA}/bin/jstat"
# run with -Xcomp as jstat may complete too quickly to assure
# that compilation occurs.
${JSTAT} ${COMMON_JSTAT_FLAGS} -J-Xcomp -printcompilation 0 2>&1 | awk -f ${TESTSRC}/printCompilationOutput1.awk

View file

@ -0,0 +1,36 @@
#
# Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
# @test
# @bug 4990825
# @run shell jstatSnap1.sh
# @summary Test that output of 'jstat -snap' matches a specific pattern
. ${TESTSRC-.}/../../jvmstat/testlibrary/utils.sh
setup
verify_os
JSTAT="${TESTJAVA}/bin/jstat"
${JSTAT} ${COMMON_JSTAT_FLAGS} -snap 0 2>&1 | awk -f ${TESTSRC}/snap1.awk

View file

@ -0,0 +1,36 @@
#
# Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
# @test
# @bug 4990825
# @run shell jstatSnap2.sh
# @summary Test that output of 'jstat -J-Djstat.showUnsupported -snap' matches a specific pattern
. ${TESTSRC-.}/../../jvmstat/testlibrary/utils.sh
setup
verify_os
JSTAT="${TESTJAVA}/bin/jstat"
${JSTAT} ${COMMON_JSTAT_FLAGS} -J-Djstat.showUnsupported=true -snap 0 2>&1 | awk -f ${TESTSRC}/snap2.awk

View file

@ -0,0 +1,37 @@
#
# Copyright (c) 2004, 2020, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
# @test
# @bug 4990825
# @run shell jstatTimeStamp1.sh
# @summary Test that output of 'jstat -gcutil -t 0' has expected format
. ${TESTSRC-.}/../../jvmstat/testlibrary/utils.sh
setup
verify_os
JSTAT="${TESTJAVA}/bin/jstat"
${JSTAT} ${COMMON_JSTAT_FLAGS} -gcutil -t 0 2>&1 | awk -f ${TESTSRC}/timeStamp1.awk
${JSTAT} ${COMMON_JSTAT_FLAGS} -J-XX:+UseParallelGC -gcutil -t 0 2>&1 | awk -f ${TESTSRC}/timeStamp1.awk

View file

@ -0,0 +1,45 @@
#
# matching the following output specified as a pattern that verifies
# that the numerical values conform to a specific pattern, rather than
# specific values.
#
# -gcutil 0 250 5
#
# S0 S1 E O M CCS YGC YGCT FGC FGCT CGC CGCT GCT
# 0.00 64.15 0.00 0.00 95.71 84.70 5 0.258 0 0.000 0 0.000 0.258
# 0.00 64.15 0.00 0.00 95.71 84.70 5 0.258 0 0.000 0 0.000 0.258
# 0.00 64.15 0.00 0.00 95.71 84.70 5 0.258 0 0.000 0 0.000 0.258
# 0.00 64.15 0.00 0.00 95.71 84.70 5 0.258 0 0.000 0 0.000 0.258
# 0.00 64.15 0.00 0.00 95.71 84.70 5 0.258 0 0.000 0 0.000 0.258
#
# -J-XX:+UseParallelGC -gcutil 0 250 5
#
# S0 S1 E O M CCS YGC YGCT FGC FGCT CGC CGCT GCT
# 0.00 100.00 46.54 14.99 94.73 89.25 5 0.197 0 0.000 - - 0.197
# 0.00 100.00 46.54 14.99 94.73 89.25 5 0.197 0 0.000 - - 0.197
# 0.00 100.00 48.50 14.99 94.73 89.25 5 0.197 0 0.000 - - 0.197
# 0.00 100.00 48.50 14.99 94.73 89.25 5 0.197 0 0.000 - - 0.197
# 0.00 100.00 50.46 14.99 94.73 89.25 5 0.197 0 0.000 - - 0.197
BEGIN {
headerlines=0; datalines=0; totallines=0
}
/^ S0 S1 E O M CCS YGC YGCT FGC FGCT CGC CGCT GCT $/ {
headerlines++;
}
/^[ ]*([0-9]+\.[0-9]+|-)[ ]*([0-9]+\.[0-9]+|-)[ ]*([0-9]+\.[0-9]+|-)[ ]*([0-9]+\.[0-9]+|-)[ ]*([0-9]+\.[0-9]+|-)[ ]*([0-9]+\.[0-9]+|-)[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*([0-9]+|-)[ ]*([0-9]+\.[0-9]+|-)[ ]*[0-9]+\.[0-9]+$/ {
datalines++;
}
{ totallines++; print $0 }
END {
if ((headerlines == 1) && (datalines == 5)) {
exit 0
}
else {
exit 1
}
}

View file

@ -0,0 +1,37 @@
#
# matching the following output specified as a pattern that verifies
# that the numerical values conform to a specific pattern, rather than
# specific values.
#
# -gcutil 0
#
# S0 S1 E O M CCS YGC YGCT FGC FGCT CGC CGCT GCT
# 0.00 66.43 0.00 0.00 95.69 84.70 5 0.251 0 0.000 0 0.000 0.251
#
# -J-XX:+UseParallelGC -gcutil 0
#
# S0 S1 E O M CCS YGC YGCT FGC FGCT CGC CGCT GCT
# 0.00 100.00 46.41 14.85 95.00 89.25 5 0.151 0 0.000 - - 0.151
BEGIN {
headerlines=0; datalines=0; totallines=0
}
/^ S0 S1 E O M CCS YGC YGCT FGC FGCT CGC CGCT GCT $/ {
headerlines++;
}
/^[ ]*([0-9]+\.[0-9]+|-)[ ]*([0-9]+\.[0-9]+|-)[ ]*([0-9]+\.[0-9]+|-)[ ]*([0-9]+\.[0-9]+|-)[ ]*([0-9]+\.[0-9]+|-)[ ]*([0-9]+\.[0-9]+|-)[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*([0-9]+|-)[ ]*([0-9]+\.[0-9]+|-)[ ]*[0-9]+\.[0-9]+$/ {
datalines++;
}
{ totallines++; print $0 }
END {
if ((headerlines == 1) && (datalines == 1)) {
exit 0
}
else {
exit 1
}
}

View file

@ -0,0 +1,54 @@
#
# matching the following output specified as a pattern that verifies
# that the numerical values conform to a specific pattern, rather than
# specific values.
#
# -gcutil -h 10 0 250 10
#
# S0 S1 E O M CCS YGC YGCT FGC FGCT CGC CGCT GCT
# 0.00 63.87 0.00 0.00 95.70 84.70 5 0.229 0 0.000 0 0.000 0.229
# 0.00 63.87 0.00 0.00 95.70 84.70 5 0.229 0 0.000 0 0.000 0.229
# 0.00 63.87 0.00 0.00 95.70 84.70 5 0.229 0 0.000 0 0.000 0.229
# 0.00 63.87 0.00 0.00 95.70 84.70 5 0.229 0 0.000 0 0.000 0.229
# 0.00 63.87 0.00 0.00 95.70 84.70 5 0.229 0 0.000 0 0.000 0.229
# 0.00 63.87 0.00 0.00 95.70 84.70 5 0.229 0 0.000 0 0.000 0.229
# 0.00 63.87 0.00 0.00 95.70 84.70 5 0.229 0 0.000 0 0.000 0.229
# 0.00 63.87 0.00 0.00 95.70 84.70 5 0.229 0 0.000 0 0.000 0.229
# 0.00 63.87 0.00 0.00 95.70 84.70 5 0.229 0 0.000 0 0.000 0.229
# 0.00 63.87 0.00 0.00 95.70 84.70 5 0.229 0 0.000 0 0.000 0.229
#
# -J-XX:+UseParallelGC -gcutil -h 10 0 250 10
#
# S0 S1 E O M CCS YGC YGCT FGC FGCT CGC CGCT GCT
# 0.00 100.00 46.46 15.06 95.02 89.25 5 0.219 0 0.000 - - 0.219
# 0.00 100.00 46.46 15.06 95.02 89.25 5 0.219 0 0.000 - - 0.219
# 0.00 100.00 48.42 15.06 95.02 89.25 5 0.219 0 0.000 - - 0.219
# 0.00 100.00 48.42 15.06 95.02 89.25 5 0.219 0 0.000 - - 0.219
# 0.00 100.00 50.39 15.06 95.02 89.25 5 0.219 0 0.000 - - 0.219
# 0.00 100.00 50.39 15.06 95.02 89.25 5 0.219 0 0.000 - - 0.219
# 0.00 100.00 52.35 15.06 95.02 89.25 5 0.219 0 0.000 - - 0.219
# 0.00 100.00 52.35 15.06 95.02 89.25 5 0.219 0 0.000 - - 0.219
# 0.00 100.00 54.31 15.06 95.02 89.25 5 0.219 0 0.000 - - 0.219
# 0.00 100.00 54.31 15.06 95.02 89.25 5 0.219 0 0.000 - - 0.219
BEGIN {
headerlines=0; datalines=0; totallines=0
}
/^ S0 S1 E O M CCS YGC YGCT FGC FGCT CGC CGCT GCT $/ {
headerlines++;
}
/^[ ]*([0-9]+\.[0-9]+|-)[ ]*([0-9]+\.[0-9]+|-)[ ]*([0-9]+\.[0-9]+|-)[ ]*([0-9]+\.[0-9]+|-)[ ]*([0-9]+\.[0-9]+|-)[ ]*([0-9]+\.[0-9]+|-)[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*([0-9]+|-)[ ]*([0-9]+\.[0-9]+|-)[ ]*[0-9]+\.[0-9]+$/ {
datalines++;
}
{ totallines++; print $0 }
END {
if ((headerlines == 1) && (datalines == 10)) {
exit 0
} else {
exit 1
}
}

View file

@ -0,0 +1,62 @@
#
# matching the following output specified as a pattern that verifies
# that the numerical values conform to a specific pattern, rather than
# specific values.
#
# -gcutil -h 10 0 250 11
#
# S0 S1 E O M CCS YGC YGCT FGC FGCT CGC CGCT GCT
# 0.00 0.00 57.14 47.16 97.09 92.27 5 0.283 51 23.751 2 0.068 24.102
# 0.00 0.00 57.14 47.16 97.09 92.27 5 0.283 51 23.751 2 0.068 24.102
# 0.00 0.00 57.14 47.16 97.09 92.27 5 0.283 51 23.751 2 0.068 24.102
# 0.00 0.00 57.14 47.16 97.09 92.27 5 0.283 51 23.751 2 0.068 24.102
# 0.00 0.00 57.14 47.16 97.09 92.27 5 0.283 51 23.751 2 0.068 24.102
# 0.00 0.00 57.14 47.16 97.09 92.27 5 0.283 51 23.751 2 0.068 24.102
# 0.00 0.00 57.14 47.16 97.09 92.27 5 0.283 51 23.751 2 0.068 24.102
# 0.00 0.00 57.14 47.16 97.09 92.27 5 0.283 51 23.751 2 0.068 24.102
# 0.00 0.00 57.14 47.16 97.09 92.27 5 0.283 51 23.751 2 0.068 24.102
# 0.00 0.00 57.14 47.16 97.09 92.27 5 0.283 51 23.751 2 0.068 24.102
# S0 S1 E O M CCS YGC YGCT FGC FGCT CGC CGCT GCT
# 0.00 0.00 57.14 47.16 97.09 92.27 5 0.283 51 23.751 2 0.068 24.102
#
# -J-XX:+UseParallelGC -gcutil -h 10 0 250 11
#
# S0 S1 E O M CCS YGC YGCT FGC FGCT CGC CGCT GCT
# 0.00 100.00 46.57 14.56 94.70 89.25 5 0.206 0 0.000 - - 0.206
# 0.00 100.00 46.57 14.56 94.70 89.25 5 0.206 0 0.000 - - 0.206
# 0.00 100.00 48.53 14.56 94.70 89.25 5 0.206 0 0.000 - - 0.206
# 0.00 100.00 48.53 14.56 94.70 89.25 5 0.206 0 0.000 - - 0.206
# 0.00 100.00 50.49 14.56 94.70 89.25 5 0.206 0 0.000 - - 0.206
# 0.00 100.00 50.49 14.56 94.70 89.25 5 0.206 0 0.000 - - 0.206
# 0.00 100.00 52.45 14.56 94.70 89.25 5 0.206 0 0.000 - - 0.206
# 0.00 100.00 52.45 14.56 94.70 89.25 5 0.206 0 0.000 - - 0.206
# 0.00 100.00 54.41 14.56 94.70 89.25 5 0.206 0 0.000 - - 0.206
# 0.00 100.00 54.41 14.56 94.70 89.25 5 0.206 0 0.000 - - 0.206
# S0 S1 E O M CCS YGC YGCT FGC FGCT CGC CGCT GCT
# 0.00 100.00 56.37 14.56 94.70 89.25 5 0.206 0 0.000 - - 0.206
BEGIN {
headerlines=0; datalines=0; totallines=0
datalines2=0;
}
/^ S0 S1 E O M CCS YGC YGCT FGC FGCT CGC CGCT GCT $/ {
headerlines++;
}
/^[ ]*([0-9]+\.[0-9]+|-)[ ]*([0-9]+\.[0-9]+|-)[ ]*([0-9]+\.[0-9]+|-)[ ]*([0-9]+\.[0-9]+|-)[ ]*([0-9]+\.[0-9]+|-)[ ]*([0-9]+\.[0-9]+|-)[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*([0-9]+|-)[ ]*([0-9]+\.[0-9]+|-)[ ]*[0-9]+\.[0-9]+$/ {
if (headerlines == 2) {
datalines2++;
}
datalines++;
}
{ totallines++; print $0 }
END {
if ((headerlines == 2) && (datalines == 11) && (datalines2 == 1)) {
exit 0
} else {
exit 1
}
}

View file

@ -0,0 +1,12 @@
-class
-compiler
-gc
-gccapacity
-gccause
-gcmetacapacity
-gcnew
-gcnewcapacity
-gcold
-gcoldcapacity
-gcutil
-printcompilation

View file

@ -0,0 +1,13 @@
-class
-classload
-compiler
-gc
-gccapacity
-gccause
-gcmetacapacity
-gcnew
-gcnewcapacity
-gcold
-gcoldcapacity
-gcutil
-printcompilation

View file

@ -0,0 +1,34 @@
#
# matching the following output specified as a pattern that verifies
# that the numerical values conform to a specific pattern, rather than
# specific values.
#
# Compiled Size Type Method
# 45 131 1 sun/misc/FloatingDecimal countBits
BEGIN {
headerlines=0; datalines=0; totallines=0
}
/^Compiled Size Type Method$/ {
headerlines++;
}
/^[ ]*[0-9]+[ ]*[0-9]+[ ]*[0-9]+[ ]*[a-zA-Z_\$\+]+[a-zA-Z0-9_\$\+\/]* [a-zA-Z_\$\+]+[a-zA-Z0-9_\$\+]*$/ {
datalines++;
}
/^[ ]*[0-9]+[ ]*[0-9]+[ ]*[0-9]+[ ]*[a-zA-Z_\$\+]+[a-zA-Z0-9_\$\+\/]* <init>$/ {
datalines++;
}
{ totallines++; print $0 }
END {
if ((headerlines == 1) && (datalines == 1)) {
exit 0
}
else {
exit 1
}
}

View file

@ -0,0 +1,15 @@
#
BEGIN { totallines=0; count=0; }
{ totallines++; print $0 }
$0 !~ /java\..+=.*$/ { count++ }
END {
if ((count == 0) && (totallines != 0)) {
exit 0
}
else {
exit 1
}
}

View file

@ -0,0 +1,15 @@
#
BEGIN { totallines=0; count=0; }
{ totallines++; print $0 }
$0 !~ /[java|jdk|sun|com\.sun]\..+=.*$/ { count++ }
END {
if ((count == 0) && (totallines != 0)) {
exit 0
}
else {
exit 1
}
}

View file

@ -0,0 +1,38 @@
#
# matching the following output specified as a pattern that verifies
# that the numerical values conform to a specific pattern, rather than
# specific values.
#
# -gcutil -t 0
#
#Timestamp S0 S1 E O M CCS YGC YGCT FGC FGCT CGC CGCT GCT
# 3.4 0.00 63.85 0.00 0.00 93.83 81.78 5 0.203 0 0.000 0 0.000 0.203
# 3.7 0.00 63.85 0.00 0.00 93.83 81.78 5 0.203 0 0.000 0 0.000 0.203
#
# -J-XX:+UseParallelGC -gcutil -t 0
#
#Timestamp S0 S1 E O M CCS YGC YGCT FGC FGCT CGC CGCT GCT
# 2.6 100.00 0.00 22.51 10.16 94.74 88.88 4 0.100 0 0.000 - - 0.100
BEGIN {
headerlines=0; datalines=0; totallines=0
}
/^Timestamp S0 S1 E O M CCS YGC YGCT FGC FGCT CGC CGCT GCT $/ {
headerlines++;
}
/^[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*([0-9]+\.[0-9]+)|-[ ]*([0-9]+\.[0-9]+)|-[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+$/ {
datalines++;
}
{ totallines++; print $0 }
END {
if ((headerlines == 1) && (datalines == 1)) {
exit 0
}
else {
exit 1
}
}

View file

@ -0,0 +1,22 @@
Usage: jstat --help|-options
jstat -<option> [-t] [-h<lines>] <vmid> [<interval> [<count>]]
Definitions:
<option> An option reported by the -options option
<vmid> Virtual Machine Identifier. A vmid takes the following form:
<lvmid>[@<hostname>[:<port>]]
Where <lvmid> is the local vm identifier for the target
Java virtual machine, typically a process id; <hostname> is
the name of the host running the target Java virtual machine;
and <port> is the port number for the rmiregistry on the
target host. See the jvmstat documentation for a more complete
description of the Virtual Machine Identifier.
<lines> Number of samples between header lines.
<interval> Sampling interval. The following forms are allowed:
<n>["ms"|"s"]
Where <n> is an integer and the suffix specifies the units as
milliseconds("ms") or seconds("s"). The default units are "ms".
<count> Number of samples to take before terminating.
-J<flag> Pass <flag> directly to the runtime system.
-? -h --help Prints this help message.
-help Prints this help message.