This is the mail archive of the java-patches@sources.redhat.com 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]

Patch: libjava.compile test fixes


This patch has two purposes.  First, it adds a bunch of `.xfail' files
to libjava.compile.  Some of these are required (missing `no-link'
options) and some are there to mark known failures (see below).
Second, this patch fixes some bugs in the test framework.

I think we the test suite should report 0 FAILs and 0 XPASSes.  So if
a test is known to fail I think we ought to XFAIL it.  I think this
makes it much easier to spot regressions.

There are still a bunch of real failures here.  I fixed one tonight,
but many more remain; we should fix them.

2000-12-15  Tom Tromey  <tromey@redhat.com>

	* lib/libjava.exp (libjava_tcompile): New proc.
	(test_libjava_from_source): Use it.
	(test_libjava_from_javac): Likewise.
	(find_javac): New proc.
	(bytecompile_file): Use it.
	(test_libjava_from_javac): Handle `xfail-gcjC' tag.  If no-exec
	set, then don't link even if program has a `main'.

	* libjava.compile/static_3.xfail: New file.
	* libjava.compile/weirddecl.xfail: New file.
	* libjava.compile/static_2.xfail: New file.
	* libjava.compile/not_a_redef.xfail: New file.
	* libjava.compile/inner_1.xfail: New file.
	* libjava.compile/assignment_2.xfail: New file.
	* libjava.compile/assignment.xfail: New file.
	* libjava.compile/abstr.xfail: New file.
	* libjava.compile/PR375.xfail: New file.
	* libjava.compile/PR374.java: New file.
	* libjava.compile/PR238.xfail: New file.
	* libjava.compile/PR208.xfail: New file.
	* libjava.compile/PR207.xfail: New file.

Tom

Index: lib/libjava.exp
===================================================================
RCS file: /cvs/gcc/egcs/libjava/testsuite/lib/libjava.exp,v
retrieving revision 1.19
diff -u -r1.19 libjava.exp
--- libjava.exp	2000/11/24 21:38:15	1.19
+++ libjava.exp	2000/12/16 02:02:08
@@ -10,6 +10,19 @@
     set tmpdir "/tmp"
 }
 
