hotspot/test/runtime/logging/OsCpuLoggingTest.java
author jdv
Tue, 09 Aug 2016 13:45:17 +0530
changeset 40432 6a878eae7459
parent 37477 0ca0b7388bb6
child 40631 ed82623d7831
permissions -rw-r--r--
8160456: KSS : resource loading issue in TIFFMetadataFormat.java Reviewed-by: prr, bpb
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
37430
fd743dadef12 8151939: VM_Version_init() print buffer is too small
coleenp
parents:
diff changeset
     1
/*
fd743dadef12 8151939: VM_Version_init() print buffer is too small
coleenp
parents:
diff changeset
     2
 * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
fd743dadef12 8151939: VM_Version_init() print buffer is too small
coleenp
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
fd743dadef12 8151939: VM_Version_init() print buffer is too small
coleenp
parents:
diff changeset
     4
 *
fd743dadef12 8151939: VM_Version_init() print buffer is too small
coleenp
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
fd743dadef12 8151939: VM_Version_init() print buffer is too small
coleenp
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
fd743dadef12 8151939: VM_Version_init() print buffer is too small
coleenp
parents:
diff changeset
     7
 * published by the Free Software Foundation.
fd743dadef12 8151939: VM_Version_init() print buffer is too small
coleenp
parents:
diff changeset
     8
 *
fd743dadef12 8151939: VM_Version_init() print buffer is too small
coleenp
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
fd743dadef12 8151939: VM_Version_init() print buffer is too small
coleenp
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
fd743dadef12 8151939: VM_Version_init() print buffer is too small
coleenp
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.    See the GNU General Public License
fd743dadef12 8151939: VM_Version_init() print buffer is too small
coleenp
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
fd743dadef12 8151939: VM_Version_init() print buffer is too small
coleenp
parents:
diff changeset
    13
 * accompanied this code).
fd743dadef12 8151939: VM_Version_init() print buffer is too small
coleenp
parents:
diff changeset
    14
 *
fd743dadef12 8151939: VM_Version_init() print buffer is too small
coleenp
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
fd743dadef12 8151939: VM_Version_init() print buffer is too small
coleenp
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
fd743dadef12 8151939: VM_Version_init() print buffer is too small
coleenp
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
fd743dadef12 8151939: VM_Version_init() print buffer is too small
coleenp
parents:
diff changeset
    18
 *
fd743dadef12 8151939: VM_Version_init() print buffer is too small
coleenp
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
fd743dadef12 8151939: VM_Version_init() print buffer is too small
coleenp
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
fd743dadef12 8151939: VM_Version_init() print buffer is too small
coleenp
parents:
diff changeset
    21
 * questions.
fd743dadef12 8151939: VM_Version_init() print buffer is too small
coleenp
parents:
diff changeset
    22
 */
fd743dadef12 8151939: VM_Version_init() print buffer is too small
coleenp
parents:
diff changeset
    23
fd743dadef12 8151939: VM_Version_init() print buffer is too small
coleenp
parents:
diff changeset
    24
/*
fd743dadef12 8151939: VM_Version_init() print buffer is too small
coleenp
parents:
diff changeset
    25
 * @test
fd743dadef12 8151939: VM_Version_init() print buffer is too small
coleenp
parents:
diff changeset
    26
 * @bug 8151939
fd743dadef12 8151939: VM_Version_init() print buffer is too small
coleenp
parents:
diff changeset
    27
 * @summary os+cpu output should contain some os,cpu information
fd743dadef12 8151939: VM_Version_init() print buffer is too small
coleenp
parents:
diff changeset
    28
 * @library /testlibrary
37477
dcubed
parents: 37430
diff changeset
    29
 * @modules java.base/jdk.internal.misc
37430
fd743dadef12 8151939: VM_Version_init() print buffer is too small
coleenp
parents:
diff changeset
    30
 *          java.management
fd743dadef12 8151939: VM_Version_init() print buffer is too small
coleenp
parents:
diff changeset
    31
 * @build jdk.test.lib.OutputAnalyzer jdk.test.lib.ProcessTools
fd743dadef12 8151939: VM_Version_init() print buffer is too small
coleenp
parents:
diff changeset
    32
 * @run driver OsCpuLoggingTest
fd743dadef12 8151939: VM_Version_init() print buffer is too small
coleenp
parents:
diff changeset
    33
 */
fd743dadef12 8151939: VM_Version_init() print buffer is too small
coleenp
parents:
diff changeset
    34
