8142874: [TESTBUG] OptionsValidation testing framework needs to handle VM error codes in some cases
Reviewed-by: gtriantafill, stsmirno, ctornqvi, gziemski
This commit is contained in:
parent
e4f68b772b
commit
2c980f2f84
@ -63,12 +63,26 @@ public class TestOptionsWithRanges {
|
||||
allOptionsAsMap.remove(optionName);
|
||||
}
|
||||
|
||||
private static void setAllowedExitCodes(String optionName, Integer... allowedExitCodes) {
|
||||
JVMOption option = allOptionsAsMap.get(optionName);
|
||||
|
||||
if (option != null) {
|
||||
option.setAllowedExitCodes(allowedExitCodes);
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
int failedTests;
|
||||
List<JVMOption> allOptions;
|
||||
|
||||
allOptionsAsMap = JVMOptionsUtils.getOptionsWithRangeAsMap();
|
||||
|
||||
/* Shared flags can cause JVM to exit with error code 2 */
|
||||
setAllowedExitCodes("SharedReadWriteSize", 2);
|
||||
setAllowedExitCodes("SharedReadOnlySize", 2);
|
||||
setAllowedExitCodes("SharedMiscDataSize", 2);
|
||||
setAllowedExitCodes("SharedMiscCodeSize", 2);
|
||||
|
||||
/*
|
||||
* Remove CICompilerCount from testing because currently it can hang system
|
||||
*/
|
||||
@ -82,23 +96,13 @@ public class TestOptionsWithRanges {
|
||||
excludeTestRange("ThreadStackSize");
|
||||
|
||||
/*
|
||||
* JDK-8141650
|
||||
* Temporarily exclude SharedMiscDataSize as it will exit the VM with exit code 2 and
|
||||
* "The shared miscellaneous data space is not large enough to preload requested classes."
|
||||
* message at min value.
|
||||
* JDK-8143958
|
||||
* Temporarily exclude testing of max range for Shared* flags
|
||||
*/
|
||||
excludeTestRange("SharedMiscDataSize");
|
||||
|
||||
/*
|
||||
* JDK-8142874
|
||||
* Temporarily exclude Shared* flagse as they will exit the VM with exit code 2 and
|
||||
* "The shared miscellaneous data space is not large enough to preload requested classes."
|
||||
* message at max values.
|
||||
*/
|
||||
excludeTestRange("SharedReadWriteSize");
|
||||
excludeTestRange("SharedReadOnlySize");
|
||||
excludeTestRange("SharedMiscDataSize");
|
||||
excludeTestRange("SharedMiscCodeSize");
|
||||
excludeTestMaxRange("SharedReadWriteSize");
|
||||
excludeTestMaxRange("SharedReadOnlySize");
|
||||
excludeTestMaxRange("SharedMiscDataSize");
|
||||
excludeTestMaxRange("SharedMiscCodeSize");
|
||||
|
||||
/*
|
||||
* Remove the flag controlling the size of the stack because the
|
||||
|
@ -25,7 +25,10 @@ package optionsvalidation;
|
||||
import com.sun.tools.attach.VirtualMachine;
|
||||
import com.sun.tools.attach.AttachOperationFailedException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import jdk.test.lib.DynamicVMOption;
|
||||
import jdk.test.lib.OutputAnalyzer;
|
||||
import jdk.test.lib.ProcessTools;
|
||||
@ -64,6 +67,8 @@ public abstract class JVMOption {
|
||||
*/
|
||||
protected boolean testMaxRange;
|
||||
|
||||
private Set<Integer> allowedExitCodes;
|
||||
|
||||
/**
|
||||
* Prepend string which added before testing option to the command line
|
||||
*/
|
||||
@ -73,6 +78,9 @@ public abstract class JVMOption {
|
||||
protected JVMOption() {
|
||||
this.prepend = new ArrayList<>();
|
||||
prependString = new StringBuilder();
|
||||
allowedExitCodes = new HashSet<>();
|
||||
allowedExitCodes.add(0);
|
||||
allowedExitCodes.add(1);
|
||||
withRange = false;
|
||||
testMinRange = true;
|
||||
testMaxRange = true;
|
||||
@ -161,6 +169,10 @@ public abstract class JVMOption {
|
||||
testMaxRange = false;
|
||||
}
|
||||
|
||||
public final void setAllowedExitCodes(Integer... allowedExitCodes) {
|
||||
this.allowedExitCodes.addAll(Arrays.asList(allowedExitCodes));
|
||||
}
|
||||
|
||||
/**
|
||||
* Set new minimum option value
|
||||
*
|
||||
@ -384,13 +396,13 @@ public abstract class JVMOption {
|
||||
printOutputContent(out);
|
||||
result = false;
|
||||
} else if (valid == true) {
|
||||
if ((exitCode != 0) && (exitCode != 1)) {
|
||||
if (!allowedExitCodes.contains(exitCode)) {
|
||||
failedMessage(name, fullOptionString, valid, "JVM exited with unexpected error code = " + exitCode);
|
||||
printOutputContent(out);
|
||||
result = false;
|
||||
} else if ((exitCode == 1) && (out.getOutput().isEmpty() == true)) {
|
||||
failedMessage(name, fullOptionString, valid, "JVM exited with error(exitcode == 1)"
|
||||
+ ", but with empty stdout and stderr. Description of error is needed!");
|
||||
} else if ((exitCode != 0) && (out.getOutput().isEmpty() == true)) {
|
||||
failedMessage(name, fullOptionString, valid, "JVM exited with error(exitcode == " + exitCode +
|
||||
"), but with empty stdout and stderr. Description of error is needed!");
|
||||
result = false;
|
||||
} else if (out.getOutput().contains("is outside the allowed range")) {
|
||||
failedMessage(name, fullOptionString, valid, "JVM output contains \"is outside the allowed range\"");
|
||||
|
@ -161,13 +161,6 @@ public class JVMOptionsUtils {
|
||||
option.addPrepend("-XX:+UseConcMarkSweepGC");
|
||||
}
|
||||
|
||||
if (name.startsWith("Shared")) {
|
||||
option.addPrepend("-XX:+UnlockDiagnosticVMOptions");
|
||||
String fileName = "Test" + name + ".jsa";
|
||||
option.addPrepend("-XX:SharedArchiveFile=" + fileName);
|
||||
option.addPrepend("-Xshare:dump");
|
||||
}
|
||||
|
||||
if (name.startsWith("NUMA")) {
|
||||
option.addPrepend("-XX:+UseNUMA");
|
||||
}
|
||||
@ -213,6 +206,16 @@ public class JVMOptionsUtils {
|
||||
case "NewSizeThreadIncrease":
|
||||
option.addPrepend("-XX:+UseSerialGC");
|
||||
break;
|
||||
case "SharedReadWriteSize":
|
||||
case "SharedReadOnlySize":
|
||||
case "SharedMiscDataSize":
|
||||
case "SharedMiscCodeSize":
|
||||
case "SharedBaseAddress":
|
||||
case "SharedSymbolTableBucketSize":
|
||||
option.addPrepend("-XX:+UnlockDiagnosticVMOptions");
|
||||
option.addPrepend("-XX:SharedArchiveFile=TestOptionsWithRanges.jsa");
|
||||
option.addPrepend("-Xshare:dump");
|
||||
break;
|
||||
default:
|
||||
/* Do nothing */
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user