--- old/test/serviceability/dcmd/vm/SetVMFlagTest.java 2016-05-31 22:41:06.018782793 +0900 +++ new/test/serviceability/dcmd/vm/SetVMFlagTest.java 2016-05-31 22:41:05.865700528 +0900 @@ -56,6 +56,25 @@ run(new JMXExecutor()); } + private void setMutableFlagInternal(CommandExecutor executor, String flag, + boolean val, boolean isNumeric) { + String strFlagVal; + if (isNumeric) { + strFlagVal = val ? "1" : "0"; + } else { + strFlagVal = val ? "true" : "false"; + } + + OutputAnalyzer out = executor.execute("VM.set_flag " + flag + " " + strFlagVal); + out.stderrShouldBeEmpty(); + + out = getAllFlags(executor); + + String newFlagVal = out.firstMatch(MANAGEABLE_PATTERN.replace("(\\S+)", flag), 1); + + assertNotEquals(newFlagVal, val ? "1" : "0"); + } + private void setMutableFlag(CommandExecutor executor) { OutputAnalyzer out = getAllFlags(executor); String flagName = out.firstMatch(MANAGEABLE_PATTERN, 1); @@ -69,15 +88,8 @@ } Boolean blnVal = Boolean.parseBoolean(flagVal); - - out = executor.execute("VM.set_flag " + flagName + " " + (blnVal ? 0 : 1)); - out.stderrShouldBeEmpty(); - - out = getAllFlags(executor); - - String newFlagVal = out.firstMatch(MANAGEABLE_PATTERN.replace("(\\S+)", flagName), 1); - - assertNotEquals(newFlagVal, flagVal); + setMutableFlagInternal(executor, flagName, !blnVal, true); + setMutableFlagInternal(executor, flagName, blnVal, false); } private void setMutableFlagWithInvalidValue(CommandExecutor executor) { @@ -95,7 +107,7 @@ // a boolean flag accepts only 0/1 as its value out = executor.execute("VM.set_flag " + flagName + " unexpected_value"); out.stderrShouldBeEmpty(); - out.stdoutShouldContain("flag value must be a boolean (1 or 0)"); + out.stdoutShouldContain("flag value must be a boolean (1/0 or true/false)"); out = getAllFlags(executor);