test/hotspot/jtreg/gc/arguments/TestDisableDefaultGC.java
author rkennke
Mon, 10 Dec 2018 15:47:44 +0100
changeset 52925 9c18c9d839d3
parent 50525 767cdb97f103
child 53523 4c5184c56dc2
permissions -rw-r--r--
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental) Reviewed-by: kvn, roland, shade, coleenp, lmesnik, pliden, jgeorge, ihse, erikj Contributed-by: Christine Flood <chf@redhat.com>, Aleksey Shipilev <shade@redhat.com>, Roland Westrelin <rwestrel@redhat.com>, Zhenygu Gu <zgu@redhat.com>, Andrew Haley <aph@redhat.com>, Andrew Dinn <adinn@redhat.com>, Mario Torre <mtorre@redhat.com>, Roman Kennke <rkennke@redhat.com>
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
/*
52925
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents: 50525
diff changeset
     2
 * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
37199
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
40631
ed82623d7831 8157957: ClassNotFoundException: jdk.test.lib.JDKToolFinder
ctornqvi
parents: 37298
diff changeset
    29
 * @library /test/lib
37199
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
40631
ed82623d7831 8157957: ClassNotFoundException: jdk.test.lib.JDKToolFinder
ctornqvi
parents: 37298
diff changeset
    36
import jdk.test.lib.process.ProcessTools;
ed82623d7831 8157957: ClassNotFoundException: jdk.test.lib.JDKToolFinder
ctornqvi
parents: 37298
diff changeset
    37
import jdk.test.lib.process.OutputAnalyzer;
37199
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",
50525
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents: 47216
diff changeset
    46
                                                                  "-XX:+UnlockExperimentalVMOptions",
52925
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents: 50525
diff changeset
    47
                                                                  "-XX:-UseShenandoahGC",
50525
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents: 47216
diff changeset
    48
                                                                  "-XX:-UseZGC",
37199
74703ea13069 8068579: Running with -XX:-UseParallelGC does not turn ParalleGC off
pliden
parents:
diff changeset
    49
                                                                  "-version");
74703ea13069 8068579: Running with -XX:-UseParallelGC does not turn ParalleGC off
pliden
parents:
diff changeset
    50
        OutputAnalyzer output = new OutputAnalyzer(pb.start());
74703ea13069 8068579: Running with -XX:-UseParallelGC does not turn ParalleGC off
pliden
parents:
diff changeset
    51
        output.shouldMatch("Garbage collector not selected");
74703ea13069 8068579: Running with -XX:-UseParallelGC does not turn ParalleGC off
pliden
parents:
diff changeset
    52
        output.shouldHaveExitValue(1);
74703ea13069 8068579: Running with -XX:-UseParallelGC does not turn ParalleGC off
pliden
parents:
diff changeset
    53
    }
74703ea13069 8068579: Running with -XX:-UseParallelGC does not turn ParalleGC off
pliden
parents:
diff changeset
    54
}