JvmciShutdownEventTest.java revision 9814:22fd02fad88b
131695Smsmith/*
231695Smsmith * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
331695Smsmith * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
431695Smsmith *
531695Smsmith * This code is free software; you can redistribute it and/or modify it
631695Smsmith * under the terms of the GNU General Public License version 2 only, as
731695Smsmith * published by the Free Software Foundation.
831695Smsmith *
931695Smsmith * This code is distributed in the hope that it will be useful, but WITHOUT
1031695Smsmith * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
1131695Smsmith * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
1231695Smsmith * version 2 for more details (a copy is included in the LICENSE file that
1331695Smsmith * accompanied this code).
1431695Smsmith *
1531695Smsmith * You should have received a copy of the GNU General Public License version
1631695Smsmith * 2 along with this work; if not, write to the Free Software Foundation,
1731695Smsmith * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
1831695Smsmith *
1931695Smsmith * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2031695Smsmith * or visit www.oracle.com if you need additional information or have any
2131695Smsmith * questions.
2231695Smsmith */
2331695Smsmith
2431695Smsmith/*
2550477Speter * @test
2631695Smsmith * @bug 8136421
27235802Sdelphij * @requires (os.simpleArch == "x64" | os.simpleArch == "sparcv9" | os.simpleArch == "aarch64")
2831695Smsmith * @library /testlibrary /
2931695Smsmith * @build compiler.jvmci.common.JVMCIHelpers
3031695Smsmith *        compiler.jvmci.events.JvmciShutdownEventListener
3131695Smsmith *        compiler.jvmci.events.JvmciShutdownEventTest
3231695Smsmith * @run main jdk.test.lib.FileInstaller ../common/services/ ./META-INF/services/
3331695Smsmith * @run main jdk.test.lib.FileInstaller ./JvmciShutdownEventTest.config
3468963Sru *     ./META-INF/services/jdk.vm.ci.hotspot.HotSpotVMEventListener
35104418Sjohan * @run main ClassFileInstaller
3672432Sru *     compiler.jvmci.common.JVMCIHelpers$EmptyHotspotCompiler
3731695Smsmith *     compiler.jvmci.common.JVMCIHelpers$EmptyCompilerFactory
3895124Scharnier *     compiler.jvmci.events.JvmciShutdownEventListener
3995124Scharnier * @run driver
4095124Scharnier *     compiler.jvmci.events.JvmciShutdownEventTest
4132272Scharnier */
42131491Sru
43131491Srupackage compiler.jvmci.events;
4431695Smsmith
4531695Smsmithimport jdk.test.lib.ExitCode;
4631695Smsmithimport jdk.test.lib.cli.CommandLineOptionTest;
4731695Smsmith
4879755Sddpublic class JvmciShutdownEventTest {
4931695Smsmith    private final static String[] MESSAGE = new String[]{
5031695Smsmith        JvmciShutdownEventListener.MESSAGE
51235802Sdelphij    };
5231695Smsmith
5331695Smsmith    private final static String[] ERROR_MESSAGE = new String[]{
5431695Smsmith        JvmciShutdownEventListener.GOT_INTERNAL_ERROR
5579755Sdd    };
56131491Sru
57131491Sru    public static void main(String args[]) throws Throwable {
5831695Smsmith        boolean addTestVMOptions = true;
59131491Sru        CommandLineOptionTest.verifyJVMStartup(MESSAGE, ERROR_MESSAGE,
60131491Sru                "Unexpected exit code with +EnableJVMCI",
6131695Smsmith                "Unexpected output with +EnableJVMCI", ExitCode.OK,
6231695Smsmith                addTestVMOptions, "-XX:+UnlockExperimentalVMOptions",
6331695Smsmith                "-XX:+EnableJVMCI", "-Xbootclasspath/a:.",
6431695Smsmith                JvmciShutdownEventListener.class.getName()
6531695Smsmith        );
6631695Smsmith
6731695Smsmith        CommandLineOptionTest.verifyJVMStartup(ERROR_MESSAGE, MESSAGE,
6879755Sdd                "Unexpected exit code with -EnableJVMCI",
6931695Smsmith                "Unexpected output with -EnableJVMCI", ExitCode.OK,
70104418Sjohan                addTestVMOptions, "-XX:+UnlockExperimentalVMOptions",
71104418Sjohan                "-XX:-EnableJVMCI", "-Xbootclasspath/a:.",
72104418Sjohan                JvmciShutdownEventListener.class.getName()
73107276Sru        );
74104418Sjohan    }
75104418Sjohan}
76104418Sjohan