# HG changeset patch # User lmesnik # Date 1527182048 25200 # Thu May 24 10:14:08 2018 -0700 # Node ID c3cb8961ad5fb4e1d0e4c5a113454ecc837c43c1 # Parent f4735ff8d17dd60f6fbbff461f56ecf1a280ce9b [mq]: 8203491-1 diff --git a/test/hotspot/jtreg/ProblemList.txt b/test/hotspot/jtreg/ProblemList.txt --- a/test/hotspot/jtreg/ProblemList.txt +++ b/test/hotspot/jtreg/ProblemList.txt @@ -144,7 +144,4 @@ vmTestbase/vm/mlvm/indy/func/jvmti/mergeCP_indy2manyDiff_b/TestDescription.java 8013267 generic-all vmTestbase/vm/mlvm/indy/func/jvmti/mergeCP_indy2manySame_b/TestDescription.java 8013267 generic-all -vmTestbase/heapdump/JMapHeapCore/TestDescription.java 8023376,8001227,8051445 generic-all -vmTestbase/heapdump/JMapMetaspaceCore/TestDescription.java 8023376,8001227,8051445 generic-all - ############################################################################# diff --git a/test/hotspot/jtreg/TEST.groups b/test/hotspot/jtreg/TEST.groups --- a/test/hotspot/jtreg/TEST.groups +++ b/test/hotspot/jtreg/TEST.groups @@ -209,6 +209,7 @@ -runtime/ConstantPool/IntfMethod.java \ -runtime/ErrorHandling/CreateCoredumpOnCrash.java \ -runtime/ErrorHandling/ErrorHandler.java \ + -runtime/ErrorHandling/TestHeapDumpOnOutOfMemoryError.java \ -runtime/ErrorHandling/TimeoutInErrorHandlingTest.java \ -runtime/logging/MonitorMismatchTest.java \ -runtime/memory/ReserveMemory.java \ @@ -1257,13 +1258,3 @@ # JSR292 tests (invokedynamic AKA Multi-Language VM AKA Da Vinci Machine) vmTestbase_vm_mlvm = \ vmTestbase/vm/mlvm -# Heap dump tests -vmTestbase_vm_heapdump = \ - vmTestbase/heapdump/ - -vmTestbase_vm_heapdump_quick = \ - vmTestbase/heapdump/OnOOMToFile/TestDescription.java \ - vmTestbase/heapdump/OnOOMToFileMetaspace/TestDescription.java \ - vmTestbase/heapdump/OnOOMToPath/TestDescription.java \ - vmTestbase/heapdump/JMapHeapCore/TestDescription.java \ - vmTestbase/heapdump/JMapMetaspace/TestDescription.java diff --git a/test/hotspot/jtreg/runtime/ErrorHandling/TestHeapDumpOnOutOfMemoryError.java b/test/hotspot/jtreg/runtime/ErrorHandling/TestHeapDumpOnOutOfMemoryError.java new file mode 100644 --- /dev/null +++ b/test/hotspot/jtreg/runtime/ErrorHandling/TestHeapDumpOnOutOfMemoryError.java @@ -0,0 +1,113 @@ +/* + * Copyright (c) 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 TestHeapDumpOnOutOfMemoryError + * @summary Test verifies that -XX:HeapDumpOnOutOfMemoryError dump heap when OutOfMemory is thrown + * @modules java.base/jdk.internal.misc + * @library /test/lib + * @run driver/timeout=240 TestHeapDumpOnOutOfMemoryError + */ + +import jdk.test.lib.Asserts; +import jdk.test.lib.classloader.GeneratingClassLoader; +import jdk.test.lib.hprof.HprofParser; +import jdk.test.lib.process.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; + +import java.io.File; + +public class TestHeapDumpOnOutOfMemoryError { + + public static String HEAP_OOME = "heap"; + public static String METASPACE_OOME = "metaspace"; + + public static void main(String[] args) throws Exception { + if (args.length == 1) { + try { + if (args[0].equals(HEAP_OOME)) { + Object[] oa = new Object[Integer.MAX_VALUE]; + for(int i = 0; i < oa.length; i++) { + oa[i] = new Object[Integer.MAX_VALUE]; + } + } else { + GeneratingClassLoader loader = new GeneratingClassLoader(); + for (int i = 0; ; i++) { + loader.loadClass(loader.getClassName(i)); + } + } + throw new Error("OOME not triggered"); + } catch (OutOfMemoryError err) { + return; + } + } + test(HEAP_OOME); + test(METASPACE_OOME); + testHeapDumpPath(); + } + + static void test(String type) throws Exception { + String heapdumpFilename = type + ".hprof"; + ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:+HeapDumpOnOutOfMemoryError", + "-XX:HeapDumpPath=" + heapdumpFilename, "-XX:MaxMetaspaceSize=64m", + TestHeapDumpOnOutOfMemoryError.class.getName(), type); + + OutputAnalyzer output = new OutputAnalyzer(pb.start()); + output.stdoutShouldNotBeEmpty(); + output.shouldContain("Dumping heap to " + type + ".hprof"); + File dump = new File(heapdumpFilename); + Asserts.assertTrue(dump.exists() && dump.isFile(), + "Could not find dump file " + dump.getAbsolutePath()); + + HprofParser.parse(new File(heapdumpFilename)); + System.out.println("PASSED"); + } + + static void testHeapDumpPath() throws Exception { + String heapdumpPath = "dumps"; + File dumpDirectory = new File(heapdumpPath); + dumpDirectory.mkdir(); + ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:+HeapDumpOnOutOfMemoryError", + "-XX:HeapDumpPath=" + heapdumpPath, "-Xmx256m", "-XX:MaxMetaspaceSize=64m", + TestHeapDumpOnOutOfMemoryError.class.getName(), HEAP_OOME); + + OutputAnalyzer output = new OutputAnalyzer(pb.start()); + output.stdoutShouldNotBeEmpty(); + output.shouldContain("Dumping heap"); + + Asserts.assertFalse(dumpDirectory.listFiles().length == 0, + "There is no dump files found in " + dumpDirectory ); + + Asserts.assertTrue(dumpDirectory.listFiles().length == 1, + "There are unexpected files in " + dumpDirectory + + ": " + String.join(",", dumpDirectory.list()) +"."); + + File dump = dumpDirectory.listFiles()[0]; + Asserts.assertTrue(dump.exists() && dump.isFile(), + "Could not find dump file " + dump.getAbsolutePath()); + + HprofParser.parse(dump); + System.out.println("PASSED"); + } + +} diff --git a/test/hotspot/jtreg/serviceability/sa/TestJmapCore.java b/test/hotspot/jtreg/serviceability/sa/TestJmapCore.java new file mode 100644 --- /dev/null +++ b/test/hotspot/jtreg/serviceability/sa/TestJmapCore.java @@ -0,0 +1,134 @@ +/* + * Copyright (c) 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 TestJmapCore + * @summary Test verifies that jhsdb jmap could generate heap dump from core + * @modules java.base/jdk.internal.misc + * @library /test/lib + * @run driver TestJmapCore + */ + +import jdk.test.lib.Asserts; +import jdk.test.lib.JDKToolFinder; +import jdk.test.lib.JDKToolLauncher; +import jdk.test.lib.Platform; +import jdk.test.lib.classloader.GeneratingClassLoader; +import jdk.test.lib.hprof.HprofParser; +import jdk.test.lib.process.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; + +import java.io.File; +import java.util.Arrays; +import java.util.stream.Collectors; + +public class TestJmapCore { + static final String pidSeparator = ":KILLED_PID"; + + public static void main(String[] args) throws Throwable { + if (args.length == 1) { + // If any arguments are set prints pid so main process coud find corefile + System.out.println(ProcessHandle.current().pid() + pidSeparator); + try { + Object[] oa = new Object[Integer.MAX_VALUE / 2]; + for(int i = 0; i < oa.length; i++) { + oa[i] = new Object[Integer.MAX_VALUE / 2]; + } + throw new Error("OOME not triggered"); + } catch (OutOfMemoryError err) { + return; + } + } + test(); + } + + // Test tries to run java with ulimit unlimited if it is possible + static boolean useDefaultUlimit() { + if (Platform.isWindows()) { + return true; + } + try { + OutputAnalyzer output = ProcessTools.executeProcess("sh", "-c", "ulimit -c unlimited && ulimit -c"); + return !(output.getExitValue() == 0 && output.getStdout().contains("unlimited")); + } catch (Throwable t) { + return true; + } + } + + static void test() throws Throwable { + ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(true, "-XX:+CreateCoredumpOnCrash", + "-XX:+CrashOnOutOfMemoryError", "-XX:-TransmitErrorReport", + TestJmapCore.class.getName(), "throwOOME"); + + boolean useDefaultUlimit = useDefaultUlimit(); + System.out.println("Run test with ulimit: " + (useDefaultUlimit ? "default" : "unlimited")); + OutputAnalyzer output = useDefaultUlimit + ? ProcessTools.executeProcess(pb) + : ProcessTools.executeProcess("sh", "-c", "ulimit -c unlimited && " + + ProcessTools.getCommandLine(pb)); + File core; + String pattern = Platform.isWindows() ? "mdmp" : "core"; + File[] cores = new File(".").listFiles((dir, name) -> name.contains(pattern)); + if (cores.length == 0) { + // /cores/core.$pid might be generated on macosx by default + String pid = output.firstMatch("^(\\d+)" + pidSeparator, 1); + core = new File("cores/core." + pid); + if (!core.exists()) { + System.out.println("Has not been able to find coredump. Test skipped."); + return; + } + } else { + Asserts.assertTrue(cores.length == 1, + "There are unexpected files containing core " + + ": " + String.join(",", new File(".").list()) + "."); + core = cores[0]; + } + System.out.println("Found corefile: " + core.getAbsolutePath()); + + File dumpFile = new File("heap.hprof"); + JDKToolLauncher launcher = JDKToolLauncher.createUsingTestJDK("jhsdb"); + launcher.addToolArg("jmap"); + launcher.addToolArg("--binaryheap"); + launcher.addToolArg("--dumpfile=" + dumpFile); + launcher.addToolArg("--exe"); + launcher.addToolArg(JDKToolFinder.getTestJDKTool("java")); + launcher.addToolArg("--core"); + launcher.addToolArg(core.getPath()); + + ProcessBuilder jhsdpb = new ProcessBuilder(); + jhsdpb.command(launcher.getCommand()); + Process jhsdb = jhsdpb.start(); + OutputAnalyzer out = new OutputAnalyzer(jhsdb); + + jhsdb.waitFor(); + + System.out.println(out.getStdout()); + System.err.println(out.getStderr()); + + Asserts.assertTrue(dumpFile.exists() && dumpFile.isFile(), + "Could not find dump file " + dumpFile.getAbsolutePath()); + + HprofParser.parse(dumpFile); + System.out.println("PASSED"); + } +} diff --git a/test/hotspot/jtreg/serviceability/tmtools/jstat/utils/GeneratedClassProducer.java b/test/hotspot/jtreg/serviceability/tmtools/jstat/utils/GeneratedClassProducer.java --- a/test/hotspot/jtreg/serviceability/tmtools/jstat/utils/GeneratedClassProducer.java +++ b/test/hotspot/jtreg/serviceability/tmtools/jstat/utils/GeneratedClassProducer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 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 @@ -22,6 +22,8 @@ */ package utils; +import jdk.test.lib.classloader.GeneratingClassLoader; + /** * Garbage producer that creates classes loaded with GeneratingClassLoader. * diff --git a/test/hotspot/jtreg/serviceability/tmtools/jstat/utils/TemplateClass.java b/test/hotspot/jtreg/serviceability/tmtools/jstat/utils/TemplateClass.java deleted file mode 100644 --- a/test/hotspot/jtreg/serviceability/tmtools/jstat/utils/TemplateClass.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright (c) 2015, 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. - */ -package utils; - -class TemplateClass { -} diff --git a/test/hotspot/jtreg/vmTestbase/heapdump/JMapHeap/TEST.properties b/test/hotspot/jtreg/vmTestbase/heapdump/JMapHeap/TEST.properties deleted file mode 100644 --- a/test/hotspot/jtreg/vmTestbase/heapdump/JMapHeap/TEST.properties +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright (c) 2017, 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. -# -exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/heapdump/JMapHeap/TestDescription.java b/test/hotspot/jtreg/vmTestbase/heapdump/JMapHeap/TestDescription.java deleted file mode 100644 --- a/test/hotspot/jtreg/vmTestbase/heapdump/JMapHeap/TestDescription.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (c) 2017, 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 - * - * @summary converted from VM testbase heapdump/JMapHeap. - * VM testbase keywords: [heapdump, feature_heapdump, nonconcurrent, jdk] - * VM testbase readme: - * DESCRIPTION - * This test verifies that heap dump created by JMap is able to be - * parsed by HprofParser. It fills the heap with objects of different types - * till OutOfMemoryError, then uses JMap to create heap dump and then - * verifies created heap dump with HprofParser. - * - * @library /vmTestbase - * /test/lib - * @run driver jdk.test.lib.FileInstaller . . - * @build jdk.test.lib.hprof.HprofParser - * heapdump.share.EatMemory - * @run shell/timeout=300 run.sh - */ - diff --git a/test/hotspot/jtreg/vmTestbase/heapdump/JMapHeap/run.sh b/test/hotspot/jtreg/vmTestbase/heapdump/JMapHeap/run.sh deleted file mode 100644 --- a/test/hotspot/jtreg/vmTestbase/heapdump/JMapHeap/run.sh +++ /dev/null @@ -1,51 +0,0 @@ -#!/bin/sh -# Copyright (c) 2007, 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. - -. $TESTSRC/../share/common.sh - -JAVA_OPTS="${JAVA_OPTS} -XX:-UseGCOverheadLimit -Xmx1G" - -DUMPFILE=heap.bin - -rm -f ${DUMPFILE} - -JMAP_DUMP_OPT="-dump:format=b,file=${DUMPFILE}" - -${JAVA} ${JAVA_OPTS} heapdump.share.EatMemory -exec "${JMAP} ${JMAP_DUMP_OPT} %p" - -status=$? - -if [ $status -ne 0 ]; then - fail "Java exited with exit status: $status" -fi - -if [ ! -f "${DUMPFILE}" ]; then - fail "Dump file was not created: $DUMPFILE" -fi - -verify_heapdump ${DUMPFILE} - -if [ $? -ne 0 ]; then - fail "Verification of heap dump failed" -fi - -pass diff --git a/test/hotspot/jtreg/vmTestbase/heapdump/JMapHeapCore/TestDescription.java b/test/hotspot/jtreg/vmTestbase/heapdump/JMapHeapCore/TestDescription.java deleted file mode 100644 --- a/test/hotspot/jtreg/vmTestbase/heapdump/JMapHeapCore/TestDescription.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (c) 2017, 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 - * - * @summary converted from VM testbase heapdump/JMapHeapCore. - * VM testbase keywords: [heapdump, feature_heapdump, nonconcurrent.jdk, quick, quarantine] - * VM testbase comments: JDK-8023376 JDK-8001227 JDK-8051445 - * VM testbase readme: - * DESCRIPTION - * This test verifies that heap dump created by jhsdb is able to be - * parsed by HprofParser. It fills the heap with objects of different types - * till OutOfMemoryError, forces core dump, then uses jhsdb on core file - * to create heap dump and then verifies created heap dump with HprofParser. - * - * @library /vmTestbase - * /test/lib - * @run driver jdk.test.lib.FileInstaller . . - * @build jdk.test.lib.hprof.HprofParser - * heapdump.share.EatMemory - * @run shell/timeout=300 run.sh - */ - diff --git a/test/hotspot/jtreg/vmTestbase/heapdump/JMapHeapCore/run.sh b/test/hotspot/jtreg/vmTestbase/heapdump/JMapHeapCore/run.sh deleted file mode 100644 --- a/test/hotspot/jtreg/vmTestbase/heapdump/JMapHeapCore/run.sh +++ /dev/null @@ -1,88 +0,0 @@ -#!/bin/sh -# -# Copyright (c) 2007, 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. -# - -. $TESTSRC/../share/common.sh - -JAVA_OPTS="${JAVA_OPTS} -XX:-UseGCOverheadLimit -XX:-TransmitErrorReport" - -if [ $CORE_SUPPORTED -eq 0 ]; then - pass "Core dump is not supported" -fi - -DUMPFILE=heap.bin - -rm -f ${DUMPFILE} - -ulimit -c unlimited || true - -echo "Below 'Unexpected error' is actually expected - JVM is forced to dump core" -${JAVA} ${JAVA_OPTS} heapdump.share.EatMemory -core & - -pid=$! - -wait $pid - -status=$? - -if [ $status -eq 0 ]; then - pass "Java exited with exit status: $status" -fi - -for CORE in core* /cores/core.$pid; do - [ -e "$CORE" ] && break; -done - -if [ ! -f "$CORE" ]; then - fail "Java exited with exit status: $status, but core file was not created" -fi -echo "Found core file: $CORE" - -JMAP_DUMP_OPT="--binaryheap --dumpfile=${DUMPFILE}" -EXE_OPT="--exe" -CORE_OPT="--core" -JHSDB_OPT="jmap" - -${JHSDB} ${JHSDB_OPT} ${JMAP_DUMP_OPT} ${EXE_OPT} ${JAVA} ${CORE_OPT} ${CORE} - -status=$? -if [ $status -ne 0 ]; then - fail "jmap exited with exit status $status" -fi - -if [ ! -f "${DUMPFILE}" ]; then - fail "Dump file was not created: $DUMPFILE" -fi - -verify_heapdump ${DUMPFILE} - -if [ $? -ne 0 ]; then - fail "Verification of heap dump failed" -fi - -if [ "$TEST_CLEANUP" != "false" ]; then - rm -f ${CORE} - rm -f hs_err_pid* -fi - -pass diff --git a/test/hotspot/jtreg/vmTestbase/heapdump/JMapMetaspace/TEST.properties b/test/hotspot/jtreg/vmTestbase/heapdump/JMapMetaspace/TEST.properties deleted file mode 100644 --- a/test/hotspot/jtreg/vmTestbase/heapdump/JMapMetaspace/TEST.properties +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright (c) 2017, 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. -# -exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/heapdump/JMapMetaspace/TestDescription.java b/test/hotspot/jtreg/vmTestbase/heapdump/JMapMetaspace/TestDescription.java deleted file mode 100644 --- a/test/hotspot/jtreg/vmTestbase/heapdump/JMapMetaspace/TestDescription.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (c) 2017, 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 - * - * @summary converted from VM testbase heapdump/JMapMetaspace. - * VM testbase keywords: [heapdump, feature_heapdump, nonconcurrent, jdk, quick] - * VM testbase readme: - * DESCRIPTION - * This test verifies that heap dump created by JMap is able to be - * parsed by HprofParser. It fills metaspace with classes till OutOfMemoryError, - * then uses JMap to create heap dump and then verifies created heap dump with HprofParser. - * - * @library /vmTestbase - * /test/lib - * @run driver jdk.test.lib.FileInstaller . . - * @build jdk.test.lib.hprof.HprofParser - * heapdump.share.EatMemory - * @run shell/timeout=300 run.sh - */ - diff --git a/test/hotspot/jtreg/vmTestbase/heapdump/JMapMetaspace/run.sh b/test/hotspot/jtreg/vmTestbase/heapdump/JMapMetaspace/run.sh deleted file mode 100644 --- a/test/hotspot/jtreg/vmTestbase/heapdump/JMapMetaspace/run.sh +++ /dev/null @@ -1,53 +0,0 @@ -#!/bin/sh -# -# Copyright (c) 2014, 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. -# - -. $TESTSRC/../share/common.sh - -JAVA_OPTS="${JAVA_OPTS} -XX:-UseGCOverheadLimit -XX:MaxMetaspaceSize=64m" - -DUMPFILE=heap.bin - -rm -f ${DUMPFILE} - -JMAP_DUMP_OPT="-dump:format=b,file=${DUMPFILE}" - -${JAVA} ${JAVA_OPTS} heapdump.share.EatMemory -metaspace -exec "${JMAP} ${JMAP_DUMP_OPT} %p" - -status=$? - -if [ $status -ne 0 ]; then - fail "Java exited with exit status: $status" -fi - -if [ ! -f "${DUMPFILE}" ]; then - fail "Dump file was not created: ${DUMPFILE}" -fi - -verify_heapdump ${DUMPFILE} - -if [ $? -ne 0 ]; then - fail "Verification of heap dump failed" -fi - -pass diff --git a/test/hotspot/jtreg/vmTestbase/heapdump/JMapMetaspaceCore/TEST.properties b/test/hotspot/jtreg/vmTestbase/heapdump/JMapMetaspaceCore/TEST.properties deleted file mode 100644 --- a/test/hotspot/jtreg/vmTestbase/heapdump/JMapMetaspaceCore/TEST.properties +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright (c) 2017, 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. -# -exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/heapdump/JMapMetaspaceCore/TestDescription.java b/test/hotspot/jtreg/vmTestbase/heapdump/JMapMetaspaceCore/TestDescription.java deleted file mode 100644 --- a/test/hotspot/jtreg/vmTestbase/heapdump/JMapMetaspaceCore/TestDescription.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (c) 2017, 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 - * - * @summary converted from VM testbase heapdump/JMapMetaspaceCore. - * VM testbase keywords: [heapdump, feature_heapdump, nonconcurrent, jdk, quarantine] - * VM testbase comments: JDK-8023376 JDK-8001227 JDK-8051445 - * VM testbase readme: - * DESCRIPTION - * This test verifies that heap dump created by jhsdb is able to be - * parsed by HprofParser. It fills metaspace with classes till OutOfMemoryError, - * forces core dump, then uses jhsdb one core file to create heap dump - * and then verifies created heap dump with HprofParser. - * - * @library /vmTestbase - * /test/lib - * @run driver jdk.test.lib.FileInstaller . . - * @build jdk.test.lib.hprof.HprofParser - * heapdump.share.EatMemory - * @run shell/timeout=300 run.sh - */ - diff --git a/test/hotspot/jtreg/vmTestbase/heapdump/JMapMetaspaceCore/run.sh b/test/hotspot/jtreg/vmTestbase/heapdump/JMapMetaspaceCore/run.sh deleted file mode 100644 --- a/test/hotspot/jtreg/vmTestbase/heapdump/JMapMetaspaceCore/run.sh +++ /dev/null @@ -1,90 +0,0 @@ -#!/bin/sh -# -# Copyright (c) 2014, 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. -# - -. $TESTSRC/../share/common.sh - -JAVA_OPTS="${JAVA_OPTS} -XX:-UseGCOverheadLimit -XX:MaxMetaspaceSize=64m -XX:-TransmitErrorReport" - -if [ $CORE_SUPPORTED -eq 0 ]; then - pass "Core dump is not supported" -fi - -DUMPFILE=heap.bin - -rm -f ${DUMPFILE} - -ulimit -c unlimited || true - -echo "Below 'Unexpected error' is actually expected - JVM is forced to dump core" - -${JAVA} ${JAVA_OPTS} heapdump.share.EatMemory -metaspace -core & - -pid=$! - -wait $pid - -status=$? - -if [ $status -eq 0 ]; then - pass "Java exited with exit status: $status" -fi - -for CORE in core* /cores/core.$pid; do - [ -e "$CORE" ] && break; -done - -if [ ! -f "$CORE" ]; then - fail "Java exited with exit status $status, but core file was not created" -fi - -echo "Found core file: $CORE" - -JMAP_DUMP_OPT="--binaryheap --dumpfile=${DUMPFILE}" -EXE_OPT="--exe" -CORE_OPT="--core" -JHSDB_OPT="jmap" - -${JHSDB} ${JHSDB_OPT} ${JMAP_DUMP_OPT} ${EXE_OPT} ${JAVA} ${CORE_OPT} ${CORE} - -status=$? -if [ $status -ne 0 ]; then - fail "jmap exited with exit status $status" -fi - -if [ ! -f "${DUMPFILE}" ]; then - fail "Dump file was not created: $DUMPFILE" -fi - -verify_heapdump ${DUMPFILE} - -if [ $? -ne 0 ]; then - fail "Verification of heap dump failed" -fi - -if [ "$TEST_CLEANUP" != "false" ]; then - rm -f ${CORE} - rm -f hs_err_pid* -fi - -pass diff --git a/test/hotspot/jtreg/vmTestbase/heapdump/OnOOMToFile/TEST.properties b/test/hotspot/jtreg/vmTestbase/heapdump/OnOOMToFile/TEST.properties deleted file mode 100644 --- a/test/hotspot/jtreg/vmTestbase/heapdump/OnOOMToFile/TEST.properties +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright (c) 2017, 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. -# -exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/heapdump/OnOOMToFile/TestDescription.java b/test/hotspot/jtreg/vmTestbase/heapdump/OnOOMToFile/TestDescription.java deleted file mode 100644 --- a/test/hotspot/jtreg/vmTestbase/heapdump/OnOOMToFile/TestDescription.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (c) 2017, 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 - * - * @summary converted from VM testbase heapdump/OnOOMToFile. - * VM testbase keywords: [heapdump, feature_heapdump, nonconcurrent, jdk, quick] - * VM testbase readme: - * DESCRIPTION - * This test verifies -XX:+HeapDumpOnOutOfMemory VM option. It - * fills the heap with objects of different types till OutOfMemoryError - * and then verifies created heap dump with HprofParser. - * COMMENTS - * This test uses -XX:HeapDumpPath= option pointing to file. - * - * @library /vmTestbase - * /test/lib - * @run driver jdk.test.lib.FileInstaller . . - * @build jdk.test.lib.hprof.HprofParser - * heapdump.share.EatMemory - * @run shell/timeout=300 run.sh - */ - diff --git a/test/hotspot/jtreg/vmTestbase/heapdump/OnOOMToFile/run.sh b/test/hotspot/jtreg/vmTestbase/heapdump/OnOOMToFile/run.sh deleted file mode 100644 --- a/test/hotspot/jtreg/vmTestbase/heapdump/OnOOMToFile/run.sh +++ /dev/null @@ -1,53 +0,0 @@ -#!/bin/sh -# -# Copyright (c) 2007, 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. -# - -. $TESTSRC/../share/common.sh - -JAVA_OPTS="${JAVA_OPTS} -XX:-UseGCOverheadLimit" - -DUMPFILE=${DUMPBASE}/java.hprof - -rm -f ${DUMPFILE} - -JAVA_OPTS="${JAVA_OPTS} -Xmx`get_max_heap_size $JAVA_OPTS`" - -${JAVA} ${JAVA_OPTS} -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=${DUMPFILE} heapdump.share.EatMemory - -status=$? - -if [ $status -ne 0 ]; then - fail "Java command exited with exit status $status" -fi - -if [ ! -f "${DUMPFILE}" ]; then - fail "Dump file was not created: ${DUMPFILE}" -fi - -verify_heapdump ${DUMPFILE} - -if [ $? -ne 0 ]; then - fail "Verification of heap dump failed" -fi - -pass diff --git a/test/hotspot/jtreg/vmTestbase/heapdump/OnOOMToFileMetaspace/TEST.properties b/test/hotspot/jtreg/vmTestbase/heapdump/OnOOMToFileMetaspace/TEST.properties deleted file mode 100644 --- a/test/hotspot/jtreg/vmTestbase/heapdump/OnOOMToFileMetaspace/TEST.properties +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright (c) 2017, 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. -# -exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/heapdump/OnOOMToFileMetaspace/TestDescription.java b/test/hotspot/jtreg/vmTestbase/heapdump/OnOOMToFileMetaspace/TestDescription.java deleted file mode 100644 --- a/test/hotspot/jtreg/vmTestbase/heapdump/OnOOMToFileMetaspace/TestDescription.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (c) 2017, 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 - * - * @summary converted from VM testbase heapdump/OnOOMToFileMetaspace. - * VM testbase keywords: [heapdump, feature_heapdump, nonconcurrent, jdk, quick] - * VM testbase readme: - * DESCRIPTION - * This test verifies -XX:+HeapDumpOnOutOfMemory VM option. It fills - * metaspace with classes till OutOfMemoryError is thrown and then - * verifies create heap dump with HprofParser. - * COMMENTS - * This test uses -XX:HeapDumpPath= option pointing to file. - * - * @library /vmTestbase - * /test/lib - * @run driver jdk.test.lib.FileInstaller . . - * @build jdk.test.lib.hprof.HprofParser - * heapdump.share.EatMemory - * @run shell/timeout=300 run.sh - */ - diff --git a/test/hotspot/jtreg/vmTestbase/heapdump/OnOOMToFileMetaspace/run.sh b/test/hotspot/jtreg/vmTestbase/heapdump/OnOOMToFileMetaspace/run.sh deleted file mode 100644 --- a/test/hotspot/jtreg/vmTestbase/heapdump/OnOOMToFileMetaspace/run.sh +++ /dev/null @@ -1,53 +0,0 @@ -#!/bin/sh -# -# Copyright (c) 2014, 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. -# - -. $TESTSRC/../share/common.sh - -JAVA_OPTS="${JAVA_OPTS} -XX:-UseGCOverheadLimit -XX:MaxMetaspaceSize=64m" - -DUMPFILE=${DUMPBASE}/java.hprof - -rm -f ${DUMPFILE} - -JAVA_OPTS="${JAVA_OPTS} -Xmx`get_max_heap_size $JAVA_OPTS`" - -${JAVA} ${JAVA_OPTS} -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=${DUMPFILE} heapdump.share.EatMemory -metaspace - -status=$? - -if [ $status -ne 0 ]; then - fail "Java command exited with exit status $status" -fi - -if [ ! -f "${DUMPFILE}" ]; then - fail "Dump file was not created: ${DUMPFILE}" -fi - -verify_heapdump ${DUMPFILE} - -if [ $? -ne 0 ]; then - fail "Verification of heap dump failed" -fi - -pass diff --git a/test/hotspot/jtreg/vmTestbase/heapdump/OnOOMToPath/TEST.properties b/test/hotspot/jtreg/vmTestbase/heapdump/OnOOMToPath/TEST.properties deleted file mode 100644 --- a/test/hotspot/jtreg/vmTestbase/heapdump/OnOOMToPath/TEST.properties +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright (c) 2017, 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. -# -exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/heapdump/OnOOMToPath/TestDescription.java b/test/hotspot/jtreg/vmTestbase/heapdump/OnOOMToPath/TestDescription.java deleted file mode 100644 --- a/test/hotspot/jtreg/vmTestbase/heapdump/OnOOMToPath/TestDescription.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (c) 2017, 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 - * - * @summary converted from VM testbase heapdump/OnOOMToPath. - * VM testbase keywords: [heapdump, feature_heapdump, nonconcurrent, jdk, quick] - * VM testbase readme: - * DESCRIPTION - * This test verifies -XX:+HeapDumpOnOutOfMemory VM option. It - * fills the heap with objects of different types till OutOfMemoryError - * and then verifies created heap dump with HprofParser. - * COMMENTS - * This test uses -XX:HeapDumpPath= option pointing to directory in which - * heap dump file should be created. - * - * @library /vmTestbase - * /test/lib - * @run driver jdk.test.lib.FileInstaller . . - * @build jdk.test.lib.hprof.HprofParser - * heapdump.share.EatMemory - * @run shell/timeout=300 run.sh - */ - diff --git a/test/hotspot/jtreg/vmTestbase/heapdump/OnOOMToPath/run.sh b/test/hotspot/jtreg/vmTestbase/heapdump/OnOOMToPath/run.sh deleted file mode 100644 --- a/test/hotspot/jtreg/vmTestbase/heapdump/OnOOMToPath/run.sh +++ /dev/null @@ -1,57 +0,0 @@ -#!/bin/sh -# -# Copyright (c) 2007, 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. -# - -. $TESTSRC/../share/common.sh - -JAVA_OPTS="${JAVA_OPTS} -XX:-UseGCOverheadLimit" - -DUMPPATH=${DUMPBASE}/dumps - -rm -rf ${DUMPPATH} - -mkdir -p ${DUMPPATH} - -JAVA_OPTS="${JAVA_OPTS} -Xmx`get_max_heap_size $JAVA_OPTS`" - -${JAVA} ${JAVA_OPTS} -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=${DUMPPATH} heapdump.share.EatMemory - -status=$? - -if [ $status -ne 0 ]; then - fail "Java command exited with exit status $status" -fi - -DUMPFILE=`ls ${DUMPPATH}/*` - -if [ ! -f "${DUMPFILE}" ]; then - fail "Dump file was not created: $DUMPPATH/\*" -fi - -verify_heapdump ${DUMPFILE} - -if [ $? -ne 0 ]; then - fail "Verification of heap dump failed" -fi - -pass diff --git a/test/hotspot/jtreg/vmTestbase/heapdump/README b/test/hotspot/jtreg/vmTestbase/heapdump/README deleted file mode 100644 --- a/test/hotspot/jtreg/vmTestbase/heapdump/README +++ /dev/null @@ -1,38 +0,0 @@ -Copyright (c) 2007, 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. - -heapdump/JMapHeap - test for heapdump for jmap on live process -heapdump/JMapHeapCore - test for heap for jmap on core file -heapdump/JMapMetaspace - test for heapdump for jmap on live process, fills metaspace with classes -heapdump/JMapMetaspaceCore - test for heap for jmap on core file, fills metaspace with classes -heapdump/OnOOMToFile - test for -XX:+HeapDumpOnOutOfMemoryError and -XX:HeapDumpPath option - for file. This test fills heap with objects of different types. -heapdump/OnOOMToFileMetaspace - the same test as OnOOMToFile, but it fills metaspace with classes -heapdump/OnOOMToPath - the same test as OnOOMToFile for -XX:HeapDumpPath option that points to directory -heapdump/OnOOMRun - test for -XX:OnOutOfMemoryError option diff --git a/test/hotspot/jtreg/vmTestbase/heapdump/share/EatMemory.java b/test/hotspot/jtreg/vmTestbase/heapdump/share/EatMemory.java deleted file mode 100644 --- a/test/hotspot/jtreg/vmTestbase/heapdump/share/EatMemory.java +++ /dev/null @@ -1,262 +0,0 @@ -/* - * Copyright (c) 2007, 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. - */ - -package heapdump.share; - -import java.util.List; -import java.util.ArrayList; -import java.io.InputStreamReader; -import java.io.BufferedReader; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.util.Random; - -import vm.share.ProcessUtils; - -import java.util.LinkedList; - -import nsk.share.gc.gp.classload.GeneratedClassProducer; - -/** - * This test eats memory by generating random garbage. - *
- * This program can eat either heap or metaspace using - * interned strings depending on parameter metaspace. After this, it - * can also force JVM to show dump, dump core or execute some command. - * The following command line switches are supported: - *
- * "-sleepTime" time to sleep
- * "-signal" show dump after OOM
- * "-metaspace" eat metaspace
- * "-core" dump core after OOM
- * "-exec command" execute command after OOM
- */
-public class EatMemory {
- private long sleepTime;
- private boolean signal;
- private boolean metaspace;
- private boolean core;
- private String exec;
- private final BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
- private long initialFactor = 50;
- private long minChunk = 1000;
- private long factor = 5;
- private long chunk;
- private Runtime runtime = Runtime.getRuntime();
- private int n = 0;
- private final int arrayExtraSize = 12;
- private final int stringLength = 128;
- private byte[] reserved = new byte[(int) (runtime.maxMemory() / 20)];
- private List storage = new ArrayList();
- private List strings = new ArrayList();
-
- /**
- * @param sleepTime time to sleep
- * @param signal true if need to force JVM to show dump (Ctrl-Break / Ctrl-/) after OOM
- * @param metaspace true if need to eat metaspace
- * @param core true if need to force JVM to dump core
- * @param exec command to execute after OOM
- */
- public EatMemory(long sleepTime, boolean signal, boolean metaspace, boolean core, String exec) {
- this.sleepTime = sleepTime;
- this.signal = signal;
- this.metaspace = metaspace;
- this.core = core;
- this.exec = exec;
- }
-
- private int getSize(long chunk, long factor) {
- return (int) Math.min(Integer.MAX_VALUE, (chunk - arrayExtraSize) / factor);
- }
-
- private Object create(long chunk) {
- switch (++n % 8) {
- case 0:
- return new byte[getSize(chunk, 1)];
- case 1:
- return new short[getSize(chunk, 2)];
- case 2:
- return new char[getSize(chunk, 2)];
- case 3:
- return new boolean[getSize(chunk, 1)];
- case 4:
- return new long[getSize(chunk, 8)];
- case 5:
- return new float[getSize(chunk, 4)];
- case 6:
- return new double[getSize(chunk, 8)];
- case 7:
- return new Object[getSize(chunk, 16)];
- default:
- // Should never happen
- return null;
- }
- }
-
-
- public void eatHeap() {
- try {
- int[][] arrays = new int[Integer.MAX_VALUE / 2][];
- for (int i = 0; ; ++i) {
- arrays[i] = new int[Integer.MAX_VALUE / 2];
- }
- } catch (OutOfMemoryError x) {
- reserved = null;
- }
- }
-
- public void eatMetaspace() {
- try {
- System.out.println("Starting eating metaspace...");
- GeneratedClassProducer gp = new GeneratedClassProducer();
- List