Patch: Test for PR 124, plus test suite improvement

Tom Tromey tromey@cygnus.com
Sun Mar 5 22:03:00 GMT 2000


I'm committing this patch.
It adds a test for PR 124.
It also changes the test suite to allow a `shouldfail' tag in an xfail
file; if this tag is seen then the test harness will assume that the
compilation for the file should fail.  This is different from an XFAIL
(which is used to mark failures we know about and aren't planning to
fix immediately).

2000-03-05  Tom Tromey  <tromey@cygnus.com>

	* lib/libjava.exp (test_libjava): Document `shouldfail' token.
	(test_libjava_from_source): Handle `shouldfail' case.
	(test_libjava_from_javac): Likewise.

	Test for PR libgcj/124:
	* libjava.compile/PR124.java: New file.
	* libjava.compile/PR124.xfail: New file.

Tom

Index: lib/libjava.exp
===================================================================
RCS file: /cvs/java/libgcj/libjava/testsuite/lib/libjava.exp,v
retrieving revision 1.12
diff -u -r1.12 libjava.exp
--- libjava.exp	2000/01/19 18:39:27	1.12
+++ libjava.exp	2000/03/06 06:02:56
@@ -1,4 +1,4 @@
-# Copyright (C) 1998, 1999 Red Hat, Inc.
+# Copyright (C) 1998, 1999, 2000 Red Hat, Inc.
 
 load_lib "libgloss.exp"
 
@@ -275,6 +275,11 @@
 #   `xfail-gcj'   compilation from source will fail
 #   `xfail-javac' compilation with javac will fail
 #   `xfail-gcjC'  compilation with gcj -C will fail
+#   `shouldfail'  compilation from source is supposed to fail
+#                 This is different from xfail, which marks a known
+#                 failure that we just havne't fixed.
+#                 A compilation marked this way should fail with any
+#                 front end.
 #   `xfail-byte'  compilation from bytecode will fail
 #   `xfail-exec'  exec will fail
 #   `xfail-output' output will be wrong
@@ -334,6 +339,12 @@
     }
     if { $x != "" } {
 	verbose "target_compile failed: $x" 2
+
+	if {[info exists opts(shouldfail)]} {
+	    pass "$errname compilation from source"
+	    return
+	}
+
 	fail "$errname compilation from source"
 	if {[info exists opts(xfail-gcj)] || ! [info exists opts(no-exec)]} {
 	    setup_xfail "*-*-*"
@@ -341,7 +352,11 @@
 	    setup_xfail "*-*-*"
 	    fail "$errname output from source compiled test"
 	}
-	return;
+	return
+    }
+    if {[info exists opts(shouldfail)]} {
+	fail "$errname compilation from source"
+	return
     }
     pass "$errname compilation from source"
 
@@ -409,6 +424,11 @@
 #   `xfail-gcj'   compilation from source will fail
 #   `xfail-javac' compilation with javac will fail
 #   `xfail-gcjC'  compilation with gcj -C will fail
+#   `shouldfail'  compilation from source is supposed to fail
+#                 This is different from xfail, which marks a known
+#                 failure that we just havne't fixed.
+#                 A compilation marked this way should fail with any
+#                 front end.
 #   `xfail-byte'  compilation from bytecode will fail
 #   `xfail-exec'  exec will fail
 #   `xfail-output' output will be wrong
@@ -443,6 +463,10 @@
 	setup_xfail *-*-*
     }
     if {! $bc_ok} then {
+	if {[info exists opts(shouldfail)]} {
+	    pass "$errname byte compilation"
+	    return
+	}
 	fail "$errname byte compilation"
 	setup_xfail "*-*-*"
 	fail "$errname compilation from bytecode"
@@ -454,6 +478,10 @@
 	}
 	return
     }
+    if {[info exists opts(shouldfail)]} {
+	fail "$errname byte compilation"
+	return
+    }
     pass "$errname byte compilation"
 
     # Find name to use for --main, and name of all class files.
@@ -607,10 +635,15 @@
 # Run the test specified by srcfile and resultfile. compile_args and
 # exec_args are options telling this proc how to work.
 #   `no-link'     don't try to link the program
-#   `no-exec' don't try to run the test
+#   `no-exec'     don't try to run the test
 #   `xfail-gcj'   compilation from source will fail
 #   `xfail-javac' compilation with javac will fail
 #   `xfail-gcjC'  compilation with gcj -C will fail
+#   `shouldfail'  compilation from source is supposed to fail
+#                 This is different from xfail, which marks a known
+#                 failure that we just havne't fixed.
+#                 A compilation marked this way should fail with any
+#                 front end.
 #   `xfail-byte'  compilation from bytecode will fail
 #   `xfail-exec'  exec will fail
 #   `xfail-output' output will be wrong
Index: libjava.compile/PR124.java
===================================================================
RCS file: PR124.java
diff -N PR124.java
--- /dev/null	Tue May  5 13:32:27 1998
+++ PR124.java	Sun Mar  5 22:02:56 2000
@@ -0,0 +1,9 @@
+import java.lang.reflect.*;
+
+public class PR124
+{
+  public static void main (String[] args)
+  {
+    System.out.println (new InvocationTargetException ());
+  }
+}
Index: libjava.compile/PR124.xfail
===================================================================
RCS file: PR124.xfail
diff -N PR124.xfail
--- /dev/null	Tue May  5 13:32:27 1998
+++ PR124.xfail	Sun Mar  5 22:02:56 2000
@@ -0,0 +1 @@
+shouldfail


More information about the Java-patches mailing list