< prev index next >
test/java/lang/management/MemoryMXBean/RunUtil.java
Print this page
@@ -35,17 +35,26 @@
public class RunUtil {
// Used to mark that the test has passed successfully.
public static final String successMessage = "Test passed.";
+ private static final String[] EMPTY_FILTER = new String[0];
public static void runTestClearGcOpts(String main, String... testOpts) throws Throwable {
- runTest(main, true, testOpts);
+ runTest(main, EMPTY_FILTER, true, testOpts);
}
public static void runTestKeepGcOpts(String main, String... testOpts) throws Throwable {
- runTest(main, false, testOpts);
+ runTest(main, EMPTY_FILTER, false, testOpts);
+ }
+
+ public static void runTestClearGcOpts(String[] filters, String main, String... testOpts) throws Throwable {
+ runTest(main, filters, true, testOpts);
+ }
+
+ public static void runTestKeepGcOpts(String[] filters, String main, String... testOpts) throws Throwable {
+ runTest(main, filters, false, testOpts);
}
/**
* Runs a test in a separate JVM.
* command line like:
@@ -54,18 +63,19 @@
* {defaultopts} are the default java options set by the framework.
* Default GC options in {defaultopts} may be removed.
* This is used when the test specifies its own GC options.
*
* @param main Name of the main class.
+ * @param filters java options to filter out
* @param clearGcOpts true if the default GC options should be removed.
* @param testOpts java options specified by the test.
*/
- private static void runTest(String main, boolean clearGcOpts, String... testOpts)
+ private static void runTest(String main, String[] filters, boolean clearGcOpts, String... testOpts)
throws Throwable {
List<String> opts = new ArrayList<>();
opts.add(JDKToolFinder.getJDKTool("java"));
- opts.addAll(Arrays.asList(Utils.getTestJavaOpts()));
+ opts.addAll(Arrays.asList(Utils.getFilteredTestJavaOpts(filters)));
opts.add("-cp");
opts.add(System.getProperty("test.class.path", "test.class.path"));
opts.add("-XX:+PrintGCDetails");
if (clearGcOpts) {
@@ -78,7 +88,6 @@
output.shouldHaveExitValue(0);
if (output.getStdout().indexOf(successMessage) < 0) {
throw new Exception("output missing '" + successMessage + "'");
}
}
-
}
< prev index next >