hotspot/test/runtime/logging/ProtectionDomainVerificationTest.java
author dsamersoff
Sun, 01 May 2016 12:47:00 +0300
changeset 38152 80e5da81fb2c
parent 36381 b9ed6bef9364
child 40631 ed82623d7831
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:
36381
b9ed6bef9364 8149064: TraceProtectionDomainVerification has been converted to Unified Logging.
mockner
parents:
diff changeset
     1
/*
b9ed6bef9364 8149064: TraceProtectionDomainVerification has been converted to Unified Logging.
mockner
parents:
diff changeset
     2
 * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
b9ed6bef9364 8149064: TraceProtectionDomainVerification has been converted to Unified Logging.
mockner
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
b9ed6bef9364 8149064: TraceProtectionDomainVerification has been converted to Unified Logging.
mockner
parents:
diff changeset
     4
 *
b9ed6bef9364 8149064: TraceProtectionDomainVerification has been converted to Unified Logging.
mockner
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
b9ed6bef9364 8149064: TraceProtectionDomainVerification has been converted to Unified Logging.
mockner
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
b9ed6bef9364 8149064: TraceProtectionDomainVerification has been converted to Unified Logging.
mockner
parents:
diff changeset
     7
 * published by the Free Software Foundation.
b9ed6bef9364 8149064: TraceProtectionDomainVerification has been converted to Unified Logging.
mockner
parents:
diff changeset
     8
 *
b9ed6bef9364 8149064: TraceProtectionDomainVerification has been converted to Unified Logging.
mockner
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
b9ed6bef9364 8149064: TraceProtectionDomainVerification has been converted to Unified Logging.
mockner
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
b9ed6bef9364 8149064: TraceProtectionDomainVerification has been converted to Unified Logging.
mockner
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
b9ed6bef9364 8149064: TraceProtectionDomainVerification has been converted to Unified Logging.
mockner
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
b9ed6bef9364 8149064: TraceProtectionDomainVerification has been converted to Unified Logging.
mockner
parents:
diff changeset
    13
 * accompanied this code).
b9ed6bef9364 8149064: TraceProtectionDomainVerification has been converted to Unified Logging.
mockner
parents:
diff changeset
    14
 *
b9ed6bef9364 8149064: TraceProtectionDomainVerification has been converted to Unified Logging.
mockner
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
b9ed6bef9364 8149064: TraceProtectionDomainVerification has been converted to Unified Logging.
mockner
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
b9ed6bef9364 8149064: TraceProtectionDomainVerification has been converted to Unified Logging.
mockner
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
b9ed6bef9364 8149064: TraceProtectionDomainVerification has been converted to Unified Logging.
mockner
parents:
diff changeset
    18
 *
b9ed6bef9364 8149064: TraceProtectionDomainVerification has been converted to Unified Logging.
mockner
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
b9ed6bef9364 8149064: TraceProtectionDomainVerification has been converted to Unified Logging.
mockner
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
b9ed6bef9364 8149064: TraceProtectionDomainVerification has been converted to Unified Logging.
mockner
parents:
diff changeset
    21
 * questions.
b9ed6bef9364 8149064: TraceProtectionDomainVerification has been converted to Unified Logging.
mockner
parents:
diff changeset
    22
 */
b9ed6bef9364 8149064: TraceProtectionDomainVerification has been converted to Unified Logging.
mockner
parents:
diff changeset
    23
b9ed6bef9364 8149064: TraceProtectionDomainVerification has been converted to Unified Logging.
mockner
parents:
diff changeset
    24
/*
b9ed6bef9364 8149064: TraceProtectionDomainVerification has been converted to Unified Logging.
mockner
parents:
diff changeset
    25
 * @test ProtectionDomainVerificationTest
b9ed6bef9364 8149064: TraceProtectionDomainVerification has been converted to Unified Logging.
mockner
parents:
diff changeset
    26
 * @bug 8149064
38152
80e5da81fb2c 8154258: [TESTBUG] Various serviceability tests fail compilation
dsamersoff
parents: 36381
diff changeset
    27
 * @modules java.base/jdk.internal.misc
36381
b9ed6bef9364 8149064: TraceProtectionDomainVerification has been converted to Unified Logging.
mockner
parents:
diff changeset
    28
 * @library /testlibrary
b9ed6bef9364 8149064: TraceProtectionDomainVerification has been converted to Unified Logging.
mockner
parents:
diff changeset
    29
 * @build jdk.test.lib.OutputAnalyzer jdk.test.lib.Platform jdk.test.lib.ProcessTools
b9ed6bef9364 8149064: TraceProtectionDomainVerification has been converted to Unified Logging.
mockner
parents:
diff changeset
    30
 * @run driver ProtectionDomainVerificationTest
b9ed6bef9364 8149064: TraceProtectionDomainVerification has been converted to Unified Logging.
mockner
parents:
diff changeset
    31
 */
b9ed6bef9364 8149064: TraceProtectionDomainVerification has been converted to Unified Logging.
mockner
parents:
diff changeset
    32
b9ed6bef9364 8149064: TraceProtectionDomainVerification has been converted to Unified Logging.
mockner
parents:
diff changeset
    33
import jdk.test.lib.OutputAnalyzer;
b9ed6bef9364 8149064: TraceProtectionDomainVerification has been converted to Unified Logging.
mockner
parents:
diff changeset
    34
