hotspot/test/runtime/logging/DefaultMethodsTest.java
author ntv
Wed, 13 Apr 2016 10:41:27 +0000
changeset 37341 29f3a46ac3cc
parent 36851 03e2f4d0a421
child 40631 ed82623d7831
permissions -rw-r--r--
8148849: Truncating Duration Summary: Introduce a new method to truncatedTo() Reviewed-by: rriggs, scolebourne
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
33736
1b3950243443 8139564: Convert TraceDefaultMethods to Unified Logging
rprotacio
parents:
diff changeset
     1
/*
35858
6e704583a38f 8146435: [TESTBUG] Logging tests are failing intermittently on windows when executed by JPRT
rprotacio
parents: 35232
diff changeset
     2
 * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
33736
1b3950243443 8139564: Convert TraceDefaultMethods to Unified Logging
rprotacio
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
1b3950243443 8139564: Convert TraceDefaultMethods to Unified Logging
rprotacio
parents:
diff changeset
     4
 *
1b3950243443 8139564: Convert TraceDefaultMethods to Unified Logging
rprotacio
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
1b3950243443 8139564: Convert TraceDefaultMethods to Unified Logging
rprotacio
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
1b3950243443 8139564: Convert TraceDefaultMethods to Unified Logging
rprotacio
parents:
diff changeset
     7
 * published by the Free Software Foundation.
1b3950243443 8139564: Convert TraceDefaultMethods to Unified Logging
rprotacio
parents:
diff changeset
     8
 *
1b3950243443 8139564: Convert TraceDefaultMethods to Unified Logging
rprotacio
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
1b3950243443 8139564: Convert TraceDefaultMethods to Unified Logging
rprotacio
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
1b3950243443 8139564: Convert TraceDefaultMethods to Unified Logging
rprotacio
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.    See the GNU General Public License
1b3950243443 8139564: Convert TraceDefaultMethods to Unified Logging
rprotacio
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
1b3950243443 8139564: Convert TraceDefaultMethods to Unified Logging
rprotacio
parents:
diff changeset
    13
 * accompanied this code).
1b3950243443 8139564: Convert TraceDefaultMethods to Unified Logging
rprotacio
parents:
diff changeset
    14
 *
1b3950243443 8139564: Convert TraceDefaultMethods to Unified Logging
rprotacio
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
1b3950243443 8139564: Convert TraceDefaultMethods to Unified Logging
rprotacio
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
1b3950243443 8139564: Convert TraceDefaultMethods to Unified Logging
rprotacio
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
1b3950243443 8139564: Convert TraceDefaultMethods to Unified Logging
rprotacio
parents:
diff changeset
    18
 *
1b3950243443 8139564: Convert TraceDefaultMethods to Unified Logging
rprotacio
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
1b3950243443 8139564: Convert TraceDefaultMethods to Unified Logging
rprotacio
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
1b3950243443 8139564: Convert TraceDefaultMethods to Unified Logging
rprotacio
parents:
diff changeset
    21
 * questions.
1b3950243443 8139564: Convert TraceDefaultMethods to Unified Logging
rprotacio
parents:
diff changeset
    22
 */
1b3950243443 8139564: Convert TraceDefaultMethods to Unified Logging
rprotacio
parents:
diff changeset
    23
1b3950243443 8139564: Convert TraceDefaultMethods to Unified Logging
rprotacio
parents:
diff changeset
    24
/*
1b3950243443 8139564: Convert TraceDefaultMethods to Unified Logging
rprotacio
parents:
diff changeset
    25
 * @test
1b3950243443 8139564: Convert TraceDefaultMethods to Unified Logging
rprotacio
parents:
diff changeset
    26
 * @bug 8139564
1b3950243443 8139564: Convert TraceDefaultMethods to Unified Logging
rprotacio
parents:
diff changeset
    27
 * @summary defaultmethods=debug should have logging from each of the statements in the code
1b3950243443 8139564: Convert TraceDefaultMethods to Unified Logging
rprotacio
parents:
diff changeset
    28
 * @library /testlibrary
36851
03e2f4d0a421 8153737: Unsupported Module
chegar
parents: 35858
diff changeset
    29
 * @modules java.base/jdk.internal.misc
33736
1b3950243443 8139564: Convert TraceDefaultMethods to Unified Logging
rprotacio
parents:
diff changeset
    30
 *          java.management
35193
1e85994e9f56 8145445: [TESTBUG] runtime/logging tests need to properly build and import libraries
rprotacio
parents: 34631
diff changeset
    31
 * @build jdk.test.lib.OutputAnalyzer jdk.test.lib.ProcessTools
34631
a8fd6c2a4a11 8144536: Clean up Unified Logging test directory
rprotacio
parents: 33736
diff changeset
    32
 * @run driver DefaultMethodsTest
33736
1b3950243443 8139564: Convert TraceDefaultMethods to Unified Logging
rprotacio
parents:
diff changeset
    33
 */
