hotspot/test/runtime/ErrorHandling/CreateCoredumpOnCrash.java
author stefank
Wed, 20 Apr 2016 09:58:15 +0200
changeset 38000 7519aefb5b86
parent 36851 03e2f4d0a421
child 38152 80e5da81fb2c
permissions -rw-r--r--
8079843: do_young_space_rescan - comment out of sync with code Reviewed-by: mgerdin, sjohanss, ehelin, tschatzl
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
30622
648d51c142bd 8078121: Add 'CreateMinidumpOnCrash' (JDK-8074354) caused many tests failed in nightly testing
ctornqvi
parents:
diff changeset
     1
/*
648d51c142bd 8078121: Add 'CreateMinidumpOnCrash' (JDK-8074354) caused many tests failed in nightly testing
ctornqvi
parents:
diff changeset
     2
 * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
648d51c142bd 8078121: Add 'CreateMinidumpOnCrash' (JDK-8074354) caused many tests failed in nightly testing
ctornqvi
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
648d51c142bd 8078121: Add 'CreateMinidumpOnCrash' (JDK-8074354) caused many tests failed in nightly testing
ctornqvi
parents:
diff changeset
     4
 *
648d51c142bd 8078121: Add 'CreateMinidumpOnCrash' (JDK-8074354) caused many tests failed in nightly testing
ctornqvi
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
648d51c142bd 8078121: Add 'CreateMinidumpOnCrash' (JDK-8074354) caused many tests failed in nightly testing
ctornqvi
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
648d51c142bd 8078121: Add 'CreateMinidumpOnCrash' (JDK-8074354) caused many tests failed in nightly testing
ctornqvi
parents:
diff changeset
     7
 * published by the Free Software Foundation.
648d51c142bd 8078121: Add 'CreateMinidumpOnCrash' (JDK-8074354) caused many tests failed in nightly testing
ctornqvi
parents:
diff changeset
     8
 *
648d51c142bd 8078121: Add 'CreateMinidumpOnCrash' (JDK-8074354) caused many tests failed in nightly testing
ctornqvi
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
648d51c142bd 8078121: Add 'CreateMinidumpOnCrash' (JDK-8074354) caused many tests failed in nightly testing
ctornqvi
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
648d51c142bd 8078121: Add 'CreateMinidumpOnCrash' (JDK-8074354) caused many tests failed in nightly testing
ctornqvi
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
648d51c142bd 8078121: Add 'CreateMinidumpOnCrash' (JDK-8074354) caused many tests failed in nightly testing
ctornqvi
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
648d51c142bd 8078121: Add 'CreateMinidumpOnCrash' (JDK-8074354) caused many tests failed in nightly testing
ctornqvi
parents:
diff changeset
    13
 * accompanied this code).
648d51c142bd 8078121: Add 'CreateMinidumpOnCrash' (JDK-8074354) caused many tests failed in nightly testing
ctornqvi
parents:
diff changeset
    14
 *
648d51c142bd 8078121: Add 'CreateMinidumpOnCrash' (JDK-8074354) caused many tests failed in nightly testing
ctornqvi
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
648d51c142bd 8078121: Add 'CreateMinidumpOnCrash' (JDK-8074354) caused many tests failed in nightly testing
ctornqvi
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
648d51c142bd 8078121: Add 'CreateMinidumpOnCrash' (JDK-8074354) caused many tests failed in nightly testing
ctornqvi
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
648d51c142bd 8078121: Add 'CreateMinidumpOnCrash' (JDK-8074354) caused many tests failed in nightly testing
ctornqvi
parents:
diff changeset
    18
 *
648d51c142bd 8078121: Add 'CreateMinidumpOnCrash' (JDK-8074354) caused many tests failed in nightly testing
ctornqvi
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
648d51c142bd 8078121: Add 'CreateMinidumpOnCrash' (JDK-8074354) caused many tests failed in nightly testing
ctornqvi
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
648d51c142bd 8078121: Add 'CreateMinidumpOnCrash' (JDK-8074354) caused many tests failed in nightly testing
ctornqvi
parents:
diff changeset
    21
 * questions.
648d51c142bd 8078121: Add 'CreateMinidumpOnCrash' (JDK-8074354) caused many tests failed in nightly testing
ctornqvi
parents:
diff changeset
    22
 */