import jdk.test.lib.Platform;
b9ed6bef9364 8149064: TraceProtectionDomainVerification has been converted to Unified Logging.
mockner
parents:
diff changeset
    35
import jdk.test.lib.ProcessTools;
b9ed6bef9364 8149064: TraceProtectionDomainVerification has been converted to Unified Logging.
mockner
parents:
diff changeset
    36
b9ed6bef9364 8149064: TraceProtectionDomainVerification has been converted to Unified Logging.
mockner
parents:
diff changeset
    37
public class ProtectionDomainVerificationTest {
b9ed6bef9364 8149064: TraceProtectionDomainVerification has been converted to Unified Logging.
mockner
parents:
diff changeset
    38
b9ed6bef9364 8149064: TraceProtectionDomainVerification has been converted to Unified Logging.
mockner
parents:
diff changeset
    39
    public static void main(String... args) throws Exception {
b9ed6bef9364 8149064: TraceProtectionDomainVerification has been converted to Unified Logging.
mockner
parents:
diff changeset
    40
b9ed6bef9364 8149064: TraceProtectionDomainVerification has been converted to Unified Logging.
mockner
parents:
diff changeset
    41
        // -Xlog:protectiondomain=trace
b9ed6bef9364 8149064: TraceProtectionDomainVerification has been converted to Unified Logging.
mockner
parents:
diff changeset
    42
        ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-Xlog:protectiondomain=trace",
b9ed6bef9364 8149064: TraceProtectionDomainVerification has been converted to Unified Logging.
mockner
parents:
diff changeset
    43
                                                                  "-Xmx64m",
b9ed6bef9364 8149064: TraceProtectionDomainVerification has been converted to Unified Logging.
mockner
parents:
diff changeset
    44
                                                                  Hello.class.getName());
b9ed6bef9364 8149064: TraceProtectionDomainVerification has been converted to Unified Logging.
mockner
parents:
diff changeset
    45
        OutputAnalyzer out = new OutputAnalyzer(pb.start());
b9ed6bef9364 8149064: TraceProtectionDomainVerification has been converted to Unified Logging.
mockner
parents:
diff changeset
    46
        out.shouldContain("[protectiondomain] Checking package access");
b9ed6bef9364 8149064: TraceProtectionDomainVerification has been converted to Unified Logging.
mockner
parents:
diff changeset
    47
        out.shouldContain("[protectiondomain] pd set count = #");
b9ed6bef9364 8149064: TraceProtectionDomainVerification has been converted to Unified Logging.
mockner
parents:
diff changeset
    48
b9ed6bef9364 8149064: TraceProtectionDomainVerification has been converted to Unified Logging.
mockner
parents:
diff changeset
    49
        // -Xlog:protectiondomain=debug
b9ed6bef9364 8149064: TraceProtectionDomainVerification has been converted to Unified Logging.
mockner
parents:
diff changeset
    50
        pb = ProcessTools.createJavaProcessBuilder("-Xlog:protectiondomain=debug",
b9ed6bef9364 8149064: TraceProtectionDomainVerification has been converted to Unified Logging.
mockner
parents:
diff changeset
    51
                                                                  "-Xmx64m",
b9ed6bef9364 8149064: TraceProtectionDomainVerification has been converted to Unified Logging.
mockner
parents:
diff changeset
    52
                                                                  Hello.class.getName());
b9ed6bef9364 8149064: TraceProtectionDomainVerification has been converted to Unified Logging.
mockner
parents:
diff changeset
    53
        out = new OutputAnalyzer(pb.start());
b9ed6bef9364 8149064: TraceProtectionDomainVerification has been converted to Unified Logging.
mockner
parents:
diff changeset
    54
        out.shouldContain("[protectiondomain] Checking package access");
b9ed6bef9364 8149064: TraceProtectionDomainVerification has been converted to Unified Logging.
mockner
parents:
diff changeset
    55
        out.shouldNotContain("pd set count = #");
b9ed6bef9364 8149064: TraceProtectionDomainVerification has been converted to Unified Logging.
mockner
parents:
diff changeset
    56
    }
b9ed6bef9364 8149064: TraceProtectionDomainVerification has been converted to Unified Logging.
mockner
parents:
diff changeset
    57
b9ed6bef9364 8149064: TraceProtectionDomainVerification has been converted to Unified Logging.
mockner
parents:
diff changeset
    58
    public static class Hello {
b9ed6bef9364 8149064: TraceProtectionDomainVerification has been converted to Unified Logging.
mockner
parents:
diff changeset
    59
        public static void main(String[] args) {
b9ed6bef9364 8149064: TraceProtectionDomainVerification has been converted to Unified Logging.
mockner
parents:
diff changeset
    60
            System.out.print("Hello!");
b9ed6bef9364 8149064: TraceProtectionDomainVerification has been converted to Unified Logging.
mockner
parents:
diff changeset
    61
        }
b9ed6bef9364 8149064: TraceProtectionDomainVerification has been converted to Unified Logging.
mockner
parents:
diff changeset
    62
    }
b9ed6bef9364 8149064: TraceProtectionDomainVerification has been converted to Unified Logging.
mockner
parents:
diff changeset
    63
}