hotspot/test/sanity/MismatchedWhiteBox/WhiteBox.java
author dcubed
Tue, 05 Jul 2016 14:00:21 -0700
changeset 39696 80c9894e18f9
parent 38152 80e5da81fb2c
child 40631 ed82623d7831
permissions -rw-r--r--
8160739: quarantine tests failing due to -XX:TieredStopAtLevel=1 8160743: quarantine tests that can't attach symbolicator to the process on MacOS X Reviewed-by: sspitsyn, dholmes, kvn
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
30249
faf83ebbf040 8077608: [TESTBUG] Enable Hotspot jtreg tests to run in agentvm mode
ctornqvi
parents:
diff changeset
     1
/*
faf83ebbf040 8077608: [TESTBUG] Enable Hotspot jtreg tests to run in agentvm mode
ctornqvi
parents:
diff changeset
     2
 * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
faf83ebbf040 8077608: [TESTBUG] Enable Hotspot jtreg tests to run in agentvm mode
ctornqvi
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
faf83ebbf040 8077608: [TESTBUG] Enable Hotspot jtreg tests to run in agentvm mode
ctornqvi
parents:
diff changeset
     4
 *
faf83ebbf040 8077608: [TESTBUG] Enable Hotspot jtreg tests to run in agentvm mode
ctornqvi
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
faf83ebbf040 8077608: [TESTBUG] Enable Hotspot jtreg tests to run in agentvm mode
ctornqvi
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
faf83ebbf040 8077608: [TESTBUG] Enable Hotspot jtreg tests to run in agentvm mode
ctornqvi
parents:
diff changeset
     7
 * published by the Free Software Foundation.
faf83ebbf040 8077608: [TESTBUG] Enable Hotspot jtreg tests to run in agentvm mode
ctornqvi
parents:
diff changeset
     8
 *
faf83ebbf040 8077608: [TESTBUG] Enable Hotspot jtreg tests to run in agentvm mode
ctornqvi
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
faf83ebbf040 8077608: [TESTBUG] Enable Hotspot jtreg tests to run in agentvm mode
ctornqvi
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
faf83ebbf040 8077608: [TESTBUG] Enable Hotspot jtreg tests to run in agentvm mode
ctornqvi
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
faf83ebbf040 8077608: [TESTBUG] Enable Hotspot jtreg tests to run in agentvm mode
ctornqvi
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
faf83ebbf040 8077608: [TESTBUG] Enable Hotspot jtreg tests to run in agentvm mode
ctornqvi
parents:
diff changeset
    13
 * accompanied this code).
faf83ebbf040 8077608: [TESTBUG] Enable Hotspot jtreg tests to run in agentvm mode
ctornqvi
parents:
diff changeset
    14
 *
faf83ebbf040 8077608: [TESTBUG] Enable Hotspot jtreg tests to run in agentvm mode
ctornqvi
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
faf83ebbf040 8077608: [TESTBUG] Enable Hotspot jtreg tests to run in agentvm mode
ctornqvi
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
faf83ebbf040 8077608: [TESTBUG] Enable Hotspot jtreg tests to run in agentvm mode
ctornqvi
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
faf83ebbf040 8077608: [TESTBUG] Enable Hotspot jtreg tests to run in agentvm mode
ctornqvi
parents:
diff changeset
    18
 *
faf83ebbf040 8077608: [TESTBUG] Enable Hotspot jtreg tests to run in agentvm mode
ctornqvi
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
faf83ebbf040 8077608: [TESTBUG] Enable Hotspot jtreg tests to run in agentvm mode
ctornqvi
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
faf83ebbf040 8077608: [TESTBUG] Enable Hotspot jtreg tests to run in agentvm mode
ctornqvi
parents:
diff changeset
    21
 * questions.
faf83ebbf040 8077608: [TESTBUG] Enable Hotspot jtreg tests to run in agentvm mode
ctornqvi
parents:
diff changeset
    22
 */
faf83ebbf040 8077608: [TESTBUG] Enable Hotspot jtreg tests to run in agentvm mode
ctornqvi
parents:
diff changeset
    23
faf83ebbf040 8077608: [TESTBUG] Enable Hotspot jtreg tests to run in agentvm mode
ctornqvi
parents:
diff changeset
    24
/*
faf83ebbf040 8077608: [TESTBUG] Enable Hotspot jtreg tests to run in agentvm mode
ctornqvi
parents:
diff changeset
    25
 * @test WhiteBox
faf83ebbf040 8077608: [TESTBUG] Enable Hotspot jtreg tests to run in agentvm mode
ctornqvi
parents:
diff changeset
    26
 * @bug 8011675
faf83ebbf040 8077608: [TESTBUG] Enable Hotspot jtreg tests to run in agentvm mode
ctornqvi
parents:
diff changeset
    27
 * @summary verify that whitebox can be used even if not all functions are declared in java-part
faf83ebbf040 8077608: [TESTBUG] Enable Hotspot jtreg tests to run in agentvm mode
ctornqvi
parents:
diff changeset
    28
 * @author igor.ignatyev@oracle.com
38152
80e5da81fb2c 8154258: [TESTBUG] Various serviceability tests fail compilation
dsamersoff
parents: 35086
diff changeset
    29
 * @modules java.base/jdk.internal.misc
30249
faf83ebbf040 8077608: [TESTBUG] Enable Hotspot jtreg tests to run in agentvm mode
ctornqvi
parents:
diff changeset
    30
 * @library /testlibrary
faf83ebbf040 8077608: [TESTBUG] Enable Hotspot jtreg tests to run in agentvm mode
ctornqvi
parents:
diff changeset
    31
 * @compile WhiteBox.java
faf83ebbf040 8077608: [TESTBUG] Enable Hotspot jtreg tests to run in agentvm mode
ctornqvi
parents:
diff changeset
    32
 * @run main ClassFileInstaller sun.hotspot.WhiteBox
35086
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents: 30249
diff changeset
    33
 * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:-CheckIntrinsics sun.hotspot.WhiteBox
30249
faf83ebbf040 8077608: [TESTBUG] Enable Hotspot jtreg tests to run in agentvm mode
ctornqvi
parents:
diff changeset
    34
 */
