This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

patch/RFC/RFT detect ICE in libjava testsuite


This isn't fully tested yet, but I wanted to check on my approach for
reporting internal compiler errors in the libjava testsuite.  The test 
that David Daney added for me doesn't ICE on powerpc*-linux so I had
to fake it by looking for another string, but it seems to work for
libjava/testsuite/libjava.compile.

I modified bytecompile_file so that instead of returning 0 for fail,
1 for success, it now returns 0 for success, 1 for failure, 2 for
failure with "internal compiler error" in the compiler output.  Since
I don't have a libjava test that ICEs, I don't even know if that's the
string gcj uses, or whether it's appropriate to look for it from
bytecompile_file as well as from libjava_tcompile.  Currently only
lib/libjava.exp handles a 2 from bytecompile_file; other places that
call it were modified to handle 0 instead of 1 for "pass", but it
would be easy to change them to report ICEs as well.

Am I on the right track?

2006-05-12  Janis Johnson  <janis187@us.ibm.com>

	PR testsuite/24128:
	* testsuite/lib/libjava.exp (bytecompile_file): Change return value
	to 0 for pass, 1 for fail, 2 for ICE.
	(test_libjava_from_source): Detect and report ICE.
	(test_libjava_from_javac): Ditto.
	* testsuite/libjava.cni/cni.exp (gcj_cni_test_one): Handle new
	return value from bytecompile_file.
	* testsuite/libjava.mauve/mauve.exp (test_mauve): Ditto.
	(test_mauve_sim): Ditto.
	* testsuite/libjava.special/special.exp (gcj_special_run): Ditto.
	* testsuite/libjava.jni/jni.exp (gcj_jni_test_one): Ditto.
	(gcj_jni_invocation_test_one): Ditto.
	* testsuite/libjava.loader/loader.exp (gcj_loader_run): Ditto.

Index: lib/libjava.exp
===================================================================
--- lib/libjava.exp	(revision 113711)
+++ lib/libjava.exp	(working copy)
@@ -105,6 +105,7 @@
     return $SUN_JAVAC
 }
 
+# Return 0 for success, 1 for failure, 2 for ICE.
 proc bytecompile_file { file objdir {classpath {}} } {
     global env
     set dirname [file dirname $file]
@@ -120,11 +121,16 @@
 	set q [eval exec "$javac -g [list $file] -d $objdir 2>@ stdout"]
     } msg]} then {
 	send_log "couldn't compile $file: $msg\n"
+	if [string match "*internal compiler error*" $msg] {
+	    set r 2
+	} else {
+	    set r 1
+	}
+    } else {
 	set r 0
-    } else {
-	set r 1
     }
     cd $here
+    verbose "bytecompile_file returning $r" 1
     return $r
 }
 
@@ -642,19 +648,26 @@
 
     set x [libjava_prune_warnings \
 	     [libjava_tcompile $srcfile "$executable" $target $args]]