648d51c142bd 8078121: Add 'CreateMinidumpOnCrash' (JDK-8074354) caused many tests failed in nightly testing
ctornqvi
parents:
diff changeset
    23
648d51c142bd 8078121: Add 'CreateMinidumpOnCrash' (JDK-8074354) caused many tests failed in nightly testing
ctornqvi
parents:
diff changeset
    24
/*
648d51c142bd 8078121: Add 'CreateMinidumpOnCrash' (JDK-8074354) caused many tests failed in nightly testing
ctornqvi
parents:
diff changeset
    25
 * @test
648d51c142bd 8078121: Add 'CreateMinidumpOnCrash' (JDK-8074354) caused many tests failed in nightly testing
ctornqvi
parents:
diff changeset
    26
 * @library /testlibrary
36851
03e2f4d0a421 8153737: Unsupported Module
chegar
parents: 31977
diff changeset
    27
 * @modules java.base/jdk.internal.misc
30622
648d51c142bd 8078121: Add 'CreateMinidumpOnCrash' (JDK-8074354) caused many tests failed in nightly testing
ctornqvi
parents:
diff changeset
    28
 *          java.compiler
648d51c142bd 8078121: Add 'CreateMinidumpOnCrash' (JDK-8074354) caused many tests failed in nightly testing
ctornqvi
parents:
diff changeset
    29
 *          java.management
648d51c142bd 8078121: Add 'CreateMinidumpOnCrash' (JDK-8074354) caused many tests failed in nightly testing
ctornqvi
parents:
diff changeset
    30
 *          jdk.jvmstat/sun.jvmstat.monitor
648d51c142bd 8078121: Add 'CreateMinidumpOnCrash' (JDK-8074354) caused many tests failed in nightly testing
ctornqvi
parents:
diff changeset
    31
 * @build jdk.test.lib.*
648d51c142bd 8078121: Add 'CreateMinidumpOnCrash' (JDK-8074354) caused many tests failed in nightly testing
ctornqvi
parents:
diff changeset
    32
 * @run driver CreateCoredumpOnCrash
648d51c142bd 8078121: Add 'CreateMinidumpOnCrash' (JDK-8074354) caused many tests failed in nightly testing
ctornqvi
parents:
diff changeset
    33
 */
648d51c142bd 8078121: Add 'CreateMinidumpOnCrash' (JDK-8074354) caused many tests failed in nightly testing
ctornqvi
parents:
diff changeset
    34
648d51c142bd 8078121: Add 'CreateMinidumpOnCrash' (JDK-8074354) caused many tests failed in nightly testing
ctornqvi
parents:
diff changeset
    35
import jdk.test.lib.*;
648d51c142bd 8078121: Add 'CreateMinidumpOnCrash' (JDK-8074354) caused many tests failed in nightly testing
ctornqvi
parents:
diff changeset
    36
import sun.misc.Unsafe;
648d51c142bd 8078121: Add 'CreateMinidumpOnCrash' (JDK-8074354) caused many tests failed in nightly testing
ctornqvi
parents:
diff changeset
    37
648d51c142bd 8078121: Add 'CreateMinidumpOnCrash' (JDK-8074354) caused many tests failed in nightly testing
ctornqvi
parents:
diff changeset
    38
