* tests/regression/extest.java: Updated a bit and added another
authorChristian Thalinger <twisti@complang.tuwien.ac.at>
Mon, 8 Oct 2007 18:40:19 +0000 (20:40 +0200)
committerChristian Thalinger <twisti@complang.tuwien.ac.at>
Mon, 8 Oct 2007 18:40:19 +0000 (20:40 +0200)
testcase.
* tests/regression/extest.2output: Updated.
* tests/regression/extest_clinit.java: Removed.

tests/regression/extest.2output
tests/regression/extest.java
tests/regression/extest_clinit.java [deleted file]

index 365c8b2ead2f4732289850d9cd8060e07fb61f3d..642d790f408b54d5157f5a1f6af27f262dee471d 100644 (file)
----------- normal exceptions --------------------
-throw new Exception():                        OK
+normal exceptions-----------------------------------------
+
+throw new Exception():                                 OK
 java.lang.Exception
-   at extest.main(extest.java:24)
+   at extest.main(extest.java:26)
 
-throw new Exception() (from subroutines):     OK
+throw new Exception() (from subroutines):              OK
 java.lang.Exception
-   at extest.sub4(extest.java:392)
-   at extest.sub3(extest.java:388)
-   at extest.sub2(extest.java:384)
-   at extest.sub(extest.java:380)
-   at extest.main(extest.java:38)
+   at extest.sub4(extest.java:299)
+   at extest.sub3(extest.java:295)
+   at extest.sub2(extest.java:291)
+   at extest.sub(extest.java:287)
+   at extest.main(extest.java:40)
 
-NullPointerException:                         OK
+NullPointerException:                                  OK
 java.lang.NullPointerException
-   at extest.main(extest.java:48)
+   at extest.main(extest.java:50)
 
 
----------- test soft inline exceptions ----------
-/* thrown twice to check the inline jump code */
-ArithmeticException (only w/ -softnull):      OK
-java.lang.ArithmeticException: / by zero
-   at extest.main(extest.java:63)
+exceptions thrown in JIT code-----------------------------
 
-ArithmeticException (only w/ -softnull):      OK
+ArithmeticException (only w/ -softnull):               OK
 java.lang.ArithmeticException: / by zero
-   at extest.main(extest.java:79)
+   at extest.main(extest.java:64)
 
-ArrayIndexOutOfBoundsException:               OK
+ArrayIndexOutOfBoundsException:                        OK
 java.lang.ArrayIndexOutOfBoundsException: -889275714
-   at extest.main(extest.java:97)
-
-ArrayIndexOutOfBoundsException:               OK
-java.lang.ArrayIndexOutOfBoundsException: -1161901314
-   at extest.main(extest.java:114)
+   at extest.main(extest.java:81)
 
-ArrayStoreException:                          OK
+ArrayStoreException:                                   OK
 java.lang.ArrayStoreException
-   at extest.main(extest.java:133)
+   at extest.main(extest.java:99)
 
-ArrayStoreException:                          OK
-java.lang.ArrayStoreException
-   at extest.main(extest.java:144)
-
-ClassCastException:                           OK
+ClassCastException:                                    OK
 java.lang.ClassCastException: java/lang/Object
-   at extest.main(extest.java:155)
+   at extest.main(extest.java:109)
 
-ClassCastException:                           OK
-java.lang.ClassCastException: java/lang/Object
-   at extest.main(extest.java:166)
-
-NegativeArraySizeException (newarray):        OK
-java.lang.NegativeArraySizeException
-   at extest.main(extest.java:176)
-
-NegativeArraySizeException (newarray):        OK
+NegativeArraySizeException (newarray):                 OK
 java.lang.NegativeArraySizeException
-   at extest.main(extest.java:185)
+   at extest.main(extest.java:118)
 
-NegativeArraySizeException (multianewarray):  OK
+NegativeArraySizeException (multianewarray):           OK
 java.lang.NegativeArraySizeException
-   at extest.main(extest.java:194)
-
-NullPointerException (only w/ -softnull):     OK
-java.lang.NullPointerException
-   at extest.main(extest.java:205)
+   at extest.main(extest.java:127)
 
