@Override
  protected void verifyWarnings() throws Throwable {
    String shouldPassMessage =
        String.format(
            "JVM startup should pass with" + "option '-XX:-%s' without any warnings", optionName);
    // Verify that option could be disabled without any warnings.
    CommandLineOptionTest.verifySameJVMStartup(
        null,
        new String[] {SHAOptionsBase.getWarningForUnsupportedCPU(optionName)},
        shouldPassMessage,
        shouldPassMessage,
        ExitCode.OK,
        SHAOptionsBase.UNLOCK_DIAGNOSTIC_VM_OPTIONS,
        CommandLineOptionTest.prepareBooleanFlag(optionName, false));

    shouldPassMessage =
        String.format(
            "If JVM is started with '-XX:-" + "%s' '-XX:+%s', output should contain warning.",
            SHAOptionsBase.USE_SHA_OPTION, optionName);

    // Verify that when the tested option is enabled, then
    // a warning will occur in VM output if UseSHA is disabled.
    if (!optionName.equals(SHAOptionsBase.USE_SHA_OPTION)) {
      CommandLineOptionTest.verifySameJVMStartup(
          new String[] {SHAOptionsBase.getWarningForUnsupportedCPU(optionName)},
          null,
          shouldPassMessage,
          shouldPassMessage,
          ExitCode.OK,
          SHAOptionsBase.UNLOCK_DIAGNOSTIC_VM_OPTIONS,
          CommandLineOptionTest.prepareBooleanFlag(SHAOptionsBase.USE_SHA_OPTION, false),
          CommandLineOptionTest.prepareBooleanFlag(optionName, true));
    }
  }
예제 #2
0
  private void verifyStartupWarning(String value, boolean useRTMLocking, boolean isWarningExpected)
      throws Throwable {
    String warnings[] = new String[] {warningMessage};
    List<String> options = new LinkedList<>();
    options.add(CommandLineOptionTest.prepareBooleanFlag("UseRTMLocking", useRTMLocking));

    if (isExperimental) {
      options.add(CommandLineOptionTest.UNLOCK_EXPERIMENTAL_VM_OPTIONS);
    }
    options.add(prepareOptionValue(value));

    String errorString =
        String.format(
            "JVM should start with option '%s'" + "'%nWarnings should be shown: %s",
            optionName, isWarningExpected);
    CommandLineOptionTest.verifySameJVMStartup(
        (isWarningExpected ? warnings : null),
        (isWarningExpected ? null : warnings),
        errorString,
        errorString,
        ExitCode.OK,
        options.toArray(new String[options.size()]));
  }