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

test/runtime/logging/ExceptionsTest.java

Print this page

        

*** 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 --- 22,32 ---- */ /* * @test * @bug 8141211 ! * @summary exceptions=info output should have an exception message for interpreter methods * @library /testlibrary * @modules java.base/sun.misc * java.management * @build jdk.test.lib.OutputAnalyzer jdk.test.lib.ProcessTools * @run driver ExceptionsTest
*** 38,98 **** 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", "-Xcomp", ! "-XX:CompileCommand=compileonly,ExceptionsTest$InternalClass::compileMe", InternalClass.class.getName()); analyzeOutputOn(pb); ! pb = ProcessTools.createJavaProcessBuilder( ! "-XX:+TraceExceptions", "-Xcomp", ! "-XX:CompileCommand=compileonly,ExceptionsTest$InternalClass::compileMe", InternalClass.class.getName()); analyzeOutputOn(pb); ! pb = ProcessTools.createJavaProcessBuilder( ! "-Xlog:exceptions=off", "-Xcomp", ! "-XX:CompileCommand=compileonly,ExceptionsTest$InternalClass::compileMe", InternalClass.class.getName()); analyzeOutputOff(pb); ! pb = ProcessTools.createJavaProcessBuilder( ! "-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(); } } } --- 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.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", InternalClass.class.getName()); analyzeOutputOn(pb); ! pb = ProcessTools.createJavaProcessBuilder("-XX:+TraceExceptions", InternalClass.class.getName()); analyzeOutputOn(pb); ! pb = ProcessTools.createJavaProcessBuilder("-Xlog:exceptions=off", InternalClass.class.getName()); analyzeOutputOff(pb); ! pb = ProcessTools.createJavaProcessBuilder("-XX:-TraceExceptions", InternalClass.class.getName()); analyzeOutputOff(pb); } public static class InternalClass { 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."); } } } }
test/runtime/logging/ExceptionsTest.java
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File