author | neliasso |
Wed, 16 Mar 2016 10:45:43 +0100 | |
changeset 36796 | c751f445f5d4 |
parent 36321 | d3618f1ff1bb |
child 36851 | 03e2f4d0a421 |
permissions | -rw-r--r-- |
33451
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
diff
changeset
|
1 |
/* |
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
diff
changeset
|
2 |
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. |
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
diff
changeset
|
4 |
* |
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
diff
changeset
|
8 |
* |
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
diff
changeset
|
13 |
* accompanied this code). |
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
diff
changeset
|
14 |
* |
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
diff
changeset
|
18 |
* |
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
diff
changeset
|
21 |
* questions. |
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
diff
changeset
|
22 |
*/ |
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
diff
changeset
|
23 |
|
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
diff
changeset
|
24 |
/* |
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
diff
changeset
|
25 |
* @test TestCompilerDirectivesCompatibilityCommandOn |
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
diff
changeset
|
26 |
* @bug 8137167 |
36321
d3618f1ff1bb
8148159: [TESTBUG] TestCompilerDirectivesCompatibility tests fails on non-tiered server VMs
neliasso
parents:
35753
diff
changeset
|
27 |
* @library /testlibrary /test/lib / |
33451
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
diff
changeset
|
28 |
* @modules java.base/sun.misc |
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
diff
changeset
|
29 |
* java.compiler |
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
diff
changeset
|
30 |
* java.management |
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
diff
changeset
|
31 |
* @build jdk.test.lib.* |
36321
d3618f1ff1bb
8148159: [TESTBUG] TestCompilerDirectivesCompatibility tests fails on non-tiered server VMs
neliasso
parents:
35753
diff
changeset
|
32 |
* jdk.test.lib.dcmd.* |
d3618f1ff1bb
8148159: [TESTBUG] TestCompilerDirectivesCompatibility tests fails on non-tiered server VMs
neliasso
parents:
35753
diff
changeset
|
33 |
* sun.hotspot.WhiteBox |
d3618f1ff1bb
8148159: [TESTBUG] TestCompilerDirectivesCompatibility tests fails on non-tiered server VMs
neliasso
parents:
35753
diff
changeset
|
34 |
* compiler.testlibrary.CompilerUtils |
d3618f1ff1bb
8148159: [TESTBUG] TestCompilerDirectivesCompatibility tests fails on non-tiered server VMs
neliasso
parents:
35753
diff
changeset
|
35 |
* @run driver ClassFileInstaller sun.hotspot.WhiteBox |
d3618f1ff1bb
8148159: [TESTBUG] TestCompilerDirectivesCompatibility tests fails on non-tiered server VMs
neliasso
parents:
35753
diff
changeset
|
36 |
* sun.hotspot.WhiteBox$WhiteBoxPermission |
d3618f1ff1bb
8148159: [TESTBUG] TestCompilerDirectivesCompatibility tests fails on non-tiered server VMs
neliasso
parents:
35753
diff
changeset
|
37 |
* @run testng/othervm -Xbootclasspath/a:. -Xmixed -XX:+UnlockDiagnosticVMOptions |
33630
041b89e031c1
8141129: 3 compiler control tests fail on product builds
ppunegov
parents:
33451
diff
changeset
|
38 |
* -XX:-PrintAssembly -XX:CompileCommand=print,*.* -XX:+WhiteBoxAPI |
041b89e031c1
8141129: 3 compiler control tests fail on product builds
ppunegov
parents:
33451
diff
changeset
|
39 |
* TestCompilerDirectivesCompatibilityCommandOn |
33451
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
diff
changeset
|
40 |
* @summary Test compiler control compatibility with compile command |
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
diff
changeset
|
41 |
*/ |
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
diff
changeset
|
42 |
|
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
diff
changeset
|
43 |
import jdk.test.lib.dcmd.CommandExecutor; |
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
diff
changeset
|
44 |
import jdk.test.lib.dcmd.JMXExecutor; |
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
diff
changeset
|
45 |
|
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
diff
changeset
|
46 |
import org.testng.annotations.Test; |
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
diff
changeset
|
47 |
import org.testng.Assert; |
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
diff
changeset
|
48 |
|
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
diff
changeset
|
49 |
import sun.hotspot.WhiteBox; |
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
diff
changeset
|
50 |
|
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
diff
changeset
|
51 |
import java.io.BufferedReader; |
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
diff
changeset
|
52 |
import java.io.File; |
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
diff
changeset
|
53 |
import java.io.StringReader; |
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
diff
changeset
|
54 |
import java.lang.reflect.Method; |
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
diff
changeset
|
55 |
import java.util.Objects; |
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
diff
changeset
|
56 |
|
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
diff
changeset
|
57 |
public class TestCompilerDirectivesCompatibilityCommandOn extends TestCompilerDirectivesCompatibilityBase{ |
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
diff
changeset
|
58 |
|
36321
d3618f1ff1bb
8148159: [TESTBUG] TestCompilerDirectivesCompatibility tests fails on non-tiered server VMs
neliasso
parents:
35753
diff
changeset
|
59 |
public void testCompatibility(CommandExecutor executor, int comp_level) throws Exception { |
33451
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
diff
changeset
|
60 |
|
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
diff
changeset
|
61 |
// Call all validation twice to catch error when overwriting a directive |
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
diff
changeset
|
62 |
// Flag is default on |
36321
d3618f1ff1bb
8148159: [TESTBUG] TestCompilerDirectivesCompatibility tests fails on non-tiered server VMs
neliasso
parents:
35753
diff
changeset
|
63 |
expect(WB.shouldPrintAssembly(method, comp_level)); |
d3618f1ff1bb
8148159: [TESTBUG] TestCompilerDirectivesCompatibility tests fails on non-tiered server VMs
neliasso
parents:
35753
diff
changeset
|
64 |
expect(WB.shouldPrintAssembly(nomatch, comp_level)); |
d3618f1ff1bb
8148159: [TESTBUG] TestCompilerDirectivesCompatibility tests fails on non-tiered server VMs
neliasso
parents:
35753
diff
changeset
|
65 |
expect(WB.shouldPrintAssembly(method, comp_level)); |
d3618f1ff1bb
8148159: [TESTBUG] TestCompilerDirectivesCompatibility tests fails on non-tiered server VMs
neliasso
parents:
35753
diff
changeset
|
66 |
expect(WB.shouldPrintAssembly(nomatch, comp_level)); |
33451
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
diff
changeset
|
67 |
|
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
diff
changeset
|
68 |
// load directives that turn it off |
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
diff
changeset
|
69 |
executor.execute("Compiler.directives_add " + control_off); |
36321
d3618f1ff1bb
8148159: [TESTBUG] TestCompilerDirectivesCompatibility tests fails on non-tiered server VMs
neliasso
parents:
35753
diff
changeset
|
70 |
expect(!WB.shouldPrintAssembly(method, comp_level)); |
d3618f1ff1bb
8148159: [TESTBUG] TestCompilerDirectivesCompatibility tests fails on non-tiered server VMs
neliasso
parents:
35753
diff
changeset
|
71 |
expect(WB.shouldPrintAssembly(nomatch, comp_level)); |
d3618f1ff1bb
8148159: [TESTBUG] TestCompilerDirectivesCompatibility tests fails on non-tiered server VMs
neliasso
parents:
35753
diff
changeset
|
72 |
expect(!WB.shouldPrintAssembly(method, comp_level)); |
d3618f1ff1bb
8148159: [TESTBUG] TestCompilerDirectivesCompatibility tests fails on non-tiered server VMs
neliasso
parents:
35753
diff
changeset
|
73 |
expect(WB.shouldPrintAssembly(nomatch, comp_level)); |
33451
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
diff
changeset
|
74 |
|
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
diff
changeset
|
75 |
// remove and see that it is true again |
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
diff
changeset
|
76 |
executor.execute("Compiler.directives_remove"); |
36321
d3618f1ff1bb
8148159: [TESTBUG] TestCompilerDirectivesCompatibility tests fails on non-tiered server VMs
neliasso
parents:
35753
diff
changeset
|
77 |
expect(WB.shouldPrintAssembly(method, comp_level)); |
d3618f1ff1bb
8148159: [TESTBUG] TestCompilerDirectivesCompatibility tests fails on non-tiered server VMs
neliasso
parents:
35753
diff
changeset
|
78 |
expect(WB.shouldPrintAssembly(nomatch, comp_level)); |
d3618f1ff1bb
8148159: [TESTBUG] TestCompilerDirectivesCompatibility tests fails on non-tiered server VMs
neliasso
parents:
35753
diff
changeset
|
79 |
expect(WB.shouldPrintAssembly(method, comp_level)); |
d3618f1ff1bb
8148159: [TESTBUG] TestCompilerDirectivesCompatibility tests fails on non-tiered server VMs
neliasso
parents:
35753
diff
changeset
|
80 |
expect(WB.shouldPrintAssembly(nomatch, comp_level)); |
33451
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
diff
changeset
|
81 |
} |
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
diff
changeset
|
82 |
} |