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: FYI: test suite bug fix


I'm checking this in on the trunk and the branch.

This fixes a test suite bug that caused a spurious JNI test failure.

Tom

Index: ChangeLog
from  Tom Tromey  <tromey@redhat.com>

	* libjava.jni/jni.exp (gcj_jni_test_one): Find libstdc++ in build
	tree.
	(gcj_invoke): Added ld_library_additions argument.

Index: libjava.jni/jni.exp
===================================================================
RCS file: /cvs/gcc/gcc/libjava/testsuite/libjava.jni/jni.exp,v
retrieving revision 1.4.8.1
diff -u -r1.4.8.1 jni.exp
--- libjava.jni/jni.exp 2002/03/17 20:35:41 1.4.8.1
+++ libjava.jni/jni.exp 2002/03/18 21:37:44
@@ -43,12 +43,19 @@
 }
 
 # Invoke the program and see what happens.  Return 0 on failure.
-proc gcj_invoke {program expectFile} {
+proc gcj_invoke {program expectFile ld_library_additions} {
   global env
   set lib_path $env(LD_LIBRARY_PATH)
-  setenv LD_LIBRARY_PATH .:$lib_path
-  setenv SHLIB_PATH .:$lib_path
 
+  set newval .
+  if {[llength $ld_library_additions] > 0} {
+    append newval :[join $ld_library_additions :]
+  }
+  append newval :$lib_path
+
+  setenv LD_LIBRARY_PATH $newval
+  setenv SHLIB_PATH $newval
+
   verbose "LD_LIBRARY_PATH=$env(LD_LIBRARY_PATH)"
 
   set result [libjava_load ./$program]
@@ -106,10 +113,27 @@
 
   set cfile [file rootname $file].c
   set cxxflags ""
+  set cxxldlibflags {}
   # If there is no `.c' file, assume there is a `.cc' file.
   if {! [file exists $cfile]} {
     set cfile [file rootname $file].cc
-    set cxxflags "-lstdc++"
+
+    set cxxflaglist {}
+    foreach arg [split [libjava_find_lib libstdc++-v3/src stdc++] " "] {
+      switch -glob -- $arg {
+	"-L*" {
+	  set arg [string range $arg 2 end]
+	  lappend cxxldlibflags $arg
+	  # Strip the `.libs' directory; we link with libtool which
+	  # doesn't need it.
+	  set arg "-L[file dirname $arg]"
+	}
+      }
+      lappend cxxflaglist $arg
+    }
+
+    lappend cxxflaglist "-lstdc++"
+    set cxxflags [join $cxxflaglist]
   }
 
   if {! [gcj_jni_compile_c_to_so $cfile]} {
@@ -125,7 +149,7 @@
     return 0
   }
 
-  if {! [gcj_invoke $main [file rootname $file].out]} {
+  if {! [gcj_invoke $main [file rootname $file].out $cxxldlibflags]} {
     # FIXME
     return 0
   }


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