private void test() { for (TestCaseData testCase : TestCaseData.values()) { System.out.println(testCase); OutputAnalyzer oa; try { oa = ProcessTools.executeTestJvmAllArgs( "-XX:+UnlockExperimentalVMOptions", "-XX:+EnableJVMCI", "-Xbootclasspath/a:.", DebugOutputTest.Worker.class.getName(), testCase.name()); } catch (Throwable e) { e.printStackTrace(); throw new Error("Problems running child process", e); } if (testCase.expectedException != null) { oa.shouldHaveExitValue(1); oa.shouldContain(testCase.expectedException.getName()); } else { oa.shouldHaveExitValue(0); oa.shouldContain(new String(testCase.getExpected())); } } }
private static void verifyCodeHeapNotExists(ProcessBuilder pb, String... heapNames) throws Exception { OutputAnalyzer out = new OutputAnalyzer(pb.start()); out.shouldHaveExitValue(0); for (String name : heapNames) { out.shouldNotContain(name); } }
private static void verifySegmentedCodeCache(ProcessBuilder pb, boolean enabled) throws Exception { OutputAnalyzer out = new OutputAnalyzer(pb.start()); out.shouldHaveExitValue(0); if (enabled) { try { // Non-nmethod code heap should be always available with the segmented code cache out.shouldContain(NON_METHOD); } catch (RuntimeException e) { // Check if TieredCompilation is disabled (in a client VM) if (!out.getOutput().contains("-XX:+TieredCompilation not supported in this VM")) { // Code cache is not segmented throw new RuntimeException("No code cache segmentation."); } } } else { out.shouldNotContain(NON_METHOD); } }
private static void verifyDynamicNumberOfGCThreads(OutputAnalyzer output) { output.shouldHaveExitValue(0); // test should run succesfully output.shouldContain("new_active_workers"); }
private static void failsWith(ProcessBuilder pb, String message) throws Exception { OutputAnalyzer out = new OutputAnalyzer(pb.start()); out.shouldContain(message); out.shouldHaveExitValue(1); }