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]

Patch: test suite -vs- threads


I'm checking this in on the trunk and the branch.
With this patch, the thread tests will turn up `unresolved' when the
runtime is configured without thread support.
This lets us preserve 0 FAIL in any configuration.

2001-05-03  Tom Tromey  <tromey@redhat.com>

	* libjava.lang/Thread_Wait_Interrupt.xfail: New file.
	* libjava.lang/Thread_Wait_2.xfail: New file.
	* libjava.lang/Thread_Wait.xfail: New file.
	* libjava.lang/Thread_Sleep.xfail: New file.
	* libjava.lang/Thread_Monitor.xfail: New file.
	* libjava.lang/Thread_Join.xfail: New file.
	* libjava.lang/Thread_Interrupt.xfail: New file.
	* libjava.lang/Thread_Alive.xfail: New file.
	* lib/libjava.exp (libjava_init): Set global
	libjava_uses_threads.
	(test_libjava): Document `need-threads' tag.
	(test_libjava_from_source): handle need-threads tag.
	(test_libjava_from_javac): Likewise.

Tom

Index: lib/libjava.exp
===================================================================
RCS file: /cvs/gcc/gcc/libjava/testsuite/lib/libjava.exp,v
retrieving revision 1.22.4.3
diff -u -r1.22.4.3 libjava.exp
--- libjava.exp	2001/04/27 00:56:43	1.22.4.3
+++ libjava.exp	2001/05/04 19:30:12
@@ -107,11 +107,11 @@
 proc libjava_init { args } {
     global wrapper_file;
     global wrap_compile_flags;
-    global libjava_initialized
+    global libjava_initialized libjava_uses_threads
     global GCJ_UNDER_TEST
     global TOOL_EXECUTABLE
     global original_ld_library_path
-    global env
+    global env objdir
 
     if { $libjava_initialized == 1 } { return; }
 
@@ -127,6 +127,13 @@
 	}
     }
 
+    # The -B is so we find libgcj.spec.
+    set text [eval exec "$GCJ_UNDER_TEST -B$objdir/../ -v 2>@ stdout"]
+    regexp -- "Thread model: (\[^\n\]+)\n" $text ignore model
+    set libjava_uses_threads [expr {! ($model == "no"
+				       || $model == "none"
+				       || $model == "single")}]
+
     # Always set encoding used by gcj.
     append GCJ_UNDER_TEST " --encoding=UTF-8"
 
@@ -331,6 +338,15 @@
 	set opts($item) x
     }
 
+    # If we need threads and we don't have them then set the `no-exec'
+    # flag.  This is case is also handled specially later.
+    if {[info exists opts(need-threads)]} {
+	global libjava_uses_threads
+	if {! $libjava_uses_threads} {
+	    set opts(no-exec) x
+	}
+    }
+
     set errname [file rootname [file tail $srcfile]]
     if {! [runtest_file_p $runtests $errname]} {
         return
@@ -376,7 +392,9 @@
 	}
 
 	fail "$errname compilation from source"
-	if {[info exists opts(xfail-gcj)] || ! [info exists opts(no-exec)]} {
+	if {[info exists opts(xfail-gcj)]
+	    || ! [info exists opts(no-exec)]
+	    || [info exists opts(need-threads)]} {
 	    untested "$errname execution from source compiled test"
 	    untested "$errname output from source compiled test"
 	}
@@ -388,10 +406,19 @@
     }
     pass "$errname compilation from source"
 
-    if {[info exists opts(no-exec)]
-	|| [info exists opts(no-link)]} {
+    if {[info exists opts(no-exec)]} {
+	if {[info exists opts(need-threads)]} {
+	    # This means we wanted to try to run it but we couldn't
+	    # because threads aren't supported.  So we have to
+	    # generate an `untested'.
+	    untested "$errname execution from source compiled test"
+	    untested "$errname output from source compiled test"
+	}
 	return
     }
+    if {[info exists opts(no-link)]} {
+	return
+    }
 
     set result [libjava_load $executable "" "$inpfile"];
     set status [lindex $result 0];
@@ -464,6 +491,14 @@
 	set opts($item) x
     }
 
+    # If we need threads and we don't have them then set the `no-exec'
+    # flag.  This is case is also handled specially later.
+    if {[info exists opts(need-threads)]} {
+	global libjava_uses_threads
+	if {! $libjava_uses_threads} {
+	    set opts(no-exec) x
+	}
+    }
     set errname [file rootname [file tail $srcfile]]
     if {! [runtest_file_p $runtests $errname]} {
         return
@@ -489,7 +524,8 @@
 	}
 	fail "$errname byte compilation"
 	untested "$errname compilation from bytecode"
