Java Code Examples for com.oracle.java.testlibrary.cli.CommandLineOptionTest#verifyJVMStartup()

The following examples show how to use com.oracle.java.testlibrary.cli.CommandLineOptionTest#verifyJVMStartup() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TestSurvivorAlignmentInBytesOption.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
public static void main(String args[]) throws Throwable {
    String optionName = "SurvivorAlignmentInBytes";
    String unlockExperimentalVMOpts = "UnlockExperimentalVMOptions";
    String optionIsExperimental
            = CommandLineOptionTest.getExperimentalOptionErrorMessage(
            optionName);
    String valueIsTooSmall= ".*SurvivorAlignmentInBytes=.*must be greater"
            + " than ObjectAlignmentInBytes.*";
    String mustBePowerOf2 = ".*SurvivorAlignmentInBytes=.*must be "
            + "power of 2.*";

    // Verify that without -XX:+UnlockExperimentalVMOptions usage of
    // SurvivorAlignmentInBytes option will cause JVM startup failure
    // with the warning message saying that that option is experimental.
    CommandLineOptionTest.verifyJVMStartup(
            new String[]{optionIsExperimental}, null, ExitCode.FAIL, false,
            "-XX:-UnlockExperimentalVMOptions",
            CommandLineOptionTest.prepareBooleanFlag(
                    unlockExperimentalVMOpts, false),
            CommandLineOptionTest.prepareNumericFlag(optionName, 64));

    // Verify that with -XX:+UnlockExperimentalVMOptions passed to JVM
    // usage of SurvivorAlignmentInBytes option won't cause JVM startup
    // failure.
    CommandLineOptionTest.verifyJVMStartup(
            null, new String[]{optionIsExperimental}, ExitCode.OK, false,
            CommandLineOptionTest.prepareBooleanFlag(
                    unlockExperimentalVMOpts, true),
            CommandLineOptionTest.prepareNumericFlag(optionName, 64));

    // Verify that if specified SurvivorAlignmentInBytes is lower then
    // ObjectAlignmentInBytes, then the JVM startup will fail with
    // appropriate error message.
    CommandLineOptionTest.verifyJVMStartup(
            new String[]{valueIsTooSmall}, null, ExitCode.FAIL, false,
            CommandLineOptionTest.prepareBooleanFlag(
                    unlockExperimentalVMOpts, true),
            CommandLineOptionTest.prepareNumericFlag(optionName, 2));

    // Verify that if specified SurvivorAlignmentInBytes value is not
    // a power of 2 then the JVM startup will fail with appropriate error
    // message.
    CommandLineOptionTest.verifyJVMStartup(
            new String[]{mustBePowerOf2}, null, ExitCode.FAIL, false,
            CommandLineOptionTest.prepareBooleanFlag(
                    unlockExperimentalVMOpts, true),
            CommandLineOptionTest.prepareNumericFlag(optionName, 127));

    // Verify that if SurvivorAlignmentInBytes has correct value, then
    // the JVM will be started without errors.
    CommandLineOptionTest.verifyJVMStartup(
            null, new String[]{".*SurvivorAlignmentInBytes.*"},
            ExitCode.OK, false,
            CommandLineOptionTest.prepareBooleanFlag(
                    unlockExperimentalVMOpts, true),
            CommandLineOptionTest.prepareNumericFlag(optionName, 128));

    // Verify that we can setup different SurvivorAlignmentInBytes values.
    for (int alignment = 32; alignment <= 128; alignment *= 2) {
        CommandLineOptionTest.verifyOptionValue(optionName,
                Integer.toString(alignment),
                CommandLineOptionTest.prepareBooleanFlag(
                        unlockExperimentalVMOpts, true),
                CommandLineOptionTest.prepareNumericFlag(
                        optionName, alignment));
    }
}
 
