hotspot/test/testlibrary_tests/TestPlatformIsTieredSupported.java
author ykantser
Mon, 04 May 2015 16:30:07 +0200
changeset 30604 b8d532cb6420
parent 29678 dd2f3932c21e
child 33730 30e064828045
permissions -rw-r--r--
8067013: Rename the com.oracle.java.testlibary package Reviewed-by: dholmes, gtriantafill, sla Contributed-by: alexander.kulyakhtin@oracle.com
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
28389
bbd61e9179a5 8068183: Add isTieredSupported method to c.o.j.t.Platforms
fzhinkin
parents:
diff changeset
     1
/*
29678
dd2f3932c21e 8075586: Add @modules as needed to the open hotspot tests
ykantser
parents: 28389
diff changeset
     2
 * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
28389
bbd61e9179a5 8068183: Add isTieredSupported method to c.o.j.t.Platforms
fzhinkin
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
bbd61e9179a5 8068183: Add isTieredSupported method to c.o.j.t.Platforms
fzhinkin
parents:
diff changeset
     4
 *
bbd61e9179a5 8068183: Add isTieredSupported method to c.o.j.t.Platforms
fzhinkin
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
bbd61e9179a5 8068183: Add isTieredSupported method to c.o.j.t.Platforms
fzhinkin
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
bbd61e9179a5 8068183: Add isTieredSupported method to c.o.j.t.Platforms
fzhinkin
parents:
diff changeset
     7
 * published by the Free Software Foundation.
bbd61e9179a5 8068183: Add isTieredSupported method to c.o.j.t.Platforms
fzhinkin
parents:
diff changeset
     8
 *
bbd61e9179a5 8068183: Add isTieredSupported method to c.o.j.t.Platforms
fzhinkin
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
bbd61e9179a5 8068183: Add isTieredSupported method to c.o.j.t.Platforms
fzhinkin
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
bbd61e9179a5 8068183: Add isTieredSupported method to c.o.j.t.Platforms
fzhinkin
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
bbd61e9179a5 8068183: Add isTieredSupported method to c.o.j.t.Platforms
fzhinkin
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
bbd61e9179a5 8068183: Add isTieredSupported method to c.o.j.t.Platforms
fzhinkin
parents:
diff changeset
    13
 * accompanied this code).
bbd61e9179a5 8068183: Add isTieredSupported method to c.o.j.t.Platforms
fzhinkin
parents:
diff changeset
    14
 *
bbd61e9179a5 8068183: Add isTieredSupported method to c.o.j.t.Platforms
fzhinkin
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
bbd61e9179a5 8068183: Add isTieredSupported method to c.o.j.t.Platforms
fzhinkin
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
bbd61e9179a5 8068183: Add isTieredSupported method to c.o.j.t.Platforms
fzhinkin
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
bbd61e9179a5 8068183: Add isTieredSupported method to c.o.j.t.Platforms
fzhinkin
parents:
diff changeset
    18
 *
bbd61e9179a5 8068183: Add isTieredSupported method to c.o.j.t.Platforms
fzhinkin
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
bbd61e9179a5 8068183: Add isTieredSupported method to c.o.j.t.Platforms
fzhinkin
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
bbd61e9179a5 8068183: Add isTieredSupported method to c.o.j.t.Platforms
fzhinkin
parents:
diff changeset
    21
 * questions.
bbd61e9179a5 8068183: Add isTieredSupported method to c.o.j.t.Platforms
fzhinkin
parents:
diff changeset
    22
 */
bbd61e9179a5 8068183: Add isTieredSupported method to c.o.j.t.Platforms
fzhinkin
parents:
diff changeset
    23
30604
b8d532cb6420 8067013: Rename the com.oracle.java.testlibary package
ykantser
parents: 29678
diff changeset
    24
import jdk.test.lib.Asserts;
b8d532cb6420 8067013: Rename the com.oracle.java.testlibary package
ykantser
parents: 29678
diff changeset
    25
import jdk.test.lib.Platform;
28389
bbd61e9179a5 8068183: Add isTieredSupported method to c.o.j.t.Platforms
fzhinkin
parents:
diff changeset
    26
import sun.hotspot.WhiteBox;
bbd61e9179a5 8068183: Add isTieredSupported method to c.o.j.t.Platforms
fzhinkin
parents:
diff changeset
    27
bbd61e9179a5 8068183: Add isTieredSupported method to c.o.j.t.Platforms
fzhinkin
parents:
diff changeset
    28
