test/hotspot/jtreg/compiler/compilercontrol/TestCompilerDirectivesCompatibilityFlag.java
author prr
Thu, 26 Jul 2018 10:00:40 -0700
changeset 51251 0a7a0a6dfa22
parent 47216 71c04702a3d5
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 TestCompilerDirectivesCompatibilityFlag
0712796e4039 8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
diff changeset
    26
 * @bug 8137167
40631
ed82623d7831 8157957: ClassNotFoundException: jdk.test.lib.JDKToolFinder
ctornqvi
parents: 40059
diff changeset
    27
 * @library /test/lib /
36851
03e2f4d0a421 8153737: Unsupported Module
chegar
parents: 36321
diff changeset
    28
 * @modules java.base/jdk.internal.misc
33451
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
40059
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 36851
diff changeset
    31
 *
40631
ed82623d7831 8157957: ClassNotFoundException: jdk.test.lib.JDKToolFinder
ctornqvi
parents: 40059
diff changeset
    32
 * @build sun.hotspot.WhiteBox
36321
d3618f1ff1bb 8148159: [TESTBUG] TestCompilerDirectivesCompatibility tests fails on non-tiered server VMs
neliasso
parents: 35753
diff changeset
    33
 * @run driver ClassFileInstaller sun.hotspot.WhiteBox
d3618f1ff1bb 8148159: [TESTBUG] TestCompilerDirectivesCompatibility tests fails on non-tiered server VMs
neliasso
parents: 35753
diff changeset
    34
 *                                sun.hotspot.WhiteBox$WhiteBoxPermission
d3618f1ff1bb 8148159: [TESTBUG] TestCompilerDirectivesCompatibility tests fails on non-tiered server VMs
neliasso
parents: 35753
diff changeset
    35
 * @run testng/othervm -Xbootclasspath/a:. -Xmixed -XX:+UnlockDiagnosticVMOptions
40059
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 36851
diff changeset
    36
 *      -XX:+PrintAssembly -XX:+WhiteBoxAPI
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 36851
diff changeset
    37
 *      compiler.compilercontrol.TestCompilerDirectivesCompatibilityFlag
33451
0712796e4039 8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
diff changeset
    38
 * @summary Test compiler control compatibility with compile command
0712796e4039 8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
diff changeset
    39
 */
0712796e4039 8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
diff changeset
    40
40059
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 36851
diff changeset
    41
package compiler.compilercontrol;
33451
0712796e4039 8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
diff changeset
    42
40059
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 36851
diff changeset
    43
import jdk.test.lib.dcmd.CommandExecutor;
33451
0712796e4039 8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
diff changeset
    44
0712796e4039 8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
diff changeset
    45
public class TestCompilerDirectivesCompatibilityFlag extends TestCompilerDirectivesCompatibilityBase {
0712796e4039 8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
diff changeset
    46
36321
d3618f1ff1bb 8148159: [TESTBUG] TestCompilerDirectivesCompatibility tests fails on non-tiered server VMs
neliasso
parents: 35753
diff changeset
    47
    public void testCompatibility(CommandExecutor executor, int comp_level) throws Exception {
33451
0712796e4039 8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
diff changeset
    48
0712796e4039 8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
diff changeset
    49
        // Call all validation twice to catch error when overwriting a directive
0712796e4039 8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
diff changeset
    50
        // Flag is default on
0712796e4039 8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
diff changeset
    51
        expect(WB.getBooleanVMFlag("PrintAssembly"));
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 off
0712796e4039 8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
diff changeset
    58
        executor.execute("Compiler.directives_add " + control_off);
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 true 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
}