+# This is like `target_compile' but it does some surgery to work
+# around stupid DejaGNU bugs.  In particular DejaGNU has very poor
+# quoting, so for instance a `$' will be re-evaluated at spawn time.
+# We don't want that.
+proc libjava_tcompile {source destfile type options} {
+    # This strange-looking expression really does quote the `$'.
+    regsub -all -- {\$} $source {\$} source
+    regsub -all -- {\$} $destfile {\$} destfile
+    verbose "Now source = $source"
+    verbose "Now destfile = $destfile"
+    return [target_compile $source $destfile $type $options]
+}
+
 # Read an `xfail' file if it exists.  Returns a list of xfail tokens.
 proc libjava_read_xfail {file} {
     if {! [file exists $file]} {
@@ -46,12 +59,8 @@
     return [libjava_find_program gcjh]
 }
 
-proc bytecompile_file { file objdir {classpath {}} } {
-    global env
-    global SUN_JAVAC
-    global GCJ_UNDER_TEST
-    set dirname [file dirname $file]
-
+proc find_javac {} {
+    global SUN_JAVAC GCJ_UNDER_TEST env
     # If JDK doesn't run on your platform but some other
     # JDK-compatible javac does, you may set SUN_JAVAC to point to it.
     # One of the most important properties of a SUN_JAVAC is that it
@@ -60,14 +69,21 @@
     # those that have.  For example, Pizza won't do it, but you can
     # use `kaffe sun.tools.javac.Main', if you have Sun's classes.zip
     # in the kaffe's default search path.
-    if ![info exists SUN_JAVAC] {
-	if [info exists env(SUN_JAVAC)] {
+    if {![info exists SUN_JAVAC]} {
+	if {[info exists env(SUN_JAVAC)]} {
 	    set SUN_JAVAC $env(SUN_JAVAC)
 	} else {
 	    set SUN_JAVAC "$GCJ_UNDER_TEST -C"
 	}
     }
+    return $SUN_JAVAC
+}
+
+proc bytecompile_file { file objdir {classpath {}} } {
+    global env
+    set dirname [file dirname $file]
 
+    set javac [find_javac]
     catch {unset env(CLASSPATH)}
     if {$classpath != ""} then {
         set env(CLASSPATH) $classpath
@@ -75,7 +91,7 @@
     if {[catch {
 	set here [pwd]
 	cd $dirname
-	set q [eval exec "$SUN_JAVAC [list $file] -d $objdir 2>@ stdout"]
+	set q [eval exec "$javac [list $file] -d $objdir 2>@ stdout"]
 	cd $here
 	# "return" a result
 	set q $q
@@ -338,7 +354,7 @@
     }
 
     set x [prune_warnings \
-	     [target_compile $srcfile "$executable" $target $args]]
+	     [libjava_tcompile $srcfile "$executable" $target $args]]
     if {[info exists opts(xfail-gcj)]} {
 	setup_xfail *-*-*
     }
@@ -449,9 +465,15 @@
 
     # bytecompile files with Sun's compiler for now.
     set bc_ok [bytecompile_file $srcfile $objdir]
-    # FIXME: assumes we are using javac to compile to bytecode.
-    # This is not always the case.
-    if {[info exists opts(xfail-javac)]} {
+
+    set javac [find_javac]
+    # This is an ugly heuristic but it will have to do.
+    if {[string match *gcj* $javac]} {
+	set tag gcjC
+    } else {
+	set tag javac
+    }
+    if {[info exists opts(xfail-$tag)]} {
 	setup_xfail *-*-*
     }
     if {! $bc_ok} then {
@@ -481,12 +503,12 @@
     verbose "jvscan is $jvscan"
     set main_name [string trim \
 		     [prune_warnings \
-			[target_compile $srcfile "" none \
+			[libjava_tcompile $srcfile "" none \
 			   "compiler=$jvscan additional_flags=--print-main"]]]
     verbose "main name is $main_name"
     set class_out [string trim \
 		     [prune_warnings \
-			[target_compile $srcfile "" none \
+			[libjava_tcompile $srcfile "" none \
 			   "compiler=$jvscan additional_flags=--list-class"]]]
     verbose "class list is $class_out"
 
@@ -519,14 +541,13 @@
 	set opts(no-exec) x
     }
     set largs {}
-    if {$main_name == ""} {
-	if {! [info exists opts(no-exec)]} {
-	    perror "No `main' given in program $errname"
-	    return
-	} else {
-	    set type object
-	    set mode compile
-	}
+
+    if {[info exists opts(no-exec)]} {
+	set type object
+	set mode compile
+    } elseif {$main_name == ""} {
+	perror "No `main' given in program $errname"
+	return
     } else {
 	set type executable
 	lappend largs "additional_flags=--main=$main_name"
@@ -554,14 +575,14 @@
 	foreach c_file $class_files {
 	    set executable [file rootname [file tail $c_file]].o
 	    set x [prune_warnings \
-		     [target_compile $c_file "$executable" $type $args]]
+		     [libjava_tcompile $c_file "$executable" $type $args]]
 	    if {$x != ""} {
 		break
 	    }
 	}
     } else {
 	set x [prune_warnings \
-		 [target_compile $class_files "$executable" $type $args]]
+		 [libjava_tcompile $class_files "$executable" $type $args]]
     }
     if {[info exists opts(xfail-byte)]} {
 	setup_xfail *-*-*
Index: libjava.compile/PR207.xfail
===================================================================
RCS file: PR207.xfail
diff -N PR207.xfail
--- /dev/null	Tue May  5 13:32:27 1998
+++ PR207.xfail	Fri Dec 15 18:02:08 2000
@@ -0,0 +1,2 @@
+no-link
+xfail-byte
Index: libjava.compile/PR208.xfail
===================================================================
RCS file: PR208.xfail
diff -N PR208.xfail
--- /dev/null	Tue May  5 13:32:27 1998
+++ PR208.xfail	Fri Dec 15 18:02:08 2000
@@ -0,0 +1,2 @@
+no-link
+xfail-byte
Index: libjava.compile/PR238.xfail
===================================================================
RCS file: PR238.xfail
diff -N PR238.xfail
--- /dev/null	Tue May  5 13:32:27 1998
+++ PR238.xfail	Fri Dec 15 18:02:08 2000
@@ -0,0 +1 @@
+no-link
Index: libjava.compile/PR374.xfail
===================================================================
RCS file: PR374.xfail
diff -N PR374.xfail
--- /dev/null	Tue May  5 13:32:27 1998
+++ PR374.xfail	Fri Dec 15 18:02:08 2000
@@ -0,0 +1,2 @@
+xfail-gcj
+xfail-gcjC
Index: libjava.compile/PR375.xfail
===================================================================
RCS file: PR375.xfail
diff -N PR375.xfail
--- /dev/null	Tue May  5 13:32:27 1998
+++ PR375.xfail	Fri Dec 15 18:02:08 2000
@@ -0,0 +1 @@
+xfail-gcj
Index: libjava.compile/abstr.xfail
===================================================================
RCS file: /cvs/gcc/egcs/libjava/testsuite/libjava.compile/abstr.xfail,v
retrieving revision 1.1
diff -u -r1.1 abstr.xfail
--- abstr.xfail	2000/09/01 00:13:31	1.1
+++ abstr.xfail	2000/12/16 02:02:08
@@ -1 +1,2 @@
 no-link
+xfail-byte
Index: libjava.compile/assignment.xfail
===================================================================
RCS file: assignment.xfail
diff -N assignment.xfail
--- /dev/null	Tue May  5 13:32:27 1998
+++ assignment.xfail	Fri Dec 15 18:02:08 2000
@@ -0,0 +1,2 @@
+xfail-gcj
+xfail-gcjC
Index: libjava.compile/assignment_2.xfail
===================================================================
RCS file: assignment_2.xfail
diff -N assignment_2.xfail
--- /dev/null	Tue May  5 13:32:27 1998
+++ assignment_2.xfail	Fri Dec 15 18:02:08 2000
@@ -0,0 +1,2 @@
+xfail-gcj
+xfail-gcjC
Index: libjava.compile/inner_1.xfail
===================================================================
RCS file: inner_1.xfail
diff -N inner_1.xfail
--- /dev/null	Tue May  5 13:32:27 1998
+++ inner_1.xfail	Fri Dec 15 18:02:08 2000
@@ -0,0 +1 @@
+xfail-gcj
Index: libjava.compile/not_a_redef.xfail
===================================================================
RCS file: not_a_redef.xfail
diff -N not_a_redef.xfail
--- /dev/null	Tue May  5 13:32:27 1998
+++ not_a_redef.xfail	Fri Dec 15 18:02:08 2000
@@ -0,0 +1 @@
+no-link
Index: libjava.compile/static_2.xfail
===================================================================
RCS file: static_2.xfail
diff -N static_2.xfail
--- /dev/null	Tue May  5 13:32:27 1998
+++ static_2.xfail	Fri Dec 15 18:02:08 2000
@@ -0,0 +1 @@
+no-link
Index: libjava.compile/static_3.xfail
===================================================================
RCS file: static_3.xfail
diff -N static_3.xfail
--- /dev/null	Tue May  5 13:32:27 1998
+++ static_3.xfail	Fri Dec 15 18:02:08 2000
@@ -0,0 +1 @@
+no-link
Index: libjava.compile/weirddecl.xfail
===================================================================
RCS file: weirddecl.xfail
diff -N weirddecl.xfail
--- /dev/null	Tue May  5 13:32:27 1998
+++ weirddecl.xfail	Fri Dec 15 18:02:08 2000
@@ -0,0 +1,3 @@
+no-link
+xfail-gcj
+xfail-gcjC

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