8147477: com/sun/management/HotSpotDiagnosticMXBean/CheckOrigin.java is failing for the jdk9/hs snapshot control job
authorddmitriev
Fri, 29 Jan 2016 16:03:21 +0300
changeset 35894 e78da4fa1a26
parent 35884 ec439aaca107
child 35895 12c52417e0f0
8147477: com/sun/management/HotSpotDiagnosticMXBean/CheckOrigin.java is failing for the jdk9/hs snapshot control job Reviewed-by: gtriantafill, gziemski, dcubed, coleenp
hotspot/test/runtime/logging/ExceptionsTest.java
hotspot/test/runtime/logging/ExceptionsTest_options_file
--- a/hotspot/test/runtime/logging/ExceptionsTest.java	Fri Jan 29 05:32:12 2016 -0500
+++ b/hotspot/test/runtime/logging/ExceptionsTest.java	Fri Jan 29 16:03:21 2016 +0300
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 8141211
+ * @bug 8141211 8147477
  * @summary exceptions=info output should have an exception message for interpreter methods
  * @library /testlibrary
  * @modules java.base/sun.misc
@@ -32,10 +32,17 @@
  * @run driver ExceptionsTest
  */
 
+import java.io.File;
+import java.util.Map;
 import jdk.test.lib.OutputAnalyzer;
 import jdk.test.lib.ProcessTools;
 
 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 {
         OutputAnalyzer output = new OutputAnalyzer(pb.start());
         output.shouldContain("<a 'java/lang/RuntimeException': Test exception 1 for logging>");
@@ -65,6 +72,19 @@
         pb = ProcessTools.createJavaProcessBuilder("-XX:-TraceExceptions",
                                                    InternalClass.class.getName());
         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 {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/runtime/logging/ExceptionsTest_options_file	Fri Jan 29 16:03:21 2016 +0300
@@ -0,0 +1,1 @@
+-XX:+TraceExceptions