7162111: TEST_BUG: change tests run in headless mode [macosx] (open)
authoruta
Mon, 26 Nov 2012 15:54:39 +0400
changeset 14666 d8517fe0118e
parent 14665 8caa5add16ed
child 14669 1e50c14c3e10
7162111: TEST_BUG: change tests run in headless mode [macosx] (open) Summary: In problem tests detection of AWT headless mode was introduced or AWT dependence was removed. Reviewed-by: alanb
jdk/test/ProblemList.txt
jdk/test/demo/jvmti/mtrace/TraceJFrame.java
jdk/test/java/io/Serializable/resolveClass/deserializeButton/Foo.java
jdk/test/java/io/Serializable/resolveClass/deserializeButton/Test.java
jdk/test/java/io/Serializable/resolveClass/deserializeButton/run.sh
--- a/jdk/test/ProblemList.txt	Sat Nov 24 04:27:28 2012 -0800
+++ b/jdk/test/ProblemList.txt	Mon Nov 26 15:54:39 2012 +0400
@@ -162,26 +162,6 @@
 # 6988950
 demo/jvmti/compiledMethodLoad/CompiledMethodLoadTest.java	generic-all
 
-# 7162111
-demo/jvmti/mtrace/TraceJFrame.java                              macosx-all
-javax/script/CauseExceptionTest.java                            macosx-all
-javax/script/GetInterfaceTest.java                              macosx-all
-javax/script/JavaScriptScopeTest.java                           macosx-all
-javax/script/NullUndefinedVarTest.java                          macosx-all
-javax/script/PluggableContextTest.java                          macosx-all
-javax/script/ProviderTest.sh                                    macosx-all
-javax/script/RhinoExceptionTest.java                            macosx-all
-javax/script/StringWriterPrintTest.java                         macosx-all
-javax/script/Test1.java                                         macosx-all
-javax/script/Test2.java                                         macosx-all
-javax/script/Test3.java                                         macosx-all
-javax/script/Test4.java                                         macosx-all
-javax/script/Test5.java                                         macosx-all
-javax/script/Test6.java                                         macosx-all
-javax/script/Test7.java                                         macosx-all
-javax/script/Test8.java                                         macosx-all
-javax/script/UnescapedBracketRegExTest.java                     macosx-all
-javax/script/VersionTest.java                                   macosx-all
 ############################################################################
 
 # jdk_net
@@ -224,11 +204,6 @@
 
 # jdk_io
 
-# 7162111 - these tests need to be updated to run headless
-java/io/Serializable/resolveClass/deserializeButton/run.sh      macosx-all
-java/io/Serializable/serialver/classpath/run.sh                 macosx-all
-java/io/Serializable/serialver/nested/run.sh                    macosx-all
-
 ############################################################################
 
 # jdk_nio
@@ -364,9 +339,6 @@
 
 # jdk_util
 
-# 7162111 - test needs to be changed to run headless
-java/util/ResourceBundle/Control/Bug6530694.java		macosx-all
-
 # Filed 6933803
 java/util/concurrent/ThreadPoolExecutor/CoreThreadTimeOut.java  generic-all
 
--- a/jdk/test/demo/jvmti/mtrace/TraceJFrame.java	Sat Nov 24 04:27:28 2012 -0800
+++ b/jdk/test/demo/jvmti/mtrace/TraceJFrame.java	Mon Nov 26 15:54:39 2012 +0400
@@ -32,21 +32,26 @@
  * @run main TraceJFrame JFrameCreateTime
  */
 