-	if {! [info exists opts(no-exec)]} {
+	if {! [info exists opts(no-exec)]
+	    || [info exists opts(need-threads)]} {
 	    untested "$errname execution from bytecode->native test"
 	    untested "$errname output from bytecode->native test"
 	}
@@ -521,7 +557,8 @@
     if {[string match "*parse error*" $main_name]
 	|| [string match "*parse error*" $class_out]} {
 	untested "$errname compilation from bytecode"
-	if {! [info exists opts(no-exec)]} {
+	if {! [info exists opts(no-exec)]
+	    || [info exists opts(need-threads)]} {
 	    untested "$errname execution from bytecode->native test"
 	    untested "$errname output from bytecode->native test"
 	}
@@ -599,7 +636,8 @@
     if { $x != "" } {
 	verbose "target_compile failed: $x" 2
 	fail "$errname compilation from bytecode"
-	if {! [info exists opts(no-exec)]} {
+	if {! [info exists opts(no-exec)]
+	    || [info exists opts(need-threads)]} {
 	    untested "$errname execution from bytecode->native test"
 	    untested "$errname output from bytecode->native test"
 	}
@@ -608,6 +646,10 @@
     pass "$errname compilation from bytecode"
 
     if {[info exists opts(no-exec)]} {
+	if {[info exists opts(need-threads)]} {
+	    untested "$errname execution from bytecode->native test"
+	    untested "$errname output from bytecode->native test"
+	}
 	return
     }
 
@@ -676,7 +718,10 @@
 #                 front end.
 #   `xfail-byte'  compilation from bytecode will fail
 #   `xfail-exec'  exec will fail
-#   `xfail-output' output will be wrong
+#   `xfail-output'
+#                 output will be wrong
+#   `need-threads'
+#                 test relies on thread support
 #
 proc test_libjava { options srcfile compile_args inpfile resultfile exec_args } {
     test_libjava_from_source $options $srcfile $compile_args $inpfile $resultfile $exec_args
Index: libjava.lang/Thread_Alive.xfail
===================================================================
RCS file: Thread_Alive.xfail
diff -N Thread_Alive.xfail
--- /dev/null	Tue May  5 13:32:27 1998
+++ Thread_Alive.xfail	Fri May  4 12:30:12 2001
@@ -0,0 +1 @@
+need-threads
Index: libjava.lang/Thread_Interrupt.xfail
===================================================================
RCS file: Thread_Interrupt.xfail
diff -N Thread_Interrupt.xfail
--- /dev/null	Tue May  5 13:32:27 1998
+++ Thread_Interrupt.xfail	Fri May  4 12:30:12 2001
@@ -0,0 +1 @@
+need-threads
Index: libjava.lang/Thread_Join.xfail
===================================================================
RCS file: Thread_Join.xfail
diff -N Thread_Join.xfail
--- /dev/null	Tue May  5 13:32:27 1998
+++ Thread_Join.xfail	Fri May  4 12:30:12 2001
@@ -0,0 +1 @@
+need-threads
Index: libjava.lang/Thread_Monitor.xfail
===================================================================
RCS file: Thread_Monitor.xfail
diff -N Thread_Monitor.xfail
--- /dev/null	Tue May  5 13:32:27 1998
+++ Thread_Monitor.xfail	Fri May  4 12:30:12 2001
@@ -0,0 +1 @@
+need-threads
Index: libjava.lang/Thread_Sleep.xfail
===================================================================
RCS file: Thread_Sleep.xfail
diff -N Thread_Sleep.xfail
--- /dev/null	Tue May  5 13:32:27 1998
+++ Thread_Sleep.xfail	Fri May  4 12:30:12 2001
@@ -0,0 +1 @@
+need-threads
Index: libjava.lang/Thread_Wait.xfail
===================================================================
RCS file: Thread_Wait.xfail
diff -N Thread_Wait.xfail
--- /dev/null	Tue May  5 13:32:27 1998
+++ Thread_Wait.xfail	Fri May  4 12:30:12 2001
@@ -0,0 +1 @@
+need-threads
Index: libjava.lang/Thread_Wait_2.xfail
===================================================================
RCS file: Thread_Wait_2.xfail
diff -N Thread_Wait_2.xfail
--- /dev/null	Tue May  5 13:32:27 1998
+++ Thread_Wait_2.xfail	Fri May  4 12:30:12 2001
@@ -0,0 +1 @@
+need-threads
Index: libjava.lang/Thread_Wait_Interrupt.xfail
===================================================================
RCS file: Thread_Wait_Interrupt.xfail
diff -N Thread_Wait_Interrupt.xfail
--- /dev/null	Tue May  5 13:32:27 1998
+++ Thread_Wait_Interrupt.xfail	Fri May  4 12:30:12 2001
@@ -0,0 +1 @@
+need-threads


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