test/runtime/logging/ExceptionsTest.java
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File
*** old/test/runtime/logging/ExceptionsTest.java	Mon Jan 25 14:25:32 2016
--- new/test/runtime/logging/ExceptionsTest.java	Mon Jan 25 14:25:32 2016

*** 22,32 **** --- 22,32 ---- */ /* * @test * @bug 8141211 ! * @summary exceptions=info output should have an exception message for both interpreter and compiled methods * @library /testlibrary * @modules java.base/sun.misc * java.management * @build jdk.test.lib.OutputAnalyzer jdk.test.lib.ProcessTools * @run driver ExceptionsTest
*** 38,98 **** --- 38,79 ---- public class ExceptionsTest { static void analyzeOutputOn(ProcessBuilder pb) throws Exception { OutputAnalyzer output = new OutputAnalyzer(pb.start()); output.shouldContain("<a 'java/lang/RuntimeException': Test exception 1 for logging>"); output.shouldContain(" thrown in interpreter method "); output.shouldContain(" thrown in compiled method "); output.shouldContain("Exception 2 caught."); output.shouldHaveExitValue(0); } static void analyzeOutputOff(ProcessBuilder pb) throws Exception { OutputAnalyzer output = new OutputAnalyzer(pb.start()); output.shouldNotContain("[exceptions]"); output.shouldHaveExitValue(0); } public static void main(String[] args) throws Exception { ! ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-Xlog:exceptions=info", "-Xlog:exceptions=info", "-Xcomp", "-XX:CompileCommand=compileonly,ExceptionsTest$InternalClass::compileMe", InternalClass.class.getName()); analyzeOutputOn(pb); ! pb = ProcessTools.createJavaProcessBuilder("-XX:+TraceExceptions", "-XX:+TraceExceptions", "-Xcomp", "-XX:CompileCommand=compileonly,ExceptionsTest$InternalClass::compileMe", InternalClass.class.getName()); analyzeOutputOn(pb); ! pb = ProcessTools.createJavaProcessBuilder("-Xlog:exceptions=off", "-Xlog:exceptions=off", "-Xcomp", "-XX:CompileCommand=compileonly,ExceptionsTest$InternalClass::compileMe", InternalClass.class.getName()); analyzeOutputOff(pb); ! pb = ProcessTools.createJavaProcessBuilder("-XX:-TraceExceptions", "-XX:-TraceExceptions", "-Xcomp", "-XX:CompileCommand=compileonly,ExceptionsTest$InternalClass::compileMe", InternalClass.class.getName()); analyzeOutputOff(pb); } public static class InternalClass { public static void compileMe() throws Exception { try { throw new RuntimeException("Test exception 2 for logging"); } catch (Exception e) { System.out.println("Exception 2 caught."); } } public static void main(String[] args) throws Exception { try { throw new RuntimeException("Test exception 1 for logging"); } catch (Exception e) { System.out.println("Exception 1 caught."); } compileMe(); } } }

test/runtime/logging/ExceptionsTest.java
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File