hotspot/test/gc/TestG1ZeroPGCTJcmdThreadPrint.java
author duke
Wed, 05 Jul 2017 19:42:32 +0200
changeset 24615 74eb0778e4f2
parent 15750 50a977df7b4a
permissions -rw-r--r--
Merge
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
15750
50a977df7b4a 8008188: Add regression test for 8005875
johnc
parents:
diff changeset
     1
/*
50a977df7b4a 8008188: Add regression test for 8005875
johnc
parents:
diff changeset
     2
 * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
50a977df7b4a 8008188: Add regression test for 8005875
johnc
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
50a977df7b4a 8008188: Add regression test for 8005875
johnc
parents:
diff changeset
     4
 *
50a977df7b4a 8008188: Add regression test for 8005875
johnc
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
50a977df7b4a 8008188: Add regression test for 8005875
johnc
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
50a977df7b4a 8008188: Add regression test for 8005875
johnc
parents:
diff changeset
     7
 * published by the Free Software Foundation.
50a977df7b4a 8008188: Add regression test for 8005875
johnc
parents:
diff changeset
     8
 *
50a977df7b4a 8008188: Add regression test for 8005875
johnc
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
50a977df7b4a 8008188: Add regression test for 8005875
johnc
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
50a977df7b4a 8008188: Add regression test for 8005875
johnc
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
50a977df7b4a 8008188: Add regression test for 8005875
johnc
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
50a977df7b4a 8008188: Add regression test for 8005875
johnc
parents:
diff changeset
    13
 * accompanied this code).
50a977df7b4a 8008188: Add regression test for 8005875
johnc
parents:
diff changeset
    14
 *
50a977df7b4a 8008188: Add regression test for 8005875
johnc
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
50a977df7b4a 8008188: Add regression test for 8005875
johnc
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
50a977df7b4a 8008188: Add regression test for 8005875
johnc
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
50a977df7b4a 8008188: Add regression test for 8005875
johnc
parents:
diff changeset
    18
 *
50a977df7b4a 8008188: Add regression test for 8005875
johnc
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
50a977df7b4a 8008188: Add regression test for 8005875
johnc
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
50a977df7b4a 8008188: Add regression test for 8005875
johnc
parents:
diff changeset
    21
 * questions.
50a977df7b4a 8008188: Add regression test for 8005875
johnc
parents:
diff changeset
    22
 */
50a977df7b4a 8008188: Add regression test for 8005875
johnc
parents:
diff changeset
    23
50a977df7b4a 8008188: Add regression test for 8005875
johnc
parents:
diff changeset
    24
/* @test TestG1ZeroPGCTJcmdThreadPrint
50a977df7b4a 8008188: Add regression test for 8005875
johnc
parents:
diff changeset
    25
 * @key gc
50a977df7b4a 8008188: Add regression test for 8005875
johnc
parents:
diff changeset
    26
 * @bug 8005875
50a977df7b4a 8008188: Add regression test for 8005875
johnc
parents:
diff changeset
    27
 * @summary Use jcmd to generate a thread dump of a Java program being run with PGCT=0 to verify 8005875
50a977df7b4a 8008188: Add regression test for 8005875
johnc
parents:
diff changeset
    28
 * @library /testlibrary
50a977df7b4a 8008188: Add regression test for 8005875
johnc
parents:
diff changeset
    29
 * @run main/othervm -XX:+UseG1GC -XX:ParallelGCThreads=0 -XX:+IgnoreUnrecognizedVMOptions TestG1ZeroPGCTJcmdThreadPrint
50a977df7b4a 8008188: Add regression test for 8005875
johnc
parents:
diff changeset
    30
 */
50a977df7b4a 8008188: Add regression test for 8005875
johnc
parents:
diff changeset
    31
50a977df7b4a 8008188: Add regression test for 8005875
johnc
parents:
diff changeset
    32
import com.oracle.java.testlibrary.*;
50a977df7b4a 8008188: Add regression test for 8005875
johnc
parents:
diff changeset
    33
50a977df7b4a 8008188: Add regression test for 8005875
johnc
parents:
diff changeset
    34
public class TestG1ZeroPGCTJcmdThreadPrint {
50a977df7b4a 8008188: Add regression test for 8005875
johnc
parents:
diff changeset
    35
  public static void main(String args[]) throws Exception {
50a977df7b4a 8008188: Add regression test for 8005875
johnc
parents:
diff changeset
    36
50a977df7b4a 8008188: Add regression test for 8005875
johnc
parents:
diff changeset
    37
    // Grab the pid from the current java process
50a977df7b4a 8008188: Add regression test for 8005875
johnc
parents:
diff changeset
    38
    String pid = Integer.toString(ProcessTools.getProcessId());
50a977df7b4a 8008188: Add regression test for 8005875
johnc
parents:
diff changeset
    39
50a977df7b4a 8008188: Add regression test for 8005875
johnc
parents:
diff changeset
    40
    // Create a ProcessBuilder
50a977df7b4a 8008188: Add regression test for 8005875
johnc
parents:
diff changeset
    41
    ProcessBuilder pb = new ProcessBuilder();
50a977df7b4a 8008188: Add regression test for 8005875
johnc
parents:
diff changeset
    42
50a977df7b4a 8008188: Add regression test for 8005875
johnc
parents:
diff changeset
    43
    // Run jcmd <pid> Thread.print
50a977df7b4a 8008188: Add regression test for 8005875
johnc
parents:
diff changeset
    44
    pb.command(JDKToolFinder.getJDKTool("jcmd"), pid, "Thread.print");
50a977df7b4a 8008188: Add regression test for 8005875
johnc
parents:
diff changeset
    45
50a977df7b4a 8008188: Add regression test for 8005875
johnc
parents:
diff changeset
    46
    OutputAnalyzer output = new OutputAnalyzer(pb.start());
50a977df7b4a 8008188: Add regression test for 8005875
johnc
parents:
diff changeset
    47
50a977df7b4a 8008188: Add regression test for 8005875
johnc
parents:
diff changeset
    48
    // There shouldn't be a work gang for concurrent marking.
50a977df7b4a 8008188: Add regression test for 8005875
johnc
parents:
diff changeset
    49
    output.shouldNotContain("G1 Parallel Marking Threads");
50a977df7b4a 8008188: Add regression test for 8005875
johnc
parents:
diff changeset
    50
50a977df7b4a 8008188: Add regression test for 8005875
johnc
parents:
diff changeset
    51
    // Make sure we didn't crash
50a977df7b4a 8008188: Add regression test for 8005875
johnc
parents:
diff changeset
    52
    output.shouldHaveExitValue(0);
50a977df7b4a 8008188: Add regression test for 8005875
johnc
parents:
diff changeset
    53
  }
50a977df7b4a 8008188: Add regression test for 8005875
johnc
parents:
diff changeset
    54
}