-NullPointerException (only w/ -softnull):     OK
-java.lang.NullPointerException
-   at extest.main(extest.java:215)
-
-OutOfMemoryError:                             OK
+OutOfMemoryError:                                      OK
 java.lang.OutOfMemoryError
-   at extest.main(extest.java:225)
+   at extest.main(extest.java:137)
 
-OutOfMemoryError:                             OK
+OutOfMemoryError (multianewarray):                     OK
 java.lang.OutOfMemoryError
-   at extest.main(extest.java:235)
+   at extest.main(extest.java:146)
 
-OutOfMemoryError (multianewarray):            OK
-java.lang.OutOfMemoryError
-   at extest.main(extest.java:244)
 
+exceptions in leaf functions------------------------------
 
----------- exceptions in leaf functions ---------
-ArithmeticException:                          OK
+ArithmeticException:                                   OK
 java.lang.ArithmeticException: / by zero
-   at extest.aesub(extest.java:396)
-   at extest.main(extest.java:258)
+   at extest.aesub(extest.java:303)
+   at extest.main(extest.java:160)
 
-ArrayIndexOutOfBoundsException:               OK
+ArrayIndexOutOfBoundsException:                        OK
 java.lang.ArrayIndexOutOfBoundsException: -559038737
-   at extest.aioobesub(extest.java:400)
-   at extest.main(extest.java:267)
+   at extest.aioobesub(extest.java:307)
+   at extest.main(extest.java:169)
 
-ClassCastException:                           OK
+ClassCastException:                                    OK
 java.lang.ClassCastException: java/lang/Object
-   at extest.ccesub(extest.java:404)
-   at extest.main(extest.java:284)
+   at extest.ccesub(extest.java:311)
+   at extest.main(extest.java:186)
 
-NullPointerException:                         OK
+NullPointerException:                                  OK
 java.lang.NullPointerException
-   at extest.npesub(extest.java:408)
-   at extest.main(extest.java:293)
+   at extest.npesub(extest.java:315)
+   at extest.main(extest.java:195)
+
+Exception in <clinit> triggered from a leaf method:    OK
+java.lang.ExceptionInInitializerError
+   at extest.main(extest.java:204)
+Caused by: java.lang.NullPointerException
+   at extest_clinit_patcher.<clinit>(extest.java:374)
+   at extest.main(extest.java:204)
+
 
+exception related things----------------------------------
 
----------- exception related things -------------
-load/link an exception class in asmpart:      OK
+load/link an exception class in asmpart:               OK
 java.lang.Exception
-   at extest.main(extest.java:307)
+   at extest.main(extest.java:218)
+
 
+native stub exceptions------------------------------------
 
----------- native stub exceptions ---------------
-NullPointerException in <clinit>:             OK
+NullPointerException in <clinit>:                      OK
 java.lang.ExceptionInInitializerError
-   at extest.main(extest.java:323)
+   at extest.main(extest.java:234)
 Caused by: java.lang.NullPointerException
-   at extest_clinit.<clinit>(extest_clinit.java:4)
-   at extest.main(extest.java:323)
+   at extest_clinit.<clinit>(extest.java:363)
+   at extest.main(extest.java:234)
 
-UnsatisfiedLinkError:                         OK
+UnsatisfiedLinkError:                                  OK
 java.lang.UnsatisfiedLinkError: nsub
-   at extest.nsub(Native Method)
-   at extest.main(extest.java:336)
+   at extest.main(extest.java:243)
 
-NullPointerException (native):                OK
+NullPointerException (native):                         OK
 java.lang.NullPointerException
-   at java.lang.System.arraycopy(System.java:281)
-   at extest.main(extest.java:345)
+   at java.lang.System.arraycopy(System.java:297)
+   at extest.main(extest.java:252)
 
 
----------- special exceptions -------------------
-OutOfMemoryError (array clone):               OK
+special exceptions----------------------------------------
+
+OutOfMemoryError (array clone):                        OK
 java.lang.OutOfMemoryError
    at [B.clone(Native Method)
-   at extest.main(extest.java:361)
+   at extest.main(extest.java:268)
+
 
+exception thrown to command-line--------------------------
 
----------- no OK beyond this point --------------
 NullPointerException (without catch):
 Exception in thread "main" java.lang.NullPointerException
-   at extest.main(extest.java:375)
+   at extest.main(extest.java:282)
index 3294b156ed25015b46dfa122ba5846962646297e..4a91243b98dbeed4f7a3c65737cd07cb1a08c894 100644 (file)
@@ -1,4 +1,6 @@
 public class extest {
+    final static int COLUMN = 55;
+
     final static int INDEX1 = 0xcafebabe;
     final static int INDEX2 = 0xbabecafe;
     final static int INDEX3 = 0xdeadbeef;
@@ -15,20 +17,20 @@ public class extest {
 //              if (argv[0].equals("stacktrace"))
 //                  printStackTrace = true;
 
-        boolean catched = false;
+        boolean caught = false;
 
-       pln("---------- normal exceptions --------------------");
+       pheader("normal exceptions");
 
        try {
             p("throw new Exception():");
            throw new Exception();
        } catch (Exception e) {
-            catched = true;
+            caught = true;
            ok();
            pstacktrace(e);
        } finally {
             /* check if catch block was executed */
-            if (!catched) {
+            if (!caught) {
                 failed();
             }
         }
@@ -55,8 +57,7 @@ public class extest {
        pln();
 
 
-       pln("---------- test soft inline exceptions ----------");
-       pln("/* thrown twice to check the inline jump code */");
+       pheader("exceptions thrown in JIT code");
 
         try {
             p("ArithmeticException (only w/ -softnull):");
@@ -74,23 +75,6 @@ public class extest {
             }
        }
 
-        try {
-            p("ArithmeticException (only w/ -softnull):");
-            long i = 1, j = 0, k = i / j;
-            failed();
-        } catch (ArithmeticException e) {
-           String msg = e.getMessage();
-
-           if (msg == null || !msg.equals("/ by zero")) {
-               pln("FAILED: wrong message: " + msg + ", should be: / by zero");
-
-           } else {
-                ok();
-                pstacktrace(e);
-            }
-       }
-
-
         try {
             p("ArrayIndexOutOfBoundsException:");
             int[] ia = new int[1];
@@ -108,24 +92,6 @@ public class extest {
            }
        }
 
-        try {
-            p("ArrayIndexOutOfBoundsException:");
-            int[] ia = new int[1];
-            ia[INDEX2] = 1;
-            failed();
-        } catch (ArrayIndexOutOfBoundsException e) {
-           String msg = e.getMessage();
-
-           if (msg == null || !msg.equals(String.valueOf(INDEX2))) {
-               pln("FAILED: wrong index: " + msg + ", should be: " + INDEX2);
-               pstacktrace(e);
-           } else {
-               ok();
-               pstacktrace(e);
-           }
-       }
-
-
         try {
             p("ArrayStoreException:");
            Integer[] ia = new Integer[1];
@@ -137,18 +103,6 @@ public class extest {
            pstacktrace(e);
        }
 
-        try {
-            p("ArrayStoreException:");
-           Integer[] ia = new Integer[1];
-            Object[] oa = (Object[]) ia;
-           oa[0] = new Object();
-            failed();
-        } catch (ArrayStoreException e) {
-           ok();
-           pstacktrace(e);
-       }
-
-
         try {
             p("ClassCastException:");
             Object o = new Object();
@@ -159,27 +113,6 @@ public class extest {
            pstacktrace(e);
        }
 
-        try {
-            p("ClassCastException:");
-            Object o = new Object();
-            Integer i = null;
-            i = (Integer) o;
-            failed();
-        } catch (ClassCastException e) {
-           ok();
-           pstacktrace(e);
-       }
-
-
-        try {
-            p("NegativeArraySizeException (newarray):");
-            int[] ia = new int[-1];
-            failed();
-        } catch (NegativeArraySizeException e) {
-           ok();
-           pstacktrace(e);
-       }
-
         try {
             p("NegativeArraySizeException (newarray):");
             int[] ia = new int[-1];
@@ -198,27 +131,6 @@ public class extest {
            pstacktrace(e);
        }
 
-        
-        try {
-            p("NullPointerException (only w/ -softnull):");
-            int[] ia = null;
-            int i = ia.length;
-            failed();
-        } catch (NullPointerException e) {
-           ok();
-           pstacktrace(e);
-       }
-
-        try {
-            p("NullPointerException (only w/ -softnull):");
-            int[] ia = null;
-            int i = ia.length;
-            failed();
-        } catch (NullPointerException e) {
-           ok();
-           pstacktrace(e);
-       }
-
         try {
             p("OutOfMemoryError:");
            /* use twice the heap size */
@@ -229,16 +141,6 @@ public class extest {
            pstacktrace(e);
        }
 
-        try {
-            p("OutOfMemoryError:");
-           /* use twice the heap size */
-           byte[] ba = new byte[maxmem * 2];
-            failed();
-        } catch (OutOfMemoryError e) {
-           ok();
-           pstacktrace(e);
-       }
-        
         try {
             p("OutOfMemoryError (multianewarray):");
            byte[][] ba = new byte[maxmem][maxmem];
@@ -251,7 +153,7 @@ public class extest {
        pln();
 
 
-       pln("---------- exceptions in leaf functions ---------");
+       pheader("exceptions in leaf functions");
 
         try {
             p("ArithmeticException:");
@@ -297,10 +199,19 @@ public class extest {
             pstacktrace(e);
         }
 
+        try {
+            p("Exception in <clinit> triggered from a leaf method:");
+            extest_clinit_patcher.i = 1;
+            failed();
+        } catch (ExceptionInInitializerError e) {
+            ok();
+            pstacktrace(e);
+        }
+
        pln();
 
 
-       pln("---------- exception related things -------------");
+       pheader("exception related things");
 
         try {
             p("load/link an exception class in asmpart:");
@@ -316,7 +227,7 @@ public class extest {
         pln();
 
 
-       pln("---------- native stub exceptions ---------------");
+       pheader("native stub exceptions");
 
         try {
             p("NullPointerException in <clinit>:");
@@ -325,10 +236,6 @@ public class extest {
         } catch (ExceptionInInitializerError e) {
             ok();
             pstacktrace(e);
-        } catch (UnsatisfiedLinkError e) {
-            /* catch this one for ENABLE_STATICVM and say it's ok */
-            ok();
-            pstacktrace(e);
         }
 
         try {
@@ -352,7 +259,7 @@ public class extest {
         pln();
 
 
-       pln("---------- special exceptions -------------------");
+       pheader("special exceptions");
 
        try {
             p("OutOfMemoryError (array clone):");
@@ -368,7 +275,7 @@ public class extest {
         pln();
 
 
-       pln("---------- no OK beyond this point --------------");
+       pheader("exception thrown to command-line");
 
         pln("NullPointerException (without catch):");
         String s = null;
@@ -412,11 +319,20 @@ public class extest {
 
     static void p(String s) {
        System.out.print(s);
-        for (int i = s.length(); i < 46; i++) {
+        for (int i = s.length(); i < COLUMN; i++) {
             System.out.print(" ");
         }
     }
 
+    static void pheader(String s) {
+       System.out.print(s);
+        for (int i = s.length(); i < COLUMN + 3; i++) {
+            System.out.print("-");
+        }
+        System.out.println();
+        System.out.println();
+    }
+
     static void pln() {
        System.out.println();
     }
@@ -440,3 +356,21 @@ public class extest {
        System.out.println();
     }
 }
+
+class extest_clinit {
+    static {
+        String s = null;
+        s.length();
+    }
+
+    public static native void sub();
+}
+
+class extest_clinit_patcher {
+    static int i;
+
+    static {
+        int[] ia = null;
+        int a = ia.length;
+    }
+}
diff --git a/tests/regression/extest_clinit.java b/tests/regression/extest_clinit.java
deleted file mode 100644 (file)
index d7a79c9..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-public class extest_clinit {
-    static {
-        String s = null;
-        s.length();
-    }
-
-    public static native void sub();
-}