-public class TraceJFrame {
+import java.awt.GraphicsEnvironment;
 
+public class TraceJFrame {
     public static void main(String args[]) throws Exception {
-        DemoRun demo;
+        if (GraphicsEnvironment.getLocalGraphicsEnvironment().isHeadlessInstance()) {
+            System.out.println("JFrame test was skipped due to headless mode");
+        } else {
+            DemoRun demo;
 
-        /* Run demo that uses JVMTI mtrace agent (no options) */
-        demo = new DemoRun("mtrace", "" /* options to mtrace */ );
-        demo.runit(args[0]);
+            /* Run demo that uses JVMTI mtrace agent (no options) */
+            demo = new DemoRun("mtrace", "" /* options to mtrace */ );
+            demo.runit(args[0]);
 
-        /* Make sure patterns in output look ok */
-        if (demo.output_contains("ERROR")) {
-            throw new RuntimeException("Test failed - ERROR seen in output");
+            /* Make sure patterns in output look ok */
+            if (demo.output_contains("ERROR")) {
+                throw new RuntimeException("Test failed - ERROR seen in output");
+            }
+
+            /* Must be a pass. */
+            System.out.println("Test passed - cleanly terminated");
         }
-
-        /* Must be a pass. */
-        System.out.println("Test passed - cleanly terminated");
     }
 }
--- a/jdk/test/java/io/Serializable/resolveClass/deserializeButton/Foo.java	Sat Nov 24 04:27:28 2012 -0800
+++ b/jdk/test/java/io/Serializable/resolveClass/deserializeButton/Foo.java	Mon Nov 26 15:54:39 2012 +0400
@@ -26,27 +26,26 @@
  * @summary Verify that class loaded outside of application class loader is
  *          correctly resolved during deserialization when read in by custom
  *          readObject() method of a bootstrap class (in this case,
- *          java.awt.Button).
+ *          java.util.Vector).
  */
 
-import java.awt.Button;
-import java.awt.event.MouseAdapter;
 import java.io.*;
+import java.util.Vector;
 
 public class Foo implements Runnable {
 
-    static class Adapter extends MouseAdapter implements Serializable {}
+    static class TestElement extends Object implements Serializable {}
 
     public void run() {
         try {
-            Button button = new Button();
-            button.addMouseListener(new Adapter());
+            Vector<TestElement> container = new Vector<TestElement>();
+            container.add(new TestElement());
 
             // iterate to trigger java.lang.reflect code generation
             for (int i = 0; i < 100; i++) {
                 ByteArrayOutputStream bout = new ByteArrayOutputStream();
                 ObjectOutputStream oout = new ObjectOutputStream(bout);
-                oout.writeObject(button);
+                oout.writeObject(container);
                 oout.close();
                 ObjectInputStream oin = new ObjectInputStream(
                     new ByteArrayInputStream(bout.toByteArray()));
@@ -54,7 +53,7 @@
             }
         } catch (Exception ex) {
             throw new Error(
-                "Error occured while (de)serializing Button: " + ex);
+                "Error occured while (de)serializing container: ", ex);
         }
     }
 }
--- a/jdk/test/java/io/Serializable/resolveClass/deserializeButton/Test.java	Sat Nov 24 04:27:28 2012 -0800
+++ b/jdk/test/java/io/Serializable/resolveClass/deserializeButton/Test.java	Mon Nov 26 15:54:39 2012 +0400
@@ -26,7 +26,7 @@
  * @summary Verify that class loaded outside of application class loader is
  *          correctly resolved during deserialization when read in by custom
  *          readObject() method of a bootstrap class (in this case,
- *          java.awt.Button).
+ *          java.util.Vector).
  */
 
 import java.io.*;
--- a/jdk/test/java/io/Serializable/resolveClass/deserializeButton/run.sh	Sat Nov 24 04:27:28 2012 -0800
+++ b/jdk/test/java/io/Serializable/resolveClass/deserializeButton/run.sh	Mon Nov 26 15:54:39 2012 +0400
@@ -26,7 +26,7 @@
 # @summary Verify that class loaded outside of application class loader is
 #          correctly resolved during deserialization when read in by custom
 #          readObject() method of a bootstrap class (in this case,
-#          java.awt.Button).
+#          java.util.Vector).
 
 if [ "${TESTJAVA}" = "" ]
 then