/**
bbd61e9179a5 8068183: Add isTieredSupported method to c.o.j.t.Platforms
fzhinkin
parents:
diff changeset
    29
 * @test
bbd61e9179a5 8068183: Add isTieredSupported method to c.o.j.t.Platforms
fzhinkin
parents:
diff changeset
    30
 * @summary Verifies that Platform::isTieredSupported returns correct value.
bbd61e9179a5 8068183: Add isTieredSupported method to c.o.j.t.Platforms
fzhinkin
parents:
diff changeset
    31
 * @library /testlibrary /../../test/lib
29678
dd2f3932c21e 8075586: Add @modules as needed to the open hotspot tests
ykantser
parents: 28389
diff changeset
    32
 * @modules java.base/sun.misc
dd2f3932c21e 8075586: Add @modules as needed to the open hotspot tests
ykantser
parents: 28389
diff changeset
    33
 *          java.management
28389
bbd61e9179a5 8068183: Add isTieredSupported method to c.o.j.t.Platforms
fzhinkin
parents:
diff changeset
    34
 * @build TestPlatformIsTieredSupported
bbd61e9179a5 8068183: Add isTieredSupported method to c.o.j.t.Platforms
fzhinkin
parents:
diff changeset
    35
 * @run main ClassFileInstaller sun.hotspot.WhiteBox
bbd61e9179a5 8068183: Add isTieredSupported method to c.o.j.t.Platforms
fzhinkin
parents:
diff changeset
    36
 *                              sun.hotspot.WhiteBox$WhiteBoxPermission
bbd61e9179a5 8068183: Add isTieredSupported method to c.o.j.t.Platforms
fzhinkin
parents:
diff changeset
    37
 * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
bbd61e9179a5 8068183: Add isTieredSupported method to c.o.j.t.Platforms
fzhinkin
parents:
diff changeset
    38
 *                   -XX:+WhiteBoxAPI -XX:+TieredCompilation
bbd61e9179a5 8068183: Add isTieredSupported method to c.o.j.t.Platforms
fzhinkin
parents:
diff changeset
    39
 *                   TestPlatformIsTieredSupported
bbd61e9179a5 8068183: Add isTieredSupported method to c.o.j.t.Platforms
fzhinkin
parents:
diff changeset
    40
 */
bbd61e9179a5 8068183: Add isTieredSupported method to c.o.j.t.Platforms
fzhinkin
parents:
diff changeset
    41
public class TestPlatformIsTieredSupported {
bbd61e9179a5 8068183: Add isTieredSupported method to c.o.j.t.Platforms
fzhinkin
parents:
diff changeset
    42
    public static void main(String args[]) {
bbd61e9179a5 8068183: Add isTieredSupported method to c.o.j.t.Platforms
fzhinkin
parents:
diff changeset
    43
        WhiteBox whiteBox = WhiteBox.getWhiteBox();
bbd61e9179a5 8068183: Add isTieredSupported method to c.o.j.t.Platforms
fzhinkin
parents:
diff changeset
    44
        boolean tieredCompilation = whiteBox.getBooleanVMFlag(
bbd61e9179a5 8068183: Add isTieredSupported method to c.o.j.t.Platforms
fzhinkin
parents:
diff changeset
    45
                "TieredCompilation");
bbd61e9179a5 8068183: Add isTieredSupported method to c.o.j.t.Platforms
fzhinkin
parents:
diff changeset
    46
        Asserts.assertEQ(Platform.isTieredSupported(), tieredCompilation,
bbd61e9179a5 8068183: Add isTieredSupported method to c.o.j.t.Platforms
fzhinkin
parents:
diff changeset
    47
                "Platform::isTieredSupported should report the same value as "
bbd61e9179a5 8068183: Add isTieredSupported method to c.o.j.t.Platforms
fzhinkin
parents:
diff changeset
    48
                        + "TieredCompilation flag's value when "
bbd61e9179a5 8068183: Add isTieredSupported method to c.o.j.t.Platforms
fzhinkin
parents:
diff changeset
    49
                        + "+TieredCompilation was explicitly passed to JVM.");
bbd61e9179a5 8068183: Add isTieredSupported method to c.o.j.t.Platforms
fzhinkin
parents:
diff changeset
    50
    }
bbd61e9179a5 8068183: Add isTieredSupported method to c.o.j.t.Platforms
fzhinkin
parents:
diff changeset
    51
}