public class CreateCoredumpOnCrash {
648d51c142bd 8078121: Add 'CreateMinidumpOnCrash' (JDK-8074354) caused many tests failed in nightly testing
ctornqvi
parents:
diff changeset
    39
    private static class Crasher {
648d51c142bd 8078121: Add 'CreateMinidumpOnCrash' (JDK-8074354) caused many tests failed in nightly testing
ctornqvi
parents:
diff changeset
    40
        public static void main(String[] args) {
31977
a737c35bf8f6 8130676: [TESTBUG] aix: Port CreateCoreDumpOnCrash added in 8078121
goetz
parents: 31789
diff changeset
    41
            Utils.getUnsafe().putInt(0L, 0);
30622
648d51c142bd 8078121: Add 'CreateMinidumpOnCrash' (JDK-8074354) caused many tests failed in nightly testing
ctornqvi
parents:
diff changeset
    42
        }
648d51c142bd 8078121: Add 'CreateMinidumpOnCrash' (JDK-8074354) caused many tests failed in nightly testing
ctornqvi
parents:
diff changeset
    43
    }
648d51c142bd 8078121: Add 'CreateMinidumpOnCrash' (JDK-8074354) caused many tests failed in nightly testing
ctornqvi
parents:
diff changeset
    44
648d51c142bd 8078121: Add 'CreateMinidumpOnCrash' (JDK-8074354) caused many tests failed in nightly testing
ctornqvi
parents:
diff changeset
    45
    public static void main(String[] args) throws Exception {
648d51c142bd 8078121: Add 'CreateMinidumpOnCrash' (JDK-8074354) caused many tests failed in nightly testing
ctornqvi
parents:
diff changeset
    46
        runTest("-XX:-CreateCoredumpOnCrash").shouldContain("CreateCoredumpOnCrash turned off, no core file dumped");
648d51c142bd 8078121: Add 'CreateMinidumpOnCrash' (JDK-8074354) caused many tests failed in nightly testing
ctornqvi
parents:
diff changeset
    47
648d51c142bd 8078121: Add 'CreateMinidumpOnCrash' (JDK-8074354) caused many tests failed in nightly testing
ctornqvi
parents:
diff changeset
    48
        if (Platform.isWindows()) {
648d51c142bd 8078121: Add 'CreateMinidumpOnCrash' (JDK-8074354) caused many tests failed in nightly testing
ctornqvi
parents:
diff changeset
    49
            // The old CreateMinidumpOnCrash option should still work
648d51c142bd 8078121: Add 'CreateMinidumpOnCrash' (JDK-8074354) caused many tests failed in nightly testing
ctornqvi
parents:
diff changeset
    50
            runTest("-XX:-CreateMinidumpOnCrash").shouldContain("CreateCoredumpOnCrash turned off, no core file dumped");
648d51c142bd 8078121: Add 'CreateMinidumpOnCrash' (JDK-8074354) caused many tests failed in nightly testing
ctornqvi
parents:
diff changeset
    51
        } else {
648d51c142bd 8078121: Add 'CreateMinidumpOnCrash' (JDK-8074354) caused many tests failed in nightly testing
ctornqvi
parents:
diff changeset
    52
            runTest("-XX:+CreateCoredumpOnCrash").shouldNotContain("CreateCoredumpOnCrash turned off, no core file dumped");
648d51c142bd 8078121: Add 'CreateMinidumpOnCrash' (JDK-8074354) caused many tests failed in nightly testing
ctornqvi
parents:
diff changeset
    53
        }
648d51c142bd 8078121: Add 'CreateMinidumpOnCrash' (JDK-8074354) caused many tests failed in nightly testing
ctornqvi
parents:
diff changeset
    54
648d51c142bd 8078121: Add 'CreateMinidumpOnCrash' (JDK-8074354) caused many tests failed in nightly testing
ctornqvi
parents:
diff changeset
    55
    }
648d51c142bd 8078121: Add 'CreateMinidumpOnCrash' (JDK-8074354) caused many tests failed in nightly testing
ctornqvi
parents:
diff changeset
    56
    public static OutputAnalyzer runTest(String option) throws Exception {
648d51c142bd 8078121: Add 'CreateMinidumpOnCrash' (JDK-8074354) caused many tests failed in nightly testing
ctornqvi
parents:
diff changeset
    57
        return new OutputAnalyzer(
648d51c142bd 8078121: Add 'CreateMinidumpOnCrash' (JDK-8074354) caused many tests failed in nightly testing
ctornqvi
parents:
diff changeset
    58
            ProcessTools.createJavaProcessBuilder(
648d51c142bd 8078121: Add 'CreateMinidumpOnCrash' (JDK-8074354) caused many tests failed in nightly testing
ctornqvi
parents:
diff changeset
    59
            "-Xmx64m", "-XX:-TransmitErrorReport", option, Crasher.class.getName())
648d51c142bd 8078121: Add 'CreateMinidumpOnCrash' (JDK-8074354) caused many tests failed in nightly testing
ctornqvi
parents:
diff changeset
    60
            .start());
648d51c142bd 8078121: Add 'CreateMinidumpOnCrash' (JDK-8074354) caused many tests failed in nightly testing
ctornqvi
parents:
diff changeset
    61
    }
648d51c142bd 8078121: Add 'CreateMinidumpOnCrash' (JDK-8074354) caused many tests failed in nightly testing
ctornqvi
parents:
diff changeset
    62
}