1b3950243443 8139564: Convert TraceDefaultMethods to Unified Logging
rprotacio
parents:
diff changeset
    34
35193
1e85994e9f56 8145445: [TESTBUG] runtime/logging tests need to properly build and import libraries
rprotacio
parents: 34631
diff changeset
    35
import jdk.test.lib.OutputAnalyzer;
1e85994e9f56 8145445: [TESTBUG] runtime/logging tests need to properly build and import libraries
rprotacio
parents: 34631
diff changeset
    36
import jdk.test.lib.ProcessTools;
33736
1b3950243443 8139564: Convert TraceDefaultMethods to Unified Logging
rprotacio
parents:
diff changeset
    37
1b3950243443 8139564: Convert TraceDefaultMethods to Unified Logging
rprotacio
parents:
diff changeset
    38
public class DefaultMethodsTest {
1b3950243443 8139564: Convert TraceDefaultMethods to Unified Logging
rprotacio
parents:
diff changeset
    39
    public static void main(String[] args) throws Exception {
35858
6e704583a38f 8146435: [TESTBUG] Logging tests are failing intermittently on windows when executed by JPRT
rprotacio
parents: 35232
diff changeset
    40
        ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-Xlog:defaultmethods=debug",
6e704583a38f 8146435: [TESTBUG] Logging tests are failing intermittently on windows when executed by JPRT
rprotacio
parents: 35232
diff changeset
    41
                                                                  InnerClass.class.getName());
33736
1b3950243443 8139564: Convert TraceDefaultMethods to Unified Logging
rprotacio
parents:
diff changeset
    42
        OutputAnalyzer output = new OutputAnalyzer(pb.start());
1b3950243443 8139564: Convert TraceDefaultMethods to Unified Logging
rprotacio
parents:
diff changeset
    43
        output.shouldContain("Slots that need filling:");
1b3950243443 8139564: Convert TraceDefaultMethods to Unified Logging
rprotacio
parents:
diff changeset
    44
        output.shouldContain("requires default method processing");
1b3950243443 8139564: Convert TraceDefaultMethods to Unified Logging
rprotacio
parents:
diff changeset
    45
        output.shouldContain("Looking for default methods for slot ");
1b3950243443 8139564: Convert TraceDefaultMethods to Unified Logging
rprotacio
parents:
diff changeset
    46
        output.shouldContain("Creating defaults and overpasses...");
1b3950243443 8139564: Convert TraceDefaultMethods to Unified Logging
rprotacio
parents:
diff changeset
    47
        output.shouldContain("for slot: ");
1b3950243443 8139564: Convert TraceDefaultMethods to Unified Logging
rprotacio
parents:
diff changeset
    48
        output.shouldContain("Default method processing complete");
1b3950243443 8139564: Convert TraceDefaultMethods to Unified Logging
rprotacio
parents:
diff changeset
    49
        output.shouldContain("overpass methods");
1b3950243443 8139564: Convert TraceDefaultMethods to Unified Logging
rprotacio
parents:
diff changeset
    50
        output.shouldContain("default methods");
1b3950243443 8139564: Convert TraceDefaultMethods to Unified Logging
rprotacio
parents:
diff changeset
    51
        output.shouldHaveExitValue(0);
1b3950243443 8139564: Convert TraceDefaultMethods to Unified Logging
rprotacio
parents:
diff changeset
    52
    }
35858
6e704583a38f 8146435: [TESTBUG] Logging tests are failing intermittently on windows when executed by JPRT
rprotacio
parents: 35232
diff changeset
    53
6e704583a38f 8146435: [TESTBUG] Logging tests are failing intermittently on windows when executed by JPRT
rprotacio
parents: 35232
diff changeset
    54
    public static class InnerClass {
6e704583a38f 8146435: [TESTBUG] Logging tests are failing intermittently on windows when executed by JPRT
rprotacio
parents: 35232
diff changeset
    55
        public static void main(String[] args) throws Exception {
6e704583a38f 8146435: [TESTBUG] Logging tests are failing intermittently on windows when executed by JPRT
rprotacio
parents: 35232
diff changeset
    56
            System.out.println("Inner Class");
6e704583a38f 8146435: [TESTBUG] Logging tests are failing intermittently on windows when executed by JPRT
rprotacio
parents: 35232
diff changeset
    57
        }
6e704583a38f 8146435: [TESTBUG] Logging tests are failing intermittently on windows when executed by JPRT
rprotacio
parents: 35232
diff changeset
    58
    }
33736
1b3950243443 8139564: Convert TraceDefaultMethods to Unified Logging
rprotacio
parents:
diff changeset
    59
}
1b3950243443 8139564: Convert TraceDefaultMethods to Unified Logging
rprotacio
parents:
diff changeset
    60