Example 2
Source File: TestSurvivorAlignmentInBytesOption.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
public static void main(String args[]) throws Throwable {
    String optionName = "SurvivorAlignmentInBytes";
    String unlockExperimentalVMOpts = "UnlockExperimentalVMOptions";
    String optionIsExperimental
            = CommandLineOptionTest.getExperimentalOptionErrorMessage(
            optionName);
    String valueIsTooSmall= ".*SurvivorAlignmentInBytes=.*must be greater"
            + " than ObjectAlignmentInBytes.*";
    String mustBePowerOf2 = ".*SurvivorAlignmentInBytes=.*must be "
            + "power of 2.*";

    // Verify that without -XX:+UnlockExperimentalVMOptions usage of
    // SurvivorAlignmentInBytes option will cause JVM startup failure
    // with the warning message saying that that option is experimental.
    CommandLineOptionTest.verifyJVMStartup(
            new String[]{optionIsExperimental}, null, ExitCode.FAIL, false,
            "-XX:-UnlockExperimentalVMOptions",
            CommandLineOptionTest.prepareBooleanFlag(
                    unlockExperimentalVMOpts, false),
            CommandLineOptionTest.prepareNumericFlag(optionName, 64));

    // Verify that with -XX:+UnlockExperimentalVMOptions passed to JVM
    // usage of SurvivorAlignmentInBytes option won't cause JVM startup
    // failure.
    CommandLineOptionTest.verifyJVMStartup(
            null, new String[]{optionIsExperimental}, ExitCode.OK, false,
            CommandLineOptionTest.prepareBooleanFlag(
                    unlockExperimentalVMOpts, true),
            CommandLineOptionTest.prepareNumericFlag(optionName, 64));

    // Verify that if specified SurvivorAlignmentInBytes is lower then
    // ObjectAlignmentInBytes, then the JVM startup will fail with
    // appropriate error message.
    CommandLineOptionTest.verifyJVMStartup(
            new String[]{valueIsTooSmall}, null, ExitCode.FAIL, false,
            CommandLineOptionTest.prepareBooleanFlag(
                    unlockExperimentalVMOpts, true),
            CommandLineOptionTest.prepareNumericFlag(optionName, 2));

    // Verify that if specified SurvivorAlignmentInBytes value is not
    // a power of 2 then the JVM startup will fail with appropriate error
    // message.
    CommandLineOptionTest.verifyJVMStartup(
            new String[]{mustBePowerOf2}, null, ExitCode.FAIL, false,
            CommandLineOptionTest.prepareBooleanFlag(
                    unlockExperimentalVMOpts, true),
            CommandLineOptionTest.prepareNumericFlag(optionName, 127));

    // Verify that if SurvivorAlignmentInBytes has correct value, then
    // the JVM will be started without errors.
    CommandLineOptionTest.verifyJVMStartup(
            null, new String[]{".*SurvivorAlignmentInBytes.*"},
            ExitCode.OK, false,
            CommandLineOptionTest.prepareBooleanFlag(
                    unlockExperimentalVMOpts, true),
            CommandLineOptionTest.prepareNumericFlag(optionName, 128));

    // Verify that we can setup different SurvivorAlignmentInBytes values.
    for (int alignment = 32; alignment <= 128; alignment *= 2) {
        CommandLineOptionTest.verifyOptionValue(optionName,
                Integer.toString(alignment),
                CommandLineOptionTest.prepareBooleanFlag(
                        unlockExperimentalVMOpts, true),
                CommandLineOptionTest.prepareNumericFlag(
                        optionName, alignment));
    }
}
 
