Albert Noll | aef0d74 | 2013-10-10 15:44:12 +0200 | [diff] [blame] | 1 | /* |
Christian Tornqvist | ad85e18 | 2016-08-19 10:06:30 -0400 | [diff] [blame] | 2 | * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved. |
Albert Noll | aef0d74 | 2013-10-10 15:44:12 +0200 | [diff] [blame] | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
| 4 | * |
| 5 | * This code is free software; you can redistribute it and/or modify it |
| 6 | * under the terms of the GNU General Public License version 2 only, as |
| 7 | * published by the Free Software Foundation. |
| 8 | * |
| 9 | * This code is distributed in the hope that it will be useful, but WITHOUT |
| 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
| 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
| 12 | * version 2 for more details (a copy is included in the LICENSE file that |
| 13 | * accompanied this code). |
| 14 | * |
| 15 | * You should have received a copy of the GNU General Public License version |
| 16 | * 2 along with this work; if not, write to the Free Software Foundation, |
| 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
| 18 | * |
| 19 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
| 20 | * or visit www.oracle.com if you need additional information or have any |
| 21 | * questions. |
| 22 | */ |
| 23 | |
| 24 | /* |
| 25 | * @test |
| 26 | * @bug 8023014 |
Tobias Hartmann | f9806ff | 2014-12-04 09:52:15 +0100 | [diff] [blame] | 27 | * @summary Test ensures that there is no crash if there is not enough ReservedCodeCacheSize |
Albert Noll | 39b5a04 | 2014-02-26 07:44:59 +0100 | [diff] [blame] | 28 | * to initialize all compiler threads. The option -Xcomp gives the VM more time to |
Tobias Hartmann | f9806ff | 2014-12-04 09:52:15 +0100 | [diff] [blame] | 29 | * trigger the old bug. |
Christian Tornqvist | ad85e18 | 2016-08-19 10:06:30 -0400 | [diff] [blame] | 30 | * @library /test/lib |
Chris Hegarty | b7075c2 | 2016-04-09 23:03:39 +0100 | [diff] [blame] | 31 | * @modules java.base/jdk.internal.misc |
Alexander Kulyakthin | 01b9971 | 2015-03-26 16:36:56 +0100 | [diff] [blame] | 32 | * java.management |
Igor Ignatyev | a038142 | 2016-07-12 18:24:48 +0300 | [diff] [blame] | 33 | * |
Igor Ignatyev | a038142 | 2016-07-12 18:24:48 +0300 | [diff] [blame] | 34 | * @run driver compiler.startup.SmallCodeCacheStartup |
Albert Noll | aef0d74 | 2013-10-10 15:44:12 +0200 | [diff] [blame] | 35 | */ |
Igor Ignatyev | a038142 | 2016-07-12 18:24:48 +0300 | [diff] [blame] | 36 | |
| 37 | package compiler.startup; |
| 38 | |
Christian Tornqvist | ad85e18 | 2016-08-19 10:06:30 -0400 | [diff] [blame] | 39 | import jdk.test.lib.process.OutputAnalyzer; |
| 40 | import jdk.test.lib.process.ProcessTools; |
Igor Ignatyev | a038142 | 2016-07-12 18:24:48 +0300 | [diff] [blame] | 41 | |
Alexander Kulyakthin | 462f735 | 2015-05-04 16:30:07 +0200 | [diff] [blame] | 42 | import static jdk.test.lib.Asserts.assertTrue; |
Albert Noll | 6520320 | 2014-10-24 14:25:46 +0200 | [diff] [blame] | 43 | |
Albert Noll | aef0d74 | 2013-10-10 15:44:12 +0200 | [diff] [blame] | 44 | public class SmallCodeCacheStartup { |
Tobias Hartmann | f9806ff | 2014-12-04 09:52:15 +0100 | [diff] [blame] | 45 | public static void main(String[] args) throws Exception { |
| 46 | ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:ReservedCodeCacheSize=3m", |
| 47 | "-XX:CICompilerCount=64", |
| 48 | "-Xcomp", |
| 49 | "-version"); |
| 50 | OutputAnalyzer analyzer = new OutputAnalyzer(pb.start()); |
| 51 | try { |
| 52 | analyzer.shouldHaveExitValue(0); |
| 53 | } catch (RuntimeException e) { |
| 54 | // Error occurred during initialization, did we run out of adapter space? |
| 55 | assertTrue(analyzer.getOutput().contains("VirtualMachineError: Out of space in CodeCache"), |
| 56 | "Expected VirtualMachineError"); |
| 57 | } |
Albert Noll | 6520320 | 2014-10-24 14:25:46 +0200 | [diff] [blame] | 58 | |
Tobias Hartmann | f9806ff | 2014-12-04 09:52:15 +0100 | [diff] [blame] | 59 | System.out.println("TEST PASSED"); |
Albert Noll | aef0d74 | 2013-10-10 15:44:12 +0200 | [diff] [blame] | 60 | } |
| 61 | } |