test/hotspot/jtreg/gc/arguments/TestDisableDefaultGC.java
author lkorinth
Wed, 13 Nov 2019 11:37:29 +0100
changeset 59053 ba6c248cae19
parent 55610 47fdb5b0fa41
permissions -rw-r--r--
8232365: Implementation for JEP 363: Remove the Concurrent Mark Sweep (CMS) Garbage Collector Reviewed-by: kbarrett, tschatzl, erikj, coleenp, dholmes
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
/*
53523
4c5184c56dc2 8214799: Add package declaration to each JTREG test case in the gc folder
lkorinth
parents: 52925
diff changeset
     2
 * Copyright (c) 2016, 2019, 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
53523
4c5184c56dc2 8214799: Add package declaration to each JTREG test case in the gc folder
lkorinth
parents: 52925
diff changeset
    24
package gc.arguments;
4c5184c56dc2 8214799: Add package declaration to each JTREG test case in the gc folder
lkorinth
parents: 52925
diff changeset
    25
37199
74703ea13069 8068579: Running with -XX:-UseParallelGC does not turn ParalleGC off
pliden
parents:
diff changeset
    26
/*
74703ea13069 8068579: Running with -XX:-UseParallelGC does not turn ParalleGC off
pliden
parents:
diff changeset
    27
 * @test TestDisableDefaultGC
74703ea13069 8068579: Running with -XX:-UseParallelGC does not turn ParalleGC off
pliden
parents:
diff changeset
    28
 * @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
    29
 * @bug 8068579
74703ea13069 8068579: Running with -XX:-UseParallelGC does not turn ParalleGC off
pliden
parents:
diff changeset
    30
 * @key gc
40631
ed82623d7831 8157957: ClassNotFoundException: jdk.test.lib.JDKToolFinder
ctornqvi
parents: 37298
diff changeset
    31
 * @library /test/lib
55610
47fdb5b0fa41 8217170: gc/arguments/TestUseCompressedOopsErgo.java timed out
kbarrett
parents: 53523
diff changeset
    32
 * @library /
37199
74703ea13069 8068579: Running with -XX:-UseParallelGC does not turn ParalleGC off
pliden
parents:
diff changeset
    33
 * @requires vm.gc=="null"
37298
8df0cc9da41e 8154028: Several hotspot tests need to be updated after 8153737 (Unsupported Module)
amurillo
parents: 37199
diff changeset
    34
 * @modules java.base/jdk.internal.misc
37199
74703ea13069 8068579: Running with -XX:-UseParallelGC does not turn ParalleGC off
pliden
parents:
diff changeset
    35
 *          java.management
53523
4c5184c56dc2 8214799: Add package declaration to each JTREG test case in the gc folder
lkorinth
parents: 52925
diff changeset
    36
 * @run driver gc.arguments.TestDisableDefaultGC
37199
74703ea13069 8068579: Running with -XX:-UseParallelGC does not turn ParalleGC off
pliden
parents:
diff changeset
    37
 */
74703ea13069 8068579: Running with -XX:-UseParallelGC does not turn ParalleGC off
pliden
parents:
diff changeset
    38
40631
ed82623d7831 8157957: ClassNotFoundException: jdk.test.lib.JDKToolFinder
ctornqvi
parents: 37298
diff changeset
    39
import jdk.test.lib.process.OutputAnalyzer;
37199
74703ea13069 8068579: Running with -XX:-UseParallelGC does not turn ParalleGC off
pliden
parents:
diff changeset
    40
74703ea13069 8068579: Running with -XX:-UseParallelGC does not turn ParalleGC off
pliden
parents:
diff changeset
    41
public class TestDisableDefaultGC {
74703ea13069 8068579: Running with -XX:-UseParallelGC does not turn ParalleGC off
pliden
parents:
diff changeset
    42
    public static void main(String[] args) throws Exception {
74703ea13069 8068579: Running with -XX:-UseParallelGC does not turn ParalleGC off
pliden
parents:
diff changeset
    43
        // Start VM, disabling all possible default GCs
55610
47fdb5b0fa41 8217170: gc/arguments/TestUseCompressedOopsErgo.java timed out
kbarrett
parents: 53523
diff changeset
    44
        ProcessBuilder pb = GCArguments.createJavaProcessBuilder("-XX:-UseSerialGC",
47fdb5b0fa41 8217170: gc/arguments/TestUseCompressedOopsErgo.java timed out
kbarrett
parents: 53523
diff changeset
    45
                                                                 "-XX:-UseParallelGC",
47fdb5b0fa41 8217170: gc/arguments/TestUseCompressedOopsErgo.java timed out
kbarrett
parents: 53523
diff changeset
    46
                                                                 "-XX:-UseG1GC",
47fdb5b0fa41 8217170: gc/arguments/TestUseCompressedOopsErgo.java timed out
kbarrett
parents: 53523
diff changeset
    47
                                                                 "-XX:+UnlockExperimentalVMOptions",
47fdb5b0fa41 8217170: gc/arguments/TestUseCompressedOopsErgo.java timed out
kbarrett
parents: 53523
diff changeset
    48
                                                                 "-XX:-UseShenandoahGC",
47fdb5b0fa41 8217170: gc/arguments/TestUseCompressedOopsErgo.java timed out
kbarrett
parents: 53523
diff changeset
    49
                                                                 "-XX:-UseZGC",
47fdb5b0fa41 8217170: gc/arguments/TestUseCompressedOopsErgo.java timed out
kbarrett
parents: 53523
diff changeset
    50
                                                                 "-version");
37199
74703ea13069 8068579: Running with -XX:-UseParallelGC does not turn ParalleGC off
pliden
parents:
diff changeset
    51
        OutputAnalyzer output = new OutputAnalyzer(pb.start());
74703ea13069 8068579: Running with -XX:-UseParallelGC does not turn ParalleGC off
pliden
parents:
diff changeset
    52
        output.shouldMatch("Garbage collector not selected");
74703ea13069 8068579: Running with -XX:-UseParallelGC does not turn ParalleGC off
pliden
parents:
diff changeset
    53
        output.shouldHaveExitValue(1);
74703ea13069 8068579: Running with -XX:-UseParallelGC does not turn ParalleGC off
pliden
parents:
diff changeset
    54
    }
74703ea13069 8068579: Running with -XX:-UseParallelGC does not turn ParalleGC off
pliden
parents:
diff changeset
    55
}