Example 3
Source File: TestSurvivorAlignmentInBytesOption.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
public static void main(String args[]) throws Throwable {
    String optionName = "SurvivorAlignmentInBytes";
    String unlockExperimentalVMOpts = "UnlockExperimentalVMOptions";
    String optionIsExperimental
            = CommandLineOptionTest.getExperimentalOptionErrorMessage(
            optionName);
    String valueIsTooSmall= ".*SurvivorAlignmentInBytes=.*must be greater"
            + " than ObjectAlignmentInBytes.*";
    String mustBePowerOf2 = ".*SurvivorAlignmentInBytes=.*must be "
            + "power of 2.*";

    // Verify that without -XX:+UnlockExperimentalVMOptions usage of
    // SurvivorAlignmentInBytes option will cause JVM startup failure
    // with the warning message saying that that option is experimental.
    CommandLineOptionTest.verifyJVMStartup(
            new String[]{optionIsExperimental}, null, ExitCode.FAIL, false,
            "-XX:-UnlockExperimentalVMOptions",
            CommandLineOptionTest.prepareBooleanFlag(
                    unlockExperimentalVMOpts, false),
            CommandLineOptionTest.prepareNumericFlag(optionName, 64));

    // Verify that with -XX:+UnlockExperimentalVMOptions passed to JVM
    // usage of SurvivorAlignmentInBytes option won't cause JVM startup
    // failure.
    CommandLineOptionTest.verifyJVMStartup(
            null, new String[]{optionIsExperimental}, ExitCode.OK, false,
            CommandLineOptionTest.prepareBooleanFlag(
                    unlockExperimentalVMOpts, true),
            CommandLineOptionTest.prepareNumericFlag(optionName, 64));

    // Verify that if specified SurvivorAlignmentInBytes is lower then
    // ObjectAlignmentInBytes, then the JVM startup will fail with
    // appropriate error message.
    CommandLineOptionTest.verifyJVMStartup(
            new String[]{valueIsTooSmall}, null, ExitCode.FAIL, false,
            CommandLineOptionTest.prepareBooleanFlag(
                    unlockExperimentalVMOpts, true),
            CommandLineOptionTest.prepareNumericFlag(optionName, 2));

    // Verify that if specified SurvivorAlignmentInBytes value is not
    // a power of 2 then the JVM startup will fail with appropriate error
    // message.
    CommandLineOptionTest.verifyJVMStartup(
            new String[]{mustBePowerOf2}, null, ExitCode.FAIL, false,
            CommandLineOptionTest.prepareBooleanFlag(
                    unlockExperimentalVMOpts, true),
            CommandLineOptionTest.prepareNumericFlag(optionName, 127));

    // Verify that if SurvivorAlignmentInBytes has correct value, then
    // the JVM will be started without errors.
    CommandLineOptionTest.verifyJVMStartup(
            null, new String[]{".*SurvivorAlignmentInBytes.*"},
            ExitCode.OK, false,
            CommandLineOptionTest.prepareBooleanFlag(
                    unlockExperimentalVMOpts, true),
            CommandLineOptionTest.prepareNumericFlag(optionName, 128));

    // Verify that we can setup different SurvivorAlignmentInBytes values.
    for (int alignment = 32; alignment <= 128; alignment *= 2) {
        CommandLineOptionTest.verifyOptionValue(optionName,
                Integer.toString(alignment),
                CommandLineOptionTest.prepareBooleanFlag(
                        unlockExperimentalVMOpts, true),
                CommandLineOptionTest.prepareNumericFlag(
                        optionName, alignment));
    }
}
 
Example 4
Source File: TestSurvivorAlignmentInBytesOption.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
public static void main(String args[]) throws Throwable {
    String optionName = "SurvivorAlignmentInBytes";
    String unlockExperimentalVMOpts = "UnlockExperimentalVMOptions";
    String optionIsExperimental
            = CommandLineOptionTest.getExperimentalOptionErrorMessage(
            optionName);
    String valueIsTooSmall= ".*SurvivorAlignmentInBytes=.*must be greater"
            + " than ObjectAlignmentInBytes.*";
    String mustBePowerOf2 = ".*SurvivorAlignmentInBytes=.*must be "
            + "power of 2.*";

    // Verify that without -XX:+UnlockExperimentalVMOptions usage of
    // SurvivorAlignmentInBytes option will cause JVM startup failure
    // with the warning message saying that that option is experimental.
    CommandLineOptionTest.verifyJVMStartup(
            new String[]{optionIsExperimental}, null, ExitCode.FAIL, false,
            "-XX:-UnlockExperimentalVMOptions",
            CommandLineOptionTest.prepareBooleanFlag(
                    unlockExperimentalVMOpts, false),
            CommandLineOptionTest.prepareNumericFlag(optionName, 64));

    // Verify that with -XX:+UnlockExperimentalVMOptions passed to JVM
    // usage of SurvivorAlignmentInBytes option won't cause JVM startup
    // failure.
    CommandLineOptionTest.verifyJVMStartup(
            null, new String[]{optionIsExperimental}, ExitCode.OK, false,
            CommandLineOptionTest.prepareBooleanFlag(
                    unlockExperimentalVMOpts, true),
            CommandLineOptionTest.prepareNumericFlag(optionName, 64));

    // Verify that if specified SurvivorAlignmentInBytes is lower then
    // ObjectAlignmentInBytes, then the JVM startup will fail with
    // appropriate error message.
    CommandLineOptionTest.verifyJVMStartup(
            new String[]{valueIsTooSmall}, null, ExitCode.FAIL, false,
            CommandLineOptionTest.prepareBooleanFlag(
                    unlockExperimentalVMOpts, true),
            CommandLineOptionTest.prepareNumericFlag(optionName, 2));

    // Verify that if specified SurvivorAlignmentInBytes value is not
    // a power of 2 then the JVM startup will fail with appropriate error
    // message.
    CommandLineOptionTest.verifyJVMStartup(
            new String[]{mustBePowerOf2}, null, ExitCode.FAIL, false,
            CommandLineOptionTest.prepareBooleanFlag(
                    unlockExperimentalVMOpts, true),
            CommandLineOptionTest.prepareNumericFlag(optionName, 127));

    // Verify that if SurvivorAlignmentInBytes has correct value, then
    // the JVM will be started without errors.
    CommandLineOptionTest.verifyJVMStartup(
            null, new String[]{".*SurvivorAlignmentInBytes.*"},
            ExitCode.OK, false,
            CommandLineOptionTest.prepareBooleanFlag(
                    unlockExperimentalVMOpts, true),
            CommandLineOptionTest.prepareNumericFlag(optionName, 128));

    // Verify that we can setup different SurvivorAlignmentInBytes values.
    for (int alignment = 32; alignment <= 128; alignment *= 2) {
        CommandLineOptionTest.verifyOptionValue(optionName,
                Integer.toString(alignment),
                CommandLineOptionTest.prepareBooleanFlag(
                        unlockExperimentalVMOpts, true),
                CommandLineOptionTest.prepareNumericFlag(
                        optionName, alignment));
    }
}
 
