author | ykantser |
Mon, 04 May 2015 16:30:07 +0200 | |
changeset 30604 | b8d532cb6420 |
parent 29678 | dd2f3932c21e |
child 33069 | d8eed614f298 |
permissions | -rw-r--r-- |
28720
76473974643b
8069389: CompilerOracle prefix wildcarding is broken for long strings
neliasso
parents:
diff
changeset
|
1 |
/* |
76473974643b
8069389: CompilerOracle prefix wildcarding is broken for long strings
neliasso
parents:
diff
changeset
|
2 |
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. |
76473974643b
8069389: CompilerOracle prefix wildcarding is broken for long strings
neliasso
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
76473974643b
8069389: CompilerOracle prefix wildcarding is broken for long strings
neliasso
parents:
diff
changeset
|
4 |
* |
76473974643b
8069389: CompilerOracle prefix wildcarding is broken for long strings
neliasso
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
76473974643b
8069389: CompilerOracle prefix wildcarding is broken for long strings
neliasso
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
76473974643b
8069389: CompilerOracle prefix wildcarding is broken for long strings
neliasso
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
76473974643b
8069389: CompilerOracle prefix wildcarding is broken for long strings
neliasso
parents:
diff
changeset
|
8 |
* |
76473974643b
8069389: CompilerOracle prefix wildcarding is broken for long strings
neliasso
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
76473974643b
8069389: CompilerOracle prefix wildcarding is broken for long strings
neliasso
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
76473974643b
8069389: CompilerOracle prefix wildcarding is broken for long strings
neliasso
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
76473974643b
8069389: CompilerOracle prefix wildcarding is broken for long strings
neliasso
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
76473974643b
8069389: CompilerOracle prefix wildcarding is broken for long strings
neliasso
parents:
diff
changeset
|
13 |
* accompanied this code). |
76473974643b
8069389: CompilerOracle prefix wildcarding is broken for long strings
neliasso
parents:
diff
changeset
|
14 |
* |
76473974643b
8069389: CompilerOracle prefix wildcarding is broken for long strings
neliasso
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
76473974643b
8069389: CompilerOracle prefix wildcarding is broken for long strings
neliasso
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
76473974643b
8069389: CompilerOracle prefix wildcarding is broken for long strings
neliasso
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
76473974643b
8069389: CompilerOracle prefix wildcarding is broken for long strings
neliasso
parents:
diff
changeset
|
18 |
* |
76473974643b
8069389: CompilerOracle prefix wildcarding is broken for long strings
neliasso
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
76473974643b
8069389: CompilerOracle prefix wildcarding is broken for long strings
neliasso
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
76473974643b
8069389: CompilerOracle prefix wildcarding is broken for long strings
neliasso
parents:
diff
changeset
|
21 |
* questions. |
76473974643b
8069389: CompilerOracle prefix wildcarding is broken for long strings
neliasso
parents:
diff
changeset
|
22 |
*/ |
76473974643b
8069389: CompilerOracle prefix wildcarding is broken for long strings
neliasso
parents:
diff
changeset
|
23 |
|
76473974643b
8069389: CompilerOracle prefix wildcarding is broken for long strings
neliasso
parents:
diff
changeset
|
24 |
import java.io.PrintWriter; |
76473974643b
8069389: CompilerOracle prefix wildcarding is broken for long strings
neliasso
parents:
diff
changeset
|
25 |
import java.io.File; |
76473974643b
8069389: CompilerOracle prefix wildcarding is broken for long strings
neliasso
parents:
diff
changeset
|
26 |
|
30604
b8d532cb6420
8067013: Rename the com.oracle.java.testlibary package
ykantser
parents:
29678
diff
changeset
|
27 |
import jdk.test.lib.*; |
28720
76473974643b
8069389: CompilerOracle prefix wildcarding is broken for long strings
neliasso
parents:
diff
changeset
|
28 |
|
76473974643b
8069389: CompilerOracle prefix wildcarding is broken for long strings
neliasso
parents:
diff
changeset
|
29 |
/* |
76473974643b
8069389: CompilerOracle prefix wildcarding is broken for long strings
neliasso
parents:
diff
changeset
|
30 |
* @test TestCompileCommand |
76473974643b
8069389: CompilerOracle prefix wildcarding is broken for long strings
neliasso
parents:
diff
changeset
|
31 |
* @bug 8069389 |
76473974643b
8069389: CompilerOracle prefix wildcarding is broken for long strings
neliasso
parents:
diff
changeset
|
32 |
* @summary "Regression tests of -XX:CompileCommand" |
76473974643b
8069389: CompilerOracle prefix wildcarding is broken for long strings
neliasso
parents:
diff
changeset
|
33 |
* @library /testlibrary |
29678
dd2f3932c21e
8075586: Add @modules as needed to the open hotspot tests
ykantser
parents:
28720
diff
changeset
|
34 |
* @modules java.base/sun.misc |
dd2f3932c21e
8075586: Add @modules as needed to the open hotspot tests
ykantser
parents:
28720
diff
changeset
|
35 |
* java.management |
28720
76473974643b
8069389: CompilerOracle prefix wildcarding is broken for long strings
neliasso
parents:
diff
changeset
|
36 |
* @run main TestCompileCommand |
76473974643b
8069389: CompilerOracle prefix wildcarding is broken for long strings
neliasso
parents:
diff
changeset
|
37 |
*/ |
76473974643b
8069389: CompilerOracle prefix wildcarding is broken for long strings
neliasso
parents:
diff
changeset
|
38 |
|
76473974643b
8069389: CompilerOracle prefix wildcarding is broken for long strings
neliasso
parents:
diff
changeset
|
39 |
public class TestCompileCommand { |
76473974643b
8069389: CompilerOracle prefix wildcarding is broken for long strings
neliasso
parents:
diff
changeset
|
40 |
|
76473974643b
8069389: CompilerOracle prefix wildcarding is broken for long strings
neliasso
parents:
diff
changeset
|
41 |
private static final String[][] ARGUMENTS = { |
76473974643b
8069389: CompilerOracle prefix wildcarding is broken for long strings
neliasso
parents:
diff
changeset
|
42 |
{ |
76473974643b
8069389: CompilerOracle prefix wildcarding is broken for long strings
neliasso
parents:
diff
changeset
|
43 |
"-XX:CompileCommand=print,*01234567890123456789012345678901234567890123456789,*0123456789012345678901234567890123456789", |
76473974643b
8069389: CompilerOracle prefix wildcarding is broken for long strings
neliasso
parents:
diff
changeset
|
44 |
"-version" |
76473974643b
8069389: CompilerOracle prefix wildcarding is broken for long strings
neliasso
parents:
diff
changeset
|
45 |
} |
76473974643b
8069389: CompilerOracle prefix wildcarding is broken for long strings
neliasso
parents:
diff
changeset
|
46 |
}; |
76473974643b
8069389: CompilerOracle prefix wildcarding is broken for long strings
neliasso
parents:
diff
changeset
|
47 |
|
76473974643b
8069389: CompilerOracle prefix wildcarding is broken for long strings
neliasso
parents:
diff
changeset
|
48 |
private static final String[][] OUTPUTS = { |
76473974643b
8069389: CompilerOracle prefix wildcarding is broken for long strings
neliasso
parents:
diff
changeset
|
49 |
{ |
76473974643b
8069389: CompilerOracle prefix wildcarding is broken for long strings
neliasso
parents:
diff
changeset
|
50 |
"print *01234567890123456789012345678901234567890123456789.*0123456789012345678901234567890123456789" |
76473974643b
8069389: CompilerOracle prefix wildcarding is broken for long strings
neliasso
parents:
diff
changeset
|
51 |
} |
76473974643b
8069389: CompilerOracle prefix wildcarding is broken for long strings
neliasso
parents:
diff
changeset
|
52 |
}; |
76473974643b
8069389: CompilerOracle prefix wildcarding is broken for long strings
neliasso
parents:
diff
changeset
|
53 |
|
76473974643b
8069389: CompilerOracle prefix wildcarding is broken for long strings
neliasso
parents:
diff
changeset
|
54 |
private static void verifyValidOption(String[] arguments, String[] expected_outputs) throws Exception { |
76473974643b
8069389: CompilerOracle prefix wildcarding is broken for long strings
neliasso
parents:
diff
changeset
|
55 |
ProcessBuilder pb; |
76473974643b
8069389: CompilerOracle prefix wildcarding is broken for long strings
neliasso
parents:
diff
changeset
|
56 |
OutputAnalyzer out; |
76473974643b
8069389: CompilerOracle prefix wildcarding is broken for long strings
neliasso
parents:
diff
changeset
|
57 |
|
76473974643b
8069389: CompilerOracle prefix wildcarding is broken for long strings
neliasso
parents:
diff
changeset
|
58 |
pb = ProcessTools.createJavaProcessBuilder(arguments); |
76473974643b
8069389: CompilerOracle prefix wildcarding is broken for long strings
neliasso
parents:
diff
changeset
|
59 |
out = new OutputAnalyzer(pb.start()); |
76473974643b
8069389: CompilerOracle prefix wildcarding is broken for long strings
neliasso
parents:
diff
changeset
|
60 |
|
76473974643b
8069389: CompilerOracle prefix wildcarding is broken for long strings
neliasso
parents:
diff
changeset
|
61 |
for (String expected_output : expected_outputs) { |
76473974643b
8069389: CompilerOracle prefix wildcarding is broken for long strings
neliasso
parents:
diff
changeset
|
62 |
out.shouldContain(expected_output); |
76473974643b
8069389: CompilerOracle prefix wildcarding is broken for long strings
neliasso
parents:
diff
changeset
|
63 |
} |
76473974643b
8069389: CompilerOracle prefix wildcarding is broken for long strings
neliasso
parents:
diff
changeset
|
64 |
|
76473974643b
8069389: CompilerOracle prefix wildcarding is broken for long strings
neliasso
parents:
diff
changeset
|
65 |
out.shouldNotContain("CompileCommand: An error occured during parsing"); |
76473974643b
8069389: CompilerOracle prefix wildcarding is broken for long strings
neliasso
parents:
diff
changeset
|
66 |
out.shouldHaveExitValue(0); |
76473974643b
8069389: CompilerOracle prefix wildcarding is broken for long strings
neliasso
parents:
diff
changeset
|
67 |
} |
76473974643b
8069389: CompilerOracle prefix wildcarding is broken for long strings
neliasso
parents:
diff
changeset
|
68 |
|
76473974643b
8069389: CompilerOracle prefix wildcarding is broken for long strings
neliasso
parents:
diff
changeset
|
69 |
public static void main(String[] args) throws Exception { |
76473974643b
8069389: CompilerOracle prefix wildcarding is broken for long strings
neliasso
parents:
diff
changeset
|
70 |
|
76473974643b
8069389: CompilerOracle prefix wildcarding is broken for long strings
neliasso
parents:
diff
changeset
|
71 |
if (ARGUMENTS.length != OUTPUTS.length) { |
76473974643b
8069389: CompilerOracle prefix wildcarding is broken for long strings
neliasso
parents:
diff
changeset
|
72 |
throw new RuntimeException("Test is set up incorrectly: length of arguments and expected outputs for type (1) options does not match."); |
76473974643b
8069389: CompilerOracle prefix wildcarding is broken for long strings
neliasso
parents:
diff
changeset
|
73 |
} |
76473974643b
8069389: CompilerOracle prefix wildcarding is broken for long strings
neliasso
parents:
diff
changeset
|
74 |
|
76473974643b
8069389: CompilerOracle prefix wildcarding is broken for long strings
neliasso
parents:
diff
changeset
|
75 |
// Check if type (1) options are parsed correctly |
76473974643b
8069389: CompilerOracle prefix wildcarding is broken for long strings
neliasso
parents:
diff
changeset
|
76 |
for (int i = 0; i < ARGUMENTS.length; i++) { |
76473974643b
8069389: CompilerOracle prefix wildcarding is broken for long strings
neliasso
parents:
diff
changeset
|
77 |
verifyValidOption(ARGUMENTS[i], OUTPUTS[i]); |
76473974643b
8069389: CompilerOracle prefix wildcarding is broken for long strings
neliasso
parents:
diff
changeset
|
78 |
} |
76473974643b
8069389: CompilerOracle prefix wildcarding is broken for long strings
neliasso
parents:
diff
changeset
|
79 |
} |
76473974643b
8069389: CompilerOracle prefix wildcarding is broken for long strings
neliasso
parents:
diff
changeset
|
80 |
} |