hotspot/test/runtime/logging/MonitorMismatchTest.java
author dsamersoff
Sun, 01 May 2016 12:47:00 +0300
changeset 38152 80e5da81fb2c
parent 37203 90eabed33a6c
child 40015 524230a0f4ca
permissions -rw-r--r--
8154258: [TESTBUG] Various serviceability tests fail compilation Summary: Replace sun.misc.Unsafe with jdk.internal.misc.Unsafe Reviewed-by: chegar, kvn
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
37203
90eabed33a6c 8150084: Convert TraceMonitorMismatch to Unified Logging.
mockner
parents:
diff changeset
     1
/*
90eabed33a6c 8150084: Convert TraceMonitorMismatch to Unified Logging.
mockner
parents:
diff changeset
     2
 * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
90eabed33a6c 8150084: Convert TraceMonitorMismatch to Unified Logging.
mockner
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90eabed33a6c 8150084: Convert TraceMonitorMismatch to Unified Logging.
mockner
parents:
diff changeset
     4
 *
90eabed33a6c 8150084: Convert TraceMonitorMismatch to Unified Logging.
mockner
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90eabed33a6c 8150084: Convert TraceMonitorMismatch to Unified Logging.
mockner
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
90eabed33a6c 8150084: Convert TraceMonitorMismatch to Unified Logging.
mockner
parents:
diff changeset
     7
 * published by the Free Software Foundation.
90eabed33a6c 8150084: Convert TraceMonitorMismatch to Unified Logging.
mockner
parents:
diff changeset
     8
 *
90eabed33a6c 8150084: Convert TraceMonitorMismatch to Unified Logging.
mockner
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
90eabed33a6c 8150084: Convert TraceMonitorMismatch to Unified Logging.
mockner
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90eabed33a6c 8150084: Convert TraceMonitorMismatch to Unified Logging.
mockner
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90eabed33a6c 8150084: Convert TraceMonitorMismatch to Unified Logging.
mockner
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
90eabed33a6c 8150084: Convert TraceMonitorMismatch to Unified Logging.
mockner
parents:
diff changeset
    13
 * accompanied this code).
90eabed33a6c 8150084: Convert TraceMonitorMismatch to Unified Logging.
mockner
parents:
diff changeset
    14
 *
90eabed33a6c 8150084: Convert TraceMonitorMismatch to Unified Logging.
mockner
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
90eabed33a6c 8150084: Convert TraceMonitorMismatch to Unified Logging.
mockner
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
90eabed33a6c 8150084: Convert TraceMonitorMismatch to Unified Logging.
mockner
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90eabed33a6c 8150084: Convert TraceMonitorMismatch to Unified Logging.
mockner
parents:
diff changeset
    18
 *
90eabed33a6c 8150084: Convert TraceMonitorMismatch to Unified Logging.
mockner
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
90eabed33a6c 8150084: Convert TraceMonitorMismatch to Unified Logging.
mockner
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
90eabed33a6c 8150084: Convert TraceMonitorMismatch to Unified Logging.
mockner
parents:
diff changeset
    21
 * questions.
90eabed33a6c 8150084: Convert TraceMonitorMismatch to Unified Logging.
mockner
parents:
diff changeset
    22
 */
90eabed33a6c 8150084: Convert TraceMonitorMismatch to Unified Logging.
mockner
parents:
diff changeset
    23
90eabed33a6c 8150084: Convert TraceMonitorMismatch to Unified Logging.
mockner
parents:
diff changeset
    24
90eabed33a6c 8150084: Convert TraceMonitorMismatch to Unified Logging.
mockner
parents:
diff changeset
    25
/*
90eabed33a6c 8150084: Convert TraceMonitorMismatch to Unified Logging.
mockner
parents:
diff changeset
    26
 * @test MonitorMismatchTest
90eabed33a6c 8150084: Convert TraceMonitorMismatch to Unified Logging.
mockner
parents:
diff changeset
    27
 * @bug 8150084
38152
80e5da81fb2c 8154258: [TESTBUG] Various serviceability tests fail compilation
dsamersoff
parents: 37203
diff changeset
    28
 * @modules java.base/jdk.internal.misc
37203
90eabed33a6c 8150084: Convert TraceMonitorMismatch to Unified Logging.
mockner
parents:
diff changeset
    29
 * @library /testlibrary
90eabed33a6c 8150084: Convert TraceMonitorMismatch to Unified Logging.
mockner
parents:
diff changeset
    30
 * @compile MonitorMismatchHelper.jasm
90eabed33a6c 8150084: Convert TraceMonitorMismatch to Unified Logging.
mockner
parents:
diff changeset
    31
 * @build jdk.test.lib.OutputAnalyzer jdk.test.lib.ProcessTools jdk.test.lib.Platform
90eabed33a6c 8150084: Convert TraceMonitorMismatch to Unified Logging.
mockner
parents:
diff changeset
    32
 * @run driver MonitorMismatchTest
90eabed33a6c 8150084: Convert TraceMonitorMismatch to Unified Logging.
mockner
parents:
diff changeset
    33
 */
90eabed33a6c 8150084: Convert TraceMonitorMismatch to Unified Logging.
mockner
parents:
diff changeset
    34
90eabed33a6c 8150084: Convert TraceMonitorMismatch to Unified Logging.
mockner
parents:
diff changeset
    35
import jdk.test.lib.OutputAnalyzer;
90eabed33a6c 8150084: Convert TraceMonitorMismatch to Unified Logging.
mockner
parents:
diff changeset
    36
import jdk.test.lib.ProcessTools;
90eabed33a6c 8150084: Convert TraceMonitorMismatch to Unified Logging.
mockner
parents:
diff changeset
    37
import jdk.test.lib.Platform;
90eabed33a6c 8150084: Convert TraceMonitorMismatch to Unified Logging.
mockner
parents:
diff changeset
    38
90eabed33a6c 8150084: Convert TraceMonitorMismatch to Unified Logging.
mockner
parents:
diff changeset
    39
public class MonitorMismatchTest {
90eabed33a6c 8150084: Convert TraceMonitorMismatch to Unified Logging.
mockner
parents:
diff changeset
    40
90eabed33a6c 8150084: Convert TraceMonitorMismatch to Unified Logging.
mockner
parents:
diff changeset
    41
    public static void main(String... args) throws Exception {
90eabed33a6c 8150084: Convert TraceMonitorMismatch to Unified Logging.
mockner
parents:
diff changeset
    42
        if (!Platform.isEmbedded()){
90eabed33a6c 8150084: Convert TraceMonitorMismatch to Unified Logging.
mockner
parents:
diff changeset
    43
            // monitormismatch should turn on.
90eabed33a6c 8150084: Convert TraceMonitorMismatch to Unified Logging.
mockner
parents:
diff changeset
    44
            ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-Xcomp",
90eabed33a6c 8150084: Convert TraceMonitorMismatch to Unified Logging.
mockner
parents:
diff changeset
    45
                                                                      "-XX:+TieredCompilation",
90eabed33a6c 8150084: Convert TraceMonitorMismatch to Unified Logging.
mockner
parents:
diff changeset
    46
                                                                      "-Xlog:monitormismatch=info",
90eabed33a6c 8150084: Convert TraceMonitorMismatch to Unified Logging.
mockner
parents:
diff changeset
    47
                                                                      "MonitorMismatchHelper");
90eabed33a6c 8150084: Convert TraceMonitorMismatch to Unified Logging.
mockner
parents:
diff changeset
    48
            OutputAnalyzer o = new OutputAnalyzer(pb.start());
90eabed33a6c 8150084: Convert TraceMonitorMismatch to Unified Logging.
mockner
parents:
diff changeset
    49
            o.shouldContain("[monitormismatch] Monitor mismatch in method");
90eabed33a6c 8150084: Convert TraceMonitorMismatch to Unified Logging.
mockner
parents:
diff changeset
    50
90eabed33a6c 8150084: Convert TraceMonitorMismatch to Unified Logging.
mockner
parents:
diff changeset
    51
            // monitormismatch should turn off.
90eabed33a6c 8150084: Convert TraceMonitorMismatch to Unified Logging.
mockner
parents:
diff changeset
    52
            pb = ProcessTools.createJavaProcessBuilder("-Xcomp",
90eabed33a6c 8150084: Convert TraceMonitorMismatch to Unified Logging.
mockner
parents:
diff changeset
    53
                                                       "-XX:+TieredCompilation",
90eabed33a6c 8150084: Convert TraceMonitorMismatch to Unified Logging.
mockner
parents:
diff changeset
    54
                                                       "-Xlog:monitormismatch=off",
90eabed33a6c 8150084: Convert TraceMonitorMismatch to Unified Logging.
mockner
parents:
diff changeset
    55
                                                       "MonitorMismatchHelper");
90eabed33a6c 8150084: Convert TraceMonitorMismatch to Unified Logging.
mockner
parents:
diff changeset
    56
            o = new OutputAnalyzer(pb.start());
90eabed33a6c 8150084: Convert TraceMonitorMismatch to Unified Logging.
mockner
parents:
diff changeset
    57
            o.shouldNotContain("[monitormismatch]");
90eabed33a6c 8150084: Convert TraceMonitorMismatch to Unified Logging.
mockner
parents:
diff changeset
    58
        }
90eabed33a6c 8150084: Convert TraceMonitorMismatch to Unified Logging.
mockner
parents:
diff changeset
    59
    };
90eabed33a6c 8150084: Convert TraceMonitorMismatch to Unified Logging.
mockner
parents:
diff changeset
    60
90eabed33a6c 8150084: Convert TraceMonitorMismatch to Unified Logging.
mockner
parents:
diff changeset
    61
}