fd743dadef12 8151939: VM_Version_init() print buffer is too small
coleenp
parents:
diff changeset
    35
import java.io.File;
fd743dadef12 8151939: VM_Version_init() print buffer is too small
coleenp
parents:
diff changeset
    36
import java.util.Map;
fd743dadef12 8151939: VM_Version_init() print buffer is too small
coleenp
parents:
diff changeset
    37
import jdk.test.lib.*;
fd743dadef12 8151939: VM_Version_init() print buffer is too small
coleenp
parents:
diff changeset
    38
fd743dadef12 8151939: VM_Version_init() print buffer is too small
coleenp
parents:
diff changeset
    39
public class OsCpuLoggingTest {
fd743dadef12 8151939: VM_Version_init() print buffer is too small
coleenp
parents:
diff changeset
    40
fd743dadef12 8151939: VM_Version_init() print buffer is too small
coleenp
parents:
diff changeset
    41
    static void analyzeOutputForOsLog(OutputAnalyzer output) throws Exception {
fd743dadef12 8151939: VM_Version_init() print buffer is too small
coleenp
parents:
diff changeset
    42
        // Aix has it's own logging
fd743dadef12 8151939: VM_Version_init() print buffer is too small
coleenp
parents:
diff changeset
    43
        if (!Platform.isAix()) {
fd743dadef12 8151939: VM_Version_init() print buffer is too small
coleenp
parents:
diff changeset
    44
            output.shouldContain("SafePoint Polling address");
fd743dadef12 8151939: VM_Version_init() print buffer is too small
coleenp
parents:
diff changeset
    45
        }
fd743dadef12 8151939: VM_Version_init() print buffer is too small
coleenp
parents:
diff changeset
    46
        output.shouldHaveExitValue(0);
fd743dadef12 8151939: VM_Version_init() print buffer is too small
coleenp
parents:
diff changeset
    47
    }
fd743dadef12 8151939: VM_Version_init() print buffer is too small
coleenp
parents:
diff changeset
    48
fd743dadef12 8151939: VM_Version_init() print buffer is too small
coleenp
parents:
diff changeset
    49
    static void analyzeOutputForOsCpuLog(OutputAnalyzer output) throws Exception {
fd743dadef12 8151939: VM_Version_init() print buffer is too small
coleenp
parents:
diff changeset
    50
        output.shouldContain("CPU:total");
fd743dadef12 8151939: VM_Version_init() print buffer is too small
coleenp
parents:
diff changeset
    51
        output.shouldHaveExitValue(0);
fd743dadef12 8151939: VM_Version_init() print buffer is too small
coleenp
parents:
diff changeset
    52
    }
fd743dadef12 8151939: VM_Version_init() print buffer is too small
coleenp
parents:
diff changeset
    53
fd743dadef12 8151939: VM_Version_init() print buffer is too small
coleenp
parents:
diff changeset
    54
    public static void main(String[] args) throws Exception {
fd743dadef12 8151939: VM_Version_init() print buffer is too small
coleenp
parents:
diff changeset
    55
fd743dadef12 8151939: VM_Version_init() print buffer is too small
coleenp
parents:
diff changeset
    56
        ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-Xlog:os+cpu", "-version");
fd743dadef12 8151939: VM_Version_init() print buffer is too small
coleenp
parents:
diff changeset
    57
        OutputAnalyzer output = new OutputAnalyzer(pb.start());
fd743dadef12 8151939: VM_Version_init() print buffer is too small
coleenp
parents:
diff changeset
    58
        analyzeOutputForOsCpuLog(output);
fd743dadef12 8151939: VM_Version_init() print buffer is too small
coleenp
parents:
diff changeset
    59
fd743dadef12 8151939: VM_Version_init() print buffer is too small
coleenp
parents:
diff changeset
    60
        pb = ProcessTools.createJavaProcessBuilder("-Xlog:os", "-version");
fd743dadef12 8151939: VM_Version_init() print buffer is too small
coleenp
parents:
diff changeset
    61
        output = new OutputAnalyzer(pb.start());
fd743dadef12 8151939: VM_Version_init() print buffer is too small
coleenp
parents:
diff changeset
    62
        analyzeOutputForOsLog(output);
fd743dadef12 8151939: VM_Version_init() print buffer is too small
coleenp
parents:
diff changeset
    63
    }
fd743dadef12 8151939: VM_Version_init() print buffer is too small
coleenp
parents:
diff changeset
    64
}