|
| 1 | +/* |
| 2 | + * Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. |
| 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 8257800 |
| 27 | + * @summary Tests CompileCommand=option,package/class,ccstrlist,ControlIntrinsic,+_id |
| 28 | + * @library /test/lib / |
| 29 | + * |
| 30 | + * @run driver compiler.compilercontrol.commands.OptionTest |
| 31 | + */ |
| 32 | + |
| 33 | +package compiler.compilercontrol.commands; |
| 34 | + |
| 35 | +import jdk.test.lib.process.ProcessTools; |
| 36 | + |
| 37 | +public class OptionTest { |
| 38 | + public static void main(String[] args) throws Exception { |
| 39 | + ProcessTools.executeTestJvm("-XX:CompileCommand=option,package/class,ccstrlist,ControlIntrinsic,+_id", "-version") |
| 40 | + .shouldHaveExitValue(0) |
| 41 | + .shouldContain("CompileCommand: An error occurred during parsing") |
| 42 | + .shouldContain("Error: Did not specify any method name") |
| 43 | + .shouldNotContain("# A fatal error has been detected by the Java Runtime Environment"); |
| 44 | + |
| 45 | + ProcessTools.executeTestJvm("-XX:CompileCommand=option,*,ccstrlist,ControlIntrinsic,+_id", "-version") |
| 46 | + .shouldHaveExitValue(0) |
| 47 | + .shouldContain("CompileCommand: An error occurred during parsing") |
| 48 | + .shouldContain("Error: Did not specify any method name") |
| 49 | + .shouldNotContain("# A fatal error has been detected by the Java Runtime Environment"); |
| 50 | + |
| 51 | + // corner case: |
| 52 | + // ccstrlist could be a valid method name, so it is accepted in the well-formed case. |
| 53 | + ProcessTools.executeTestJvm("-XX:CompileCommand=option,*.ccstrlist,ccstrlist,ControlIntrinsic,+_id", "-version") |
| 54 | + .shouldContain("CompileCommand: ControlIntrinsic *.ccstrlist const char* ControlIntrinsic") |
| 55 | + .shouldHaveExitValue(0) |
| 56 | + .shouldNotContain("# A fatal error has been detected by the Java Runtime Environment"); |
| 57 | + |
| 58 | + ProcessTools.executeTestJvm("-XX:CompileCommand=option,*.*,ccstrlist,ControlIntrinsic,+_id", "-version") |
| 59 | + .shouldContain("CompileCommand: ControlIntrinsic *.* const char* ControlIntrinsic") |
| 60 | + .shouldHaveExitValue(0) |
| 61 | + .shouldNotContain("# A fatal error has been detected by the Java Runtime Environment"); |
| 62 | + |
| 63 | + ProcessTools.executeTestJvm("-XX:CompileCommand=option,class,PrintIntrinsics", "-version") |
| 64 | + .shouldHaveExitValue(0) |
| 65 | + .shouldNotContain("# A fatal error has been detected by the Java Runtime Environment"); |
| 66 | + |
| 67 | + // corner case: |
| 68 | + // PrintIntrinsics could be a valid method name, so it is accepted in the well-formed case. |
| 69 | + ProcessTools.executeTestJvm("-XX:CompileCommand=option,class.PrintIntrinsics,PrintIntrinsics", "-version") |
| 70 | + .shouldContain("CompileCommand: PrintIntrinsics class.PrintIntrinsics bool PrintIntrinsics = true") |
| 71 | + .shouldHaveExitValue(0) |
| 72 | + .shouldNotContain("# A fatal error has been detected by the Java Runtime Environment"); |
| 73 | + |
| 74 | + // corner case: |
| 75 | + // _dontinline_* is a valid method pattern, so it should be accepted |
| 76 | + ProcessTools.executeTestJvm("-XX:CompileCommand=dontinline,*::dontinline_*", "-version") |
| 77 | + .shouldContain("CompileCommand: dontinline *.dontinline_* bool dontinline = true") |
| 78 | + .shouldHaveExitValue(0) |
| 79 | + .shouldNotContain("# A fatal error has been detected by the Java Runtime Environment"); |
| 80 | + |
| 81 | + ProcessTools.executeTestJvm("-XX:CompileCommand=dontinline,*.dontinline", "-version") |
| 82 | + .shouldContain("CompileCommand: dontinline *.dontinline bool dontinline = true") |
| 83 | + .shouldHaveExitValue(0) |
| 84 | + .shouldNotContain("Error: Did not specify any method name") |
| 85 | + .shouldNotContain("# A fatal error has been detected by the Java Runtime Environment"); |
| 86 | + } |
| 87 | +} |
0 commit comments