hotspot/test/gc/arguments/TestDisableDefaultGC.java
author lana
Thu, 12 May 2016 15:15:02 +0000
changeset 37915 be4ff50b6cb6
parent 37298 8df0cc9da41e
child 40631 ed82623d7831
permissions -rw-r--r--
Added tag jdk-9+118 for changeset cc643de7cb06
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
37199
74703ea13069 8068579: Running with -XX:-UseParallelGC does not turn ParalleGC off
pliden
parents:
diff changeset
     1
/*
74703ea13069 8068579: Running with -XX:-UseParallelGC does not turn ParalleGC off
pliden
parents:
diff changeset
     2
 * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
74703ea13069 8068579: Running with -XX:-UseParallelGC does not turn ParalleGC off
pliden
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
74703ea13069 8068579: Running with -XX:-UseParallelGC does not turn ParalleGC off
pliden
parents:
diff changeset
     4
 *
74703ea13069 8068579: Running with -XX:-UseParallelGC does not turn ParalleGC off
pliden
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
74703ea13069 8068579: Running with -XX:-UseParallelGC does not turn ParalleGC off
pliden
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
74703ea13069 8068579: Running with -XX:-UseParallelGC does not turn ParalleGC off
pliden
parents:
diff changeset
     7
 * published by the Free Software Foundation.
74703ea13069 8068579: Running with -XX:-UseParallelGC does not turn ParalleGC off
pliden
parents:
diff changeset
     8
 *
74703ea13069 8068579: Running with -XX:-UseParallelGC does not turn ParalleGC off
pliden
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
74703ea13069 8068579: Running with -XX:-UseParallelGC does not turn ParalleGC off
pliden
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
74703ea13069 8068579: Running with -XX:-UseParallelGC does not turn ParalleGC off
pliden
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
74703ea13069 8068579: Running with -XX:-UseParallelGC does not turn ParalleGC off
pliden
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
74703ea13069 8068579: Running with -XX:-UseParallelGC does not turn ParalleGC off
pliden
parents:
diff changeset
    13
 * accompanied this code).
74703ea13069 8068579: Running with -XX:-UseParallelGC does not turn ParalleGC off
pliden
parents:
diff changeset
    14
 *
74703ea13069 8068579: Running with -XX:-UseParallelGC does not turn ParalleGC off
pliden
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
74703ea13069 8068579: Running with -XX:-UseParallelGC does not turn ParalleGC off
pliden
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
74703ea13069 8068579: Running with -XX:-UseParallelGC does not turn ParalleGC off
pliden
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
74703ea13069 8068579: Running with -XX:-UseParallelGC does not turn ParalleGC off
pliden
parents:
diff changeset
    18
 *
74703ea13069 8068579: Running with -XX:-UseParallelGC does not turn ParalleGC off
pliden
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
74703ea13069 8068579: Running with -XX:-UseParallelGC does not turn ParalleGC off
pliden
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
74703ea13069 8068579: Running with -XX:-UseParallelGC does not turn ParalleGC off
pliden
parents:
diff changeset
    21
 * questions.
74703ea13069 8068579: Running with -XX:-UseParallelGC does not turn ParalleGC off
pliden
parents:
diff changeset
    22
 */
74703ea13069 8068579: Running with -XX:-UseParallelGC does not turn ParalleGC off
pliden
parents:
diff changeset
    23
74703ea13069 8068579: Running with -XX:-UseParallelGC does not turn ParalleGC off
pliden
parents:
diff changeset
    24