faf83ebbf040 8077608: [TESTBUG] Enable Hotspot jtreg tests to run in agentvm mode
ctornqvi
parents:
diff changeset
    35
faf83ebbf040 8077608: [TESTBUG] Enable Hotspot jtreg tests to run in agentvm mode
ctornqvi
parents:
diff changeset
    36
package sun.hotspot;
faf83ebbf040 8077608: [TESTBUG] Enable Hotspot jtreg tests to run in agentvm mode
ctornqvi
parents:
diff changeset
    37
faf83ebbf040 8077608: [TESTBUG] Enable Hotspot jtreg tests to run in agentvm mode
ctornqvi
parents:
diff changeset
    38
public class WhiteBox {
faf83ebbf040 8077608: [TESTBUG] Enable Hotspot jtreg tests to run in agentvm mode
ctornqvi
parents:
diff changeset
    39
    private static native void registerNatives();
faf83ebbf040 8077608: [TESTBUG] Enable Hotspot jtreg tests to run in agentvm mode
ctornqvi
parents:
diff changeset
    40
    static { registerNatives(); }
faf83ebbf040 8077608: [TESTBUG] Enable Hotspot jtreg tests to run in agentvm mode
ctornqvi
parents:
diff changeset
    41
    public native int notExistedMethod();
faf83ebbf040 8077608: [TESTBUG] Enable Hotspot jtreg tests to run in agentvm mode
ctornqvi
parents:
diff changeset
    42
    public native int getHeapOopSize();
faf83ebbf040 8077608: [TESTBUG] Enable Hotspot jtreg tests to run in agentvm mode
ctornqvi
parents:
diff changeset
    43
    public static void main(String[] args) {
faf83ebbf040 8077608: [TESTBUG] Enable Hotspot jtreg tests to run in agentvm mode
ctornqvi
parents:
diff changeset
    44
        WhiteBox wb = new WhiteBox();
faf83ebbf040 8077608: [TESTBUG] Enable Hotspot jtreg tests to run in agentvm mode
ctornqvi
parents:
diff changeset
    45
        if (wb.getHeapOopSize() < 0) {
faf83ebbf040 8077608: [TESTBUG] Enable Hotspot jtreg tests to run in agentvm mode
ctornqvi
parents:
diff changeset
    46
            throw new Error("wb.getHeapOopSize() < 0");
faf83ebbf040 8077608: [TESTBUG] Enable Hotspot jtreg tests to run in agentvm mode
ctornqvi
parents:
diff changeset
    47
        }
faf83ebbf040 8077608: [TESTBUG] Enable Hotspot jtreg tests to run in agentvm mode
ctornqvi
parents:
diff changeset
    48
        boolean catched = false;
faf83ebbf040 8077608: [TESTBUG] Enable Hotspot jtreg tests to run in agentvm mode
ctornqvi
parents:
diff changeset
    49
        try {
faf83ebbf040 8077608: [TESTBUG] Enable Hotspot jtreg tests to run in agentvm mode
ctornqvi
parents:
diff changeset
    50
            wb.notExistedMethod();
faf83ebbf040 8077608: [TESTBUG] Enable Hotspot jtreg tests to run in agentvm mode
ctornqvi
parents:
diff changeset
    51
        } catch (UnsatisfiedLinkError e) {
faf83ebbf040 8077608: [TESTBUG] Enable Hotspot jtreg tests to run in agentvm mode
ctornqvi
parents:
diff changeset
    52
            catched = true;
faf83ebbf040 8077608: [TESTBUG] Enable Hotspot jtreg tests to run in agentvm mode
ctornqvi
parents:
diff changeset
    53
        }
faf83ebbf040 8077608: [TESTBUG] Enable Hotspot jtreg tests to run in agentvm mode
ctornqvi
parents:
diff changeset
    54
        if (!catched) {
faf83ebbf040 8077608: [TESTBUG] Enable Hotspot jtreg tests to run in agentvm mode
ctornqvi
parents:
diff changeset
    55
            throw new Error("wb.notExistedMethod() was invoked");
faf83ebbf040 8077608: [TESTBUG] Enable Hotspot jtreg tests to run in agentvm mode
ctornqvi
parents:
diff changeset
    56
        }
faf83ebbf040 8077608: [TESTBUG] Enable Hotspot jtreg tests to run in agentvm mode
ctornqvi
parents:
diff changeset
    57
    }
faf83ebbf040 8077608: [TESTBUG] Enable Hotspot jtreg tests to run in agentvm mode
ctornqvi
parents:
diff changeset
    58
}