Path: blob/aarch64-shenandoah-jdk8u272-b10/hotspot/test/runtime/ClassFile/OomWhileParsingRepeatedJsr.java
32284 views
/*1* Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 2 along with this work; if not, write to the Free Software Foundation,16* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17*18* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*/22232425/*26* @test OomWhileParsingRepeatedJsr27* @summary Testing class file parser; specifically parsing28* a file with repeated JSR (jump local subroutine)29* bytecode command.30* @bug 687871331* @bug 703061032* @bug 703712233* @bug 712394534* @bug 801602935* @library /testlibrary36* @run main OomWhileParsingRepeatedJsr37*/3839import com.oracle.java.testlibrary.*;404142public class OomWhileParsingRepeatedJsr {4344public static void main(String[] args) throws Exception {4546// ======= Configure the test47String jarFile = System.getProperty("test.src") + "/testcase.jar";48String className = "OOMCrashClass1960_2";4950// limit is 768MB in native words51int mallocMaxTestWords = (1024 * 1024 * 768 / 4);52if (Platform.is64bit())53mallocMaxTestWords = (mallocMaxTestWords / 2);5455// ======= extract the test class56ProcessBuilder pb = new ProcessBuilder(new String[] {57JDKToolFinder.getJDKTool("jar"),58"xvf", jarFile } );59OutputAnalyzer output = new OutputAnalyzer(pb.start());60output.shouldHaveExitValue(0);6162// ======= execute the test63pb = ProcessTools.createJavaProcessBuilder(64"-cp", ".",65"-XX:+UnlockDiagnosticVMOptions",66"-XX:MallocMaxTestWords=" + mallocMaxTestWords,67className );6869output = new OutputAnalyzer(pb.start());70output.shouldContain("Cannot reserve enough memory");71}72}73747576