/*
74703ea13069 8068579: Running with -XX:-UseParallelGC does not turn ParalleGC off
pliden
parents:
diff changeset
    25
 * @test TestDisableDefaultGC
74703ea13069 8068579: Running with -XX:-UseParallelGC does not turn ParalleGC off
pliden
parents:
diff changeset
    26
 * @summary Test that the VM complains when the default GC is disabled and no other GC is specified
74703ea13069 8068579: Running with -XX:-UseParallelGC does not turn ParalleGC off
pliden
parents:
diff changeset
    27
 * @bug 8068579
74703ea13069 8068579: Running with -XX:-UseParallelGC does not turn ParalleGC off
pliden
parents:
diff changeset
    28
 * @key gc
74703ea13069 8068579: Running with -XX:-UseParallelGC does not turn ParalleGC off
pliden
parents:
diff changeset
    29
 * @library /testlibrary
74703ea13069 8068579: Running with -XX:-UseParallelGC does not turn ParalleGC off
pliden
parents:
diff changeset
    30
 * @requires vm.gc=="null"
37298
8df0cc9da41e 8154028: Several hotspot tests need to be updated after 8153737 (Unsupported Module)
amurillo
parents: 37199
diff changeset
    31
 * @modules java.base/jdk.internal.misc
37199
74703ea13069 8068579: Running with -XX:-UseParallelGC does not turn ParalleGC off
pliden
parents:
diff changeset
    32
 *          java.management
74703ea13069 8068579: Running with -XX:-UseParallelGC does not turn ParalleGC off
pliden
parents:
diff changeset
    33
 * @run driver TestDisableDefaultGC
74703ea13069 8068579: Running with -XX:-UseParallelGC does not turn ParalleGC off
pliden
parents:
diff changeset
    34
 */
74703ea13069 8068579: Running with -XX:-UseParallelGC does not turn ParalleGC off
pliden
parents:
diff changeset
    35
74703ea13069 8068579: Running with -XX:-UseParallelGC does not turn ParalleGC off
pliden
parents:
diff changeset
    36
import jdk.test.lib.ProcessTools;
74703ea13069 8068579: Running with -XX:-UseParallelGC does not turn ParalleGC off
pliden
parents:
diff changeset
    37
import jdk.test.lib.OutputAnalyzer;
74703ea13069 8068579: Running with -XX:-UseParallelGC does not turn ParalleGC off
pliden
parents:
diff changeset
    38
74703ea13069 8068579: Running with -XX:-UseParallelGC does not turn ParalleGC off
pliden
parents:
diff changeset
    39
public class TestDisableDefaultGC {
74703ea13069 8068579: Running with -XX:-UseParallelGC does not turn ParalleGC off
pliden
parents:
diff changeset
    40
    public static void main(String[] args) throws Exception {
74703ea13069 8068579: Running with -XX:-UseParallelGC does not turn ParalleGC off
pliden
parents:
diff changeset
    41
        // Start VM, disabling all possible default GCs
74703ea13069 8068579: Running with -XX:-UseParallelGC does not turn ParalleGC off
pliden
parents:
diff changeset
    42
        ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:-UseSerialGC",
74703ea13069 8068579: Running with -XX:-UseParallelGC does not turn ParalleGC off
pliden
parents:
diff changeset
    43
                                                                  "-XX:-UseParallelGC",
74703ea13069 8068579: Running with -XX:-UseParallelGC does not turn ParalleGC off
pliden
parents:
diff changeset
    44
                                                                  "-XX:-UseG1GC",
74703ea13069 8068579: Running with -XX:-UseParallelGC does not turn ParalleGC off
pliden
parents:
diff changeset
    45
                                                                  "-XX:-UseConcMarkSweepGC",
74703ea13069 8068579: Running with -XX:-UseParallelGC does not turn ParalleGC off
pliden
parents:
diff changeset
    46
                                                                  "-version");
74703ea13069 8068579: Running with -XX:-UseParallelGC does not turn ParalleGC off
pliden
parents:
diff changeset
    47
        OutputAnalyzer output = new OutputAnalyzer(pb.start());
74703ea13069 8068579: Running with -XX:-UseParallelGC does not turn ParalleGC off
pliden
parents:
diff changeset
    48
        output.shouldMatch("Garbage collector not selected");
74703ea13069 8068579: Running with -XX:-UseParallelGC does not turn ParalleGC off
pliden
parents:
diff changeset
    49
        output.shouldHaveExitValue(1);
74703ea13069 8068579: Running with -XX:-UseParallelGC does not turn ParalleGC off
pliden
parents:
diff changeset
    50
    }
74703ea13069 8068579: Running with -XX:-UseParallelGC does not turn ParalleGC off
pliden
parents:
diff changeset
    51
}