test/hotspot/jtreg/compiler/aot/cli/SingleAOTOptionTest.java
changeset 57681 41f2f2829a09
parent 47216 71c04702a3d5
equal deleted inserted replaced
57680:cafd691c6c04 57681:41f2f2829a09
     1 /*
     1 /*
     2  * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.
     7  * published by the Free Software Foundation.
    31  * @run driver compiler.aot.AotCompiler -libname libSingleAOTOptionTest.so
    31  * @run driver compiler.aot.AotCompiler -libname libSingleAOTOptionTest.so
    32  *      -class compiler.aot.HelloWorldPrinter
    32  *      -class compiler.aot.HelloWorldPrinter
    33  *      -compile compiler.aot.HelloWorldPrinter.print()V
    33  *      -compile compiler.aot.HelloWorldPrinter.print()V
    34  *      -extraopt -XX:+UseCompressedOops
    34  *      -extraopt -XX:+UseCompressedOops
    35  * @run driver compiler.aot.cli.SingleAOTOptionTest -XX:+UseCompressedOops
    35  * @run driver compiler.aot.cli.SingleAOTOptionTest -XX:+UseCompressedOops
    36  *      -XX:AOTLibrary=./libSingleAOTOptionTest.so
    36  *      -XX:+UnlockExperimentalVMOptions -XX:AOTLibrary=./libSingleAOTOptionTest.so
    37  * @run main compiler.aot.cli.SingleAOTOptionTest
    37  * @run main compiler.aot.cli.SingleAOTOptionTest
    38  *      -XX:+UseCompressedOops -XX:+UseAOT
    38  *      -XX:+UseCompressedOops -XX:+UnlockExperimentalVMOptions -XX:+UseAOT
    39  * @run driver compiler.aot.AotCompiler -libname libSingleAOTOptionTest.so
    39  * @run driver compiler.aot.AotCompiler -libname libSingleAOTOptionTest.so
    40  *      -class compiler.aot.HelloWorldPrinter
    40  *      -class compiler.aot.HelloWorldPrinter
    41  *      -compile compiler.aot.HelloWorldPrinter.print()V
    41  *      -compile compiler.aot.HelloWorldPrinter.print()V
    42  *      -extraopt -XX:-UseCompressedOops
    42  *      -extraopt -XX:-UseCompressedOops
    43  * @run driver compiler.aot.cli.SingleAOTOptionTest -XX:-UseCompressedOops
    43  * @run driver compiler.aot.cli.SingleAOTOptionTest -XX:-UseCompressedOops
    44  *      -XX:AOTLibrary=./libSingleAOTOptionTest.so
    44  *      -XX:+UnlockExperimentalVMOptions -XX:AOTLibrary=./libSingleAOTOptionTest.so
    45  * @run driver compiler.aot.cli.SingleAOTOptionTest
    45  * @run driver compiler.aot.cli.SingleAOTOptionTest
    46  *      -XX:-UseCompressedOops -XX:+UseAOT
    46  *      -XX:-UseCompressedOops -XX:+UnlockExperimentalVMOptions -XX:+UseAOT
    47  * @summary check if specifying only one aot option handled properly
    47  * @summary check if specifying only one aot option handled properly
    48  */
    48  */
    49 
    49 
    50 package compiler.aot.cli;
    50 package compiler.aot.cli;
    51 
    51 
    58         HelloWorldPrinter.MESSAGE
    58         HelloWorldPrinter.MESSAGE
    59     };
    59     };
    60     private static final String[] UNEXPECTED_MESSAGES = null;
    60     private static final String[] UNEXPECTED_MESSAGES = null;
    61 
    61 
    62     public static void main(String args[]) {
    62     public static void main(String args[]) {
    63         if (args.length == 2) {
    63         if (args.length == 3) {
    64             new SingleAOTOptionTest().runTest(args[0], args[1]);
    64             new SingleAOTOptionTest().runTest(args[0], args[1], args[2]);
    65         } else {
    65         } else {
    66             throw new Error("Test expects 2 parameters");
    66             throw new Error("Test expects 2 parameters");
    67         }
    67         }
    68     }
    68     }
    69 
    69 
    70     private void runTest(String arg1, String arg2) {
    70     private void runTest(String arg1, String arg2, String arg3) {
    71         try {
    71         try {
    72             String exitCodeErrorMessage = String.format("Unexpected exit code "
    72             String exitCodeErrorMessage = String.format("Unexpected exit code "
    73                     + "using %s and %s", arg1, arg2);
    73                     + "using %s %s %s", arg1, arg2, arg3);
    74             String outputErrorMessage = String.format("Unexpected output using"
    74             String outputErrorMessage = String.format("Unexpected output using"
    75                     + " %s and %s", arg1, arg2);
    75                     + " %s %s", arg1, arg2, arg3);
    76             boolean addTestVMOptions = true;
    76             boolean addTestVMOptions = true;
    77             CommandLineOptionTest.verifyJVMStartup(EXPECTED_MESSAGES,
    77             CommandLineOptionTest.verifyJVMStartup(EXPECTED_MESSAGES,
    78                     UNEXPECTED_MESSAGES, exitCodeErrorMessage,
    78                     UNEXPECTED_MESSAGES, exitCodeErrorMessage,
    79                     outputErrorMessage, ExitCode.OK, addTestVMOptions, arg1,
    79                     outputErrorMessage, ExitCode.OK, addTestVMOptions, arg1,
    80                     arg2, HelloWorldPrinter.class.getName());
    80                     arg2, arg3, HelloWorldPrinter.class.getName());
    81         } catch (Throwable t) {
    81         } catch (Throwable t) {
    82             throw new Error("Problems executing test: " + t, t);
    82             throw new Error("Problems executing test: " + t, t);
    83         }
    83         }
    84     }
    84     }
    85 
    85