Example 5
Source File: TestSurvivorAlignmentInBytesOption.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
public static void main(String args[]) throws Throwable {
    String optionName = "SurvivorAlignmentInBytes";
    String unlockExperimentalVMOpts = "UnlockExperimentalVMOptions";
    String optionIsExperimental
            = CommandLineOptionTest.getExperimentalOptionErrorMessage(
            optionName);
    String valueIsTooSmall= ".*SurvivorAlignmentInBytes=.*must be greater"
            + " than ObjectAlignmentInBytes.*";
    String mustBePowerOf2 = ".*SurvivorAlignmentInBytes=.*must be "
            + "power of 2.*";

    // Verify that without -XX:+UnlockExperimentalVMOptions usage of
    // SurvivorAlignmentInBytes option will cause JVM startup failure
    // with the warning message saying that that option is experimental.
    CommandLineOptionTest.verifyJVMStartup(
            new String[]{optionIsExperimental}, null, ExitCode.FAIL, false,
            "-XX:-UnlockExperimentalVMOptions",
            CommandLineOptionTest.prepareBooleanFlag(
                    unlockExperimentalVMOpts, false),
            CommandLineOptionTest.prepareNumericFlag(optionName, 64));

    // Verify that with -XX:+UnlockExperimentalVMOptions passed to JVM
    // usage of SurvivorAlignmentInBytes option won't cause JVM startup
    // failure.
    CommandLineOptionTest.verifyJVMStartup(
            null, new String[]{optionIsExperimental}, ExitCode.OK, false,
            CommandLineOptionTest.prepareBooleanFlag(
                    unlockExperimentalVMOpts, true),
            CommandLineOptionTest.prepareNumericFlag(optionName, 64));

    // Verify that if specified SurvivorAlignmentInBytes is lower then
    // ObjectAlignmentInBytes, then the JVM startup will fail with
    // appropriate error message.
    CommandLineOptionTest.verifyJVMStartup(
            new String[]{valueIsTooSmall}, null, ExitCode.FAIL, false,
            CommandLineOptionTest.prepareBooleanFlag(
                    unlockExperimentalVMOpts, true),
            CommandLineOptionTest.prepareNumericFlag(optionName, 2));

    // Verify that if specified SurvivorAlignmentInBytes value is not
    // a power of 2 then the JVM startup will fail with appropriate error
    // message.
    CommandLineOptionTest.verifyJVMStartup(
            new String[]{mustBePowerOf2}, null, ExitCode.FAIL, false,
            CommandLineOptionTest.prepareBooleanFlag(
                    unlockExperimentalVMOpts, true),
            CommandLineOptionTest.prepareNumericFlag(optionName, 127));

    // Verify that if SurvivorAlignmentInBytes has correct value, then
    // the JVM will be started without errors.
    CommandLineOptionTest.verifyJVMStartup(
            null, new String[]{".*SurvivorAlignmentInBytes.*"},
            ExitCode.OK, false,
            CommandLineOptionTest.prepareBooleanFlag(
                    unlockExperimentalVMOpts, true),
            CommandLineOptionTest.prepareNumericFlag(optionName, 128));

    // Verify that we can setup different SurvivorAlignmentInBytes values.
    for (int alignment = 32; alignment <= 128; alignment *= 2) {
        CommandLineOptionTest.verifyOptionValue(optionName,
                Integer.toString(alignment),
                CommandLineOptionTest.prepareBooleanFlag(
                        unlockExperimentalVMOpts, true),
                CommandLineOptionTest.prepareNumericFlag(
                        optionName, alignment));
    }
}