49 /**
50 * Runs a test in a separate JVM.
51 * command line like:
52 * {test_jdk}/bin/java {defaultopts} -cp {test.class.path} {testopts} main
53 *
54 * {defaultopts} are the default java options set by the framework.
55 * Default GC options in {defaultopts} may be removed.
56 * This is used when the test specifies its own GC options.
57 *
58 * @param main Name of the main class.
59 * @param clearGcOpts true if the default GC options should be removed.
60 * @param testOpts java options specified by the test.
61 */
62 private static void runTest(String main, boolean clearGcOpts, String... testOpts)
63 throws Throwable {
64 List<String> opts = new ArrayList<>();
65 opts.add(JDKToolFinder.getJDKTool("java"));
66 opts.addAll(Arrays.asList(Utils.getTestJavaOpts()));
67 opts.add("-cp");
68 opts.add(System.getProperty("test.class.path", "test.class.path"));
69 opts.add("-XX:+PrintGCDetails");
70
71 if (clearGcOpts) {
72 opts = Utils.removeGcOpts(opts);
73 }
74 opts.addAll(Arrays.asList(testOpts));
75 opts.add(main);
76
77 OutputAnalyzer output = ProcessTools.executeProcess(opts.toArray(new String[0]));
78 output.shouldHaveExitValue(0);
79 if (output.getStdout().indexOf(successMessage) < 0) {
80 throw new Exception("output missing '" + successMessage + "'");
81 }
82 }
83
84 }
|
49 /**
50 * Runs a test in a separate JVM.
51 * command line like:
52 * {test_jdk}/bin/java {defaultopts} -cp {test.class.path} {testopts} main
53 *
54 * {defaultopts} are the default java options set by the framework.
55 * Default GC options in {defaultopts} may be removed.
56 * This is used when the test specifies its own GC options.
57 *
58 * @param main Name of the main class.
59 * @param clearGcOpts true if the default GC options should be removed.
60 * @param testOpts java options specified by the test.
61 */
62 private static void runTest(String main, boolean clearGcOpts, String... testOpts)
63 throws Throwable {
64 List<String> opts = new ArrayList<>();
65 opts.add(JDKToolFinder.getJDKTool("java"));
66 opts.addAll(Arrays.asList(Utils.getTestJavaOpts()));
67 opts.add("-cp");
68 opts.add(System.getProperty("test.class.path", "test.class.path"));
69 opts.add("-Xlog:gc*=debug");
70
71 if (clearGcOpts) {
72 opts = Utils.removeGcOpts(opts);
73 }
74 opts.addAll(Arrays.asList(testOpts));
75 opts.add(main);
76
77 OutputAnalyzer output = ProcessTools.executeProcess(opts.toArray(new String[0]));
78 output.shouldHaveExitValue(0);
79 if (output.getStdout().indexOf(successMessage) < 0) {
80 throw new Exception("output missing '" + successMessage + "'");
81 }
82 }
83
84 }
|