--- old/test/java/lang/management/MemoryMXBean/RunUtil.java 2014-12-17 19:31:30.019244420 +0400 +++ new/test/java/lang/management/MemoryMXBean/RunUtil.java 2014-12-17 19:31:29.851244427 +0400 @@ -37,15 +37,24 @@ // 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: @@ -56,14 +65,15 @@ * 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 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"); @@ -79,6 +89,5 @@ if (output.getStdout().indexOf(successMessage) < 0) { throw new Exception("output missing '" + successMessage + "'"); } - } - + } }