This commit is contained in:
Dmitry Dmitriev 2016-01-29 18:17:44 +00:00
commit 0aa333b8d0
2 changed files with 22 additions and 1 deletions

View File

@ -23,7 +23,7 @@
/* /*
* @test * @test
* @bug 8141211 * @bug 8141211 8147477
* @summary exceptions=info output should have an exception message for interpreter methods * @summary exceptions=info output should have an exception message for interpreter methods
* @library /testlibrary * @library /testlibrary
* @modules java.base/sun.misc * @modules java.base/sun.misc
@ -32,10 +32,17 @@
* @run driver ExceptionsTest * @run driver ExceptionsTest
*/ */
import java.io.File;
import java.util.Map;
import jdk.test.lib.OutputAnalyzer; import jdk.test.lib.OutputAnalyzer;
import jdk.test.lib.ProcessTools; import jdk.test.lib.ProcessTools;
public class ExceptionsTest { public class ExceptionsTest {
static void updateEnvironment(ProcessBuilder pb, String environmentVariable, String value) {
Map<String, String> env = pb.environment();
env.put(environmentVariable, value);
}
static void analyzeOutputOn(ProcessBuilder pb) throws Exception { static void analyzeOutputOn(ProcessBuilder pb) throws Exception {
OutputAnalyzer output = new OutputAnalyzer(pb.start()); OutputAnalyzer output = new OutputAnalyzer(pb.start());
output.shouldContain("<a 'java/lang/RuntimeException': Test exception 1 for logging>"); output.shouldContain("<a 'java/lang/RuntimeException': Test exception 1 for logging>");
@ -65,6 +72,19 @@ public class ExceptionsTest {
pb = ProcessTools.createJavaProcessBuilder("-XX:-TraceExceptions", pb = ProcessTools.createJavaProcessBuilder("-XX:-TraceExceptions",
InternalClass.class.getName()); InternalClass.class.getName());
analyzeOutputOff(pb); analyzeOutputOff(pb);
pb = ProcessTools.createJavaProcessBuilder(InternalClass.class.getName());
updateEnvironment(pb, "_JAVA_OPTIONS", "-XX:+TraceExceptions");
analyzeOutputOn(pb);
pb = ProcessTools.createJavaProcessBuilder(InternalClass.class.getName());
updateEnvironment(pb, "JAVA_TOOL_OPTIONS", "-Xlog:exceptions=info -XX:-TraceExceptions");
analyzeOutputOff(pb);
pb = ProcessTools.createJavaProcessBuilder("-XX:VMOptionsFile=" + System.getProperty("test.src", ".")
+ File.separator + "ExceptionsTest_options_file",
InternalClass.class.getName());
analyzeOutputOn(pb);
} }
public static class InternalClass { public static class InternalClass {

View File

@ -0,0 +1 @@
-XX:+TraceExceptions