hotspot/test/compiler/compilercontrol/TestCompilerDirectivesCompatibilityCommandOff.java
author lana
Thu, 23 Feb 2017 17:30:12 +0000
changeset 44011 5eea3031ae7b
parent 40631 ed82623d7831
permissions -rw-r--r--
Merge
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
33451
0712796e4039 8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
diff changeset
     1
/*
40631
ed82623d7831 8157957: ClassNotFoundException: jdk.test.lib.JDKToolFinder
ctornqvi
parents: 40059
diff changeset
     2
 * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
33451
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 TestCompilerDirectivesCompatibilityCommandOff
0712796e4039 8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
diff changeset
    26
 * @bug 8137167
40059
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 36851
diff changeset
    27
 * @summary Test compiler control compatibility with compile command
40631
ed82623d7831 8157957: ClassNotFoundException: jdk.test.lib.JDKToolFinder
ctornqvi
parents: 40059
diff changeset
    28
 * @library /test/lib /
36851
03e2f4d0a421 8153737: Unsupported Module
chegar
parents: 36321
diff changeset
    29
 * @modules java.base/jdk.internal.misc
33451
0712796e4039 8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
diff changeset
    30
 *          java.compiler
0712796e4039 8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
diff changeset
    31
 *          java.management
40059
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 36851
diff changeset
    32
 *
40631
ed82623d7831 8157957: ClassNotFoundException: jdk.test.lib.JDKToolFinder
ctornqvi
parents: 40059
diff changeset
    33
 * @build sun.hotspot.WhiteBox
36321
d3618f1ff1bb 8148159: [TESTBUG] TestCompilerDirectivesCompatibility tests fails on non-tiered server VMs
neliasso
parents: 35753
diff changeset
    34
 * @run driver ClassFileInstaller sun.hotspot.WhiteBox
d3618f1ff1bb 8148159: [TESTBUG] TestCompilerDirectivesCompatibility tests fails on non-tiered server VMs
neliasso
parents: 35753
diff changeset
    35
 *                                sun.hotspot.WhiteBox$WhiteBoxPermission
d3618f1ff1bb 8148159: [TESTBUG] TestCompilerDirectivesCompatibility tests fails on non-tiered server VMs
neliasso
parents: 35753
diff changeset
    36
 * @run testng/othervm -Xbootclasspath/a:. -Xmixed -XX:+UnlockDiagnosticVMOptions
33630
041b89e031c1 8141129: 3 compiler control tests fail on product builds
ppunegov
parents: 33451
diff changeset
    37
 *      -XX:-PrintAssembly -XX:CompileCommand=option,*.helper,bool,PrintAssembly,false
40059
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 36851
diff changeset
    38
 *      -XX:+WhiteBoxAPI
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 36851
diff changeset
    39
 *      compiler.compilercontrol.TestCompilerDirectivesCompatibilityCommandOff
33451
0712796e4039 8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
diff changeset
    40
 */
0712796e4039 8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
diff changeset
    41
40059
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 36851
diff changeset
    42
package compiler.compilercontrol;
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 36851
diff changeset
    43
33451
0712796e4039 8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
diff changeset
    44
import jdk.test.lib.dcmd.CommandExecutor;
0712796e4039 8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
diff changeset
    45
0712796e4039 8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
diff changeset
    46
public class TestCompilerDirectivesCompatibilityCommandOff extends TestCompilerDirectivesCompatibilityBase {
0712796e4039 8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
diff changeset
    47
36321
d3618f1ff1bb 8148159: [TESTBUG] TestCompilerDirectivesCompatibility tests fails on non-tiered server VMs
neliasso
parents: 35753
diff changeset
    48
    public void testCompatibility(CommandExecutor executor, int comp_level) throws Exception {
33451
0712796e4039 8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
diff changeset
    49
0712796e4039 8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
diff changeset
    50
        // Call all validation twice to catch error when overwriting a directive
0712796e4039 8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
diff changeset
    51
        // Flag is default off
36321
d3618f1ff1bb 8148159: [TESTBUG] TestCompilerDirectivesCompatibility tests fails on non-tiered server VMs
neliasso
parents: 35753
diff changeset
    52
        expect(!WB.shouldPrintAssembly(method, comp_level));
d3618f1ff1bb 8148159: [TESTBUG] TestCompilerDirectivesCompatibility tests fails on non-tiered server VMs
neliasso
parents: 35753
diff changeset
    53
        expect(!WB.shouldPrintAssembly(nomatch, comp_level));
d3618f1ff1bb 8148159: [TESTBUG] TestCompilerDirectivesCompatibility tests fails on non-tiered server VMs
neliasso
parents: 35753
diff changeset
    54
        expect(!WB.shouldPrintAssembly(method, comp_level));
d3618f1ff1bb 8148159: [TESTBUG] TestCompilerDirectivesCompatibility tests fails on non-tiered server VMs
neliasso
parents: 35753
diff changeset
    55
        expect(!WB.shouldPrintAssembly(nomatch, comp_level));
33451
0712796e4039 8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
diff changeset
    56
0712796e4039 8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
diff changeset
    57
        // load directives that turn it on
0712796e4039 8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
diff changeset
    58
        executor.execute("Compiler.directives_add " + control_on);
36321
d3618f1ff1bb 8148159: [TESTBUG] TestCompilerDirectivesCompatibility tests fails on non-tiered server VMs
neliasso
parents: 35753
diff changeset
    59
        expect(WB.shouldPrintAssembly(method, comp_level));
d3618f1ff1bb 8148159: [TESTBUG] TestCompilerDirectivesCompatibility tests fails on non-tiered server VMs
neliasso
parents: 35753
diff changeset
    60
        expect(!WB.shouldPrintAssembly(nomatch, comp_level));
d3618f1ff1bb 8148159: [TESTBUG] TestCompilerDirectivesCompatibility tests fails on non-tiered server VMs
neliasso
parents: 35753
diff changeset
    61
        expect(WB.shouldPrintAssembly(method, comp_level));
d3618f1ff1bb 8148159: [TESTBUG] TestCompilerDirectivesCompatibility tests fails on non-tiered server VMs
neliasso
parents: 35753
diff changeset
    62
        expect(!WB.shouldPrintAssembly(nomatch, comp_level));
33451
0712796e4039 8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
diff changeset
    63
0712796e4039 8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
diff changeset
    64
        // remove and see that it is false again
0712796e4039 8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
diff changeset
    65
        executor.execute("Compiler.directives_remove");
36321
d3618f1ff1bb 8148159: [TESTBUG] TestCompilerDirectivesCompatibility tests fails on non-tiered server VMs
neliasso
parents: 35753
diff changeset
    66
        expect(!WB.shouldPrintAssembly(method, comp_level));
d3618f1ff1bb 8148159: [TESTBUG] TestCompilerDirectivesCompatibility tests fails on non-tiered server VMs
neliasso
parents: 35753
diff changeset
    67
        expect(!WB.shouldPrintAssembly(nomatch, comp_level));
d3618f1ff1bb 8148159: [TESTBUG] TestCompilerDirectivesCompatibility tests fails on non-tiered server VMs
neliasso
parents: 35753
diff changeset
    68
        expect(!WB.shouldPrintAssembly(method, comp_level));
d3618f1ff1bb 8148159: [TESTBUG] TestCompilerDirectivesCompatibility tests fails on non-tiered server VMs
neliasso
parents: 35753
diff changeset
    69
        expect(!WB.shouldPrintAssembly(nomatch, comp_level));
33451
0712796e4039 8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
diff changeset
    70
    }
0712796e4039 8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
diff changeset
    71
}