test/hotspot/jtreg/runtime/logging/MonitorMismatchTest.java
author ccheung
Thu, 31 May 2018 11:41:25 -0700
changeset 50331 2712cf4711d1
parent 47216 71c04702a3d5
permissions -rw-r--r--
8203960: [TESTBUG] runtime/logging/DefaultMethodsTest.java failed when running in CDS mode Summary: Added an interface with a default method. The InnerClass implements the interface. Reviewed-by: iklam, dholmes
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
40631
ed82623d7831 8157957: ClassNotFoundException: jdk.test.lib.JDKToolFinder
ctornqvi
parents: 40015
diff changeset
    29
 * @library /test/lib
37203
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
 * @run driver MonitorMismatchTest
90eabed33a6c 8150084: Convert TraceMonitorMismatch to Unified Logging.
mockner
parents:
diff changeset
    32
 */
90eabed33a6c 8150084: Convert TraceMonitorMismatch to Unified Logging.
mockner
parents:
diff changeset
    33
40631
ed82623d7831 8157957: ClassNotFoundException: jdk.test.lib.JDKToolFinder
ctornqvi
parents: 40015
diff changeset
    34
import jdk.test.lib.process.OutputAnalyzer;
ed82623d7831 8157957: ClassNotFoundException: jdk.test.lib.JDKToolFinder
ctornqvi
parents: 40015
diff changeset
    35
import jdk.test.lib.process.ProcessTools;
37203
90eabed33a6c 8150084: Convert TraceMonitorMismatch to Unified Logging.
mockner
parents:
diff changeset
    36
import jdk.test.lib.Platform;
90eabed33a6c 8150084: Convert TraceMonitorMismatch to Unified Logging.
mockner
parents:
diff changeset
    37
90eabed33a6c 8150084: Convert TraceMonitorMismatch to Unified Logging.
mockner
parents:
diff changeset
    38
public class MonitorMismatchTest {
90eabed33a6c 8150084: Convert TraceMonitorMismatch to Unified Logging.
mockner
parents:
diff changeset
    39
90eabed33a6c 8150084: Convert TraceMonitorMismatch to Unified Logging.
mockner
parents:
diff changeset
    40
    public static void main(String... args) throws Exception {
40015
524230a0f4ca 8140723: Remove source code conditionalized on JAVASE_EMBEDDED
dholmes
parents: 38152
diff changeset
    41
        // monitormismatch should turn on.
524230a0f4ca 8140723: Remove source code conditionalized on JAVASE_EMBEDDED
dholmes
parents: 38152
diff changeset
    42
        ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-Xcomp",
524230a0f4ca 8140723: Remove source code conditionalized on JAVASE_EMBEDDED
dholmes
parents: 38152
diff changeset
    43
                                                                  "-XX:+TieredCompilation",
524230a0f4ca 8140723: Remove source code conditionalized on JAVASE_EMBEDDED
dholmes
parents: 38152
diff changeset
    44
                                                                  "-Xlog:monitormismatch=info",
524230a0f4ca 8140723: Remove source code conditionalized on JAVASE_EMBEDDED
dholmes
parents: 38152
diff changeset
    45
                                                                  "MonitorMismatchHelper");
524230a0f4ca 8140723: Remove source code conditionalized on JAVASE_EMBEDDED
dholmes
parents: 38152
diff changeset
    46
        OutputAnalyzer o = new OutputAnalyzer(pb.start());
524230a0f4ca 8140723: Remove source code conditionalized on JAVASE_EMBEDDED
dholmes
parents: 38152
diff changeset
    47
        o.shouldContain("[monitormismatch] Monitor mismatch in method");
37203
90eabed33a6c 8150084: Convert TraceMonitorMismatch to Unified Logging.
mockner
parents:
diff changeset
    48
40015
524230a0f4ca 8140723: Remove source code conditionalized on JAVASE_EMBEDDED
dholmes
parents: 38152
diff changeset
    49
        // monitormismatch should turn off.
524230a0f4ca 8140723: Remove source code conditionalized on JAVASE_EMBEDDED
dholmes
parents: 38152
diff changeset
    50
        pb = ProcessTools.createJavaProcessBuilder("-Xcomp",
524230a0f4ca 8140723: Remove source code conditionalized on JAVASE_EMBEDDED
dholmes
parents: 38152
diff changeset
    51
                                                   "-XX:+TieredCompilation",
524230a0f4ca 8140723: Remove source code conditionalized on JAVASE_EMBEDDED
dholmes
parents: 38152
diff changeset
    52
                                                   "-Xlog:monitormismatch=off",
524230a0f4ca 8140723: Remove source code conditionalized on JAVASE_EMBEDDED
dholmes
parents: 38152
diff changeset
    53
                                                   "MonitorMismatchHelper");
524230a0f4ca 8140723: Remove source code conditionalized on JAVASE_EMBEDDED
dholmes
parents: 38152
diff changeset
    54
        o = new OutputAnalyzer(pb.start());
524230a0f4ca 8140723: Remove source code conditionalized on JAVASE_EMBEDDED
dholmes
parents: 38152
diff changeset
    55
        o.shouldNotContain("[monitormismatch]");
37203
90eabed33a6c 8150084: Convert TraceMonitorMismatch to Unified Logging.
mockner
parents:
diff changeset
    56
    };
90eabed33a6c 8150084: Convert TraceMonitorMismatch to Unified Logging.
mockner
parents:
diff changeset
    57
90eabed33a6c 8150084: Convert TraceMonitorMismatch to Unified Logging.
mockner
parents:
diff changeset
    58
}