-    if {[info exists opts(xfail-gcj)]} {
+
+    # Detect an ICE, which fails unconditionally.
+    set ice [string match "*internal compiler error*" $x]
+
+    if {[info exists opts(xfail-gcj)] && $ice == 0 } {
 	setup_xfail *-*-*
     }
     if { $x != "" } {
 	verbose "target_compile failed: $x" 2
 
-	if {[info exists opts(shouldfail)]} {
+	if { $ice != 0 } {
+	    fail "$errname compilation from source (internal compiler error)"
+	} elseif {[info exists opts(shouldfail)]} {
 	    pass "$errname compilation from source"
 	    eval gcj_cleanup $removeList
 	    return
+	} else {
+	    fail "$errname compilation from source"
 	}
 
-	fail "$errname compilation from source"
 	if {[info exists opts(xfail-gcj)]
 	    || ! [info exists opts(no-exec)]
 	    || [info exists opts(need-threads)]} {
@@ -714,7 +727,7 @@
     }
 
     # bytecompile files with Sun's compiler for now.
-    set bc_ok [bytecompile_file $srcfile $objdir]
+    set bc_ret [bytecompile_file $srcfile $objdir]
 
     set javac [find_javac]
     # This is an ugly heuristic but it will have to do.
@@ -726,12 +739,15 @@
     if {[info exists opts(xfail-$tag)]} {
 	setup_xfail *-*-*
     }
-    if {! $bc_ok} then {
-	if {[info exists opts(shouldfail)]} {
+    if { $bc_ret != 0 } then {
+	if { $bc_ret == 2 } then {
+	    fail "$errname byte compilation (internal compiler error)"
+	} elseif [info exists opts(shouldfail)] {
 	    pass "$errname byte compilation"
 	    return
+	} else {
+	    fail "$errname byte compilation"
 	}
-	fail "$errname byte compilation"
 	untested "$errname compilation from bytecode"
 	if {! [info exists opts(no-exec)]
 	    || [info exists opts(need-threads)]} {
@@ -855,12 +871,18 @@
 	set x [libjava_prune_warnings \
 		 [libjava_tcompile $hack "$executable" $type $args]]
     }
-    if {[info exists opts(xfail-byte)]} {
+    # Detect an ICE, which always fails.
+    set ice [string match "*internal compiler error*" $x]
+    if {[info exists opts(xfail-byte)] && $ice == 0} {
 	setup_xfail *-*-*
     }
     if { $x != "" } {
 	verbose "target_compile failed: $x" 2
-	fail "$errname compilation from bytecode"
+	if { $ice != 0 } {
+	    fail "$errname compilation from bytecode (internal compiler error)"
+	} else {
+	    fail "$errname compilation from bytecode"
+	}
 	if {! [info exists opts(no-exec)]
 	    || [info exists opts(need-threads)]} {
 	    untested "$errname execution from bytecode->native test"
Index: libjava.cni/cni.exp
===================================================================
--- libjava.cni/cni.exp	(revision 113711)
+++ libjava.cni/cni.exp	(working copy)
@@ -64,7 +64,7 @@
     return 1
   }
 
-  if {! [bytecompile_file $file [pwd]]} {
+  if { [bytecompile_file $file [pwd]] != 0 } {
     fail "bytecompile $file"
     # FIXME - should use `untested' on all remaining tests.
     # But that is hard.
Index: libjava.mauve/mauve.exp
===================================================================
--- libjava.mauve/mauve.exp	(revision 113711)
+++ libjava.mauve/mauve.exp	(working copy)
@@ -153,7 +153,7 @@
   pass "Mauve build"
 
   set srcfile $full_srcdir/$subdir/DejaGNUTestHarness.java
-  if {! [bytecompile_file $srcfile [pwd] $env(MAUVEDIR):[pwd]]} then {
+  if { [bytecompile_file $srcfile [pwd] $env(MAUVEDIR):[pwd]] != 0 } {
     fail "Compile DejaGNUTestHarness.java"
     return 0
   }
@@ -377,8 +377,8 @@
     close $f
     close $d
 
-    if {! [bytecompile_file [pwd]/gnu/testlet/$srcfile [pwd]/gnu/testlet \
-	       $env(MAUVEDIR):[pwd]]} then {
+    if { [bytecompile_file [pwd]/gnu/testlet/$srcfile [pwd]/gnu/testlet \
+	       $env(MAUVEDIR):[pwd]] != 0 } {
 	fail "Compile DejaGNUTestHarness.java"
 	return 0
     }
Index: libjava.special/special.exp
===================================================================
--- libjava.special/special.exp	(revision 113711)
+++ libjava.special/special.exp	(working copy)
@@ -5,7 +5,7 @@
 
   # ---- PR 21115 -------------------------------------------------------
 
-  if {! [bytecompile_file ${srcdir}/${subdir}/pr21115I.java [pwd]]} {
+  if { [bytecompile_file ${srcdir}/${subdir}/pr21115I.java [pwd]] != 0 } {
     fail "bytecompile ${srcdir}/${subdir}/libjava.special/pr21115I.java"
     # FIXME - should use `untested' on all remaining tests.
     # But that is hard.
Index: libjava.jni/jni.exp
===================================================================
--- libjava.jni/jni.exp	(revision 113711)
+++ libjava.jni/jni.exp	(working copy)
@@ -100,7 +100,7 @@
     return 1
   }
 
-  if {! [bytecompile_file $file [pwd]]} {
+  if { [bytecompile_file $file [pwd]] != 0 } {
     fail "bytecompile $file"
     # FIXME - should use `untested' on all remaining tests.
     # But that is hard.
@@ -242,7 +242,7 @@
     return 1
   }
 
-  if {! [bytecompile_file $file [pwd]]} {
+  if { [bytecompile_file $file [pwd]] != 0 } {
     fail "bytecompile $file"
     # FIXME - should use `untested' on all remaining tests.
     # But that is hard.
Index: libjava.loader/loader.exp
===================================================================
--- libjava.loader/loader.exp	(revision 113711)
+++ libjava.loader/loader.exp	(working copy)
@@ -46,7 +46,7 @@
   global GCJ_UNDER_TEST
 
   set file "${srcdir}/${subdir}/dummy.java"
-  if {! [bytecompile_file $file [pwd]]} {
+  if { [bytecompile_file $file [pwd]] != 0 } {
     fail "bytecompile $file"
     # FIXME - should use `untested' on all remaining tests.
     # But that is hard.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]