mseledtsov@5685: /* mseledtsov@5685: * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. mseledtsov@5685: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. mseledtsov@5685: * mseledtsov@5685: * This code is free software; you can redistribute it and/or modify it mseledtsov@5685: * under the terms of the GNU General Public License version 2 only, as mseledtsov@5685: * published by the Free Software Foundation. mseledtsov@5685: * mseledtsov@5685: * This code is distributed in the hope that it will be useful, but WITHOUT mseledtsov@5685: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or mseledtsov@5685: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License mseledtsov@5685: * version 2 for more details (a copy is included in the LICENSE file that mseledtsov@5685: * accompanied this code). mseledtsov@5685: * mseledtsov@5685: * You should have received a copy of the GNU General Public License version mseledtsov@5685: * 2 along with this work; if not, write to the Free Software Foundation, mseledtsov@5685: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. mseledtsov@5685: * mseledtsov@5685: * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA mseledtsov@5685: * or visit www.oracle.com if you need additional information or have any mseledtsov@5685: * questions. mseledtsov@5685: */ kamg@2589: rdurbin@4802: rdurbin@4802: mseledtsov@5685: /* mseledtsov@5685: * @test OomWhileParsingRepeatedJsr mseledtsov@5685: * @summary Testing class file parser; specifically parsing mseledtsov@5685: * a file with repeated JSR (jump local subroutine) mseledtsov@5685: * bytecode command. mseledtsov@5685: * @bug 6878713 mseledtsov@5685: * @bug 7030610 mseledtsov@5685: * @bug 7037122 mseledtsov@5685: * @bug 7123945 mseledtsov@5685: * @bug 8016029 mseledtsov@5685: * @library /testlibrary mseledtsov@5685: * @run main OomWhileParsingRepeatedJsr mseledtsov@5685: */ kamg@2589: mseledtsov@5685: import com.oracle.java.testlibrary.*; kamg@2589: kamg@2589: mseledtsov@5685: public class OomWhileParsingRepeatedJsr { rdurbin@4802: mseledtsov@5685: public static void main(String[] args) throws Exception { rdurbin@4802: mseledtsov@5685: // ======= Configure the test mseledtsov@5685: String jarFile = System.getProperty("test.src") + "/testcase.jar"; mseledtsov@5685: String className = "OOMCrashClass1960_2"; rdurbin@4802: mseledtsov@5685: // limit is 768MB in native words mseledtsov@5685: int mallocMaxTestWords = (1024 * 1024 * 768 / 4); mseledtsov@5685: if (Platform.is64bit()) mseledtsov@5685: mallocMaxTestWords = (mallocMaxTestWords / 2); rdurbin@4802: mseledtsov@5685: // ======= extract the test class mseledtsov@5685: ProcessBuilder pb = new ProcessBuilder(new String[] { mseledtsov@5685: JDKToolFinder.getJDKTool("jar"), mseledtsov@5685: "xvf", jarFile } ); mseledtsov@5685: OutputAnalyzer output = new OutputAnalyzer(pb.start()); mseledtsov@5685: output.shouldHaveExitValue(0); rdurbin@4802: mseledtsov@5685: // ======= execute the test mseledtsov@5685: pb = ProcessTools.createJavaProcessBuilder( mseledtsov@5685: "-cp", ".", mseledtsov@5685: "-XX:+UnlockDiagnosticVMOptions", mseledtsov@5685: "-XX:MallocMaxTestWords=" + mallocMaxTestWords, mseledtsov@5685: className ); rdurbin@4802: mseledtsov@5685: output = new OutputAnalyzer(pb.start()); mseledtsov@5685: output.shouldContain("Cannot reserve enough memory"); mseledtsov@5685: } mseledtsov@5685: } rdurbin@4802: