This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
[patch] cxxtest compilation/test fix
- From: Andreas Tobler <toa at pop dot agri dot ch>
- To: Bryce McKinlay <mckinlay at redhat dot com>, Java Patch List <java-patches at gcc dot gnu dot org>
- Date: Sun, 09 May 2004 16:39:38 +0200
- Subject: [patch] cxxtest compilation/test fix
Hi Bryce,
as mentioned on IRC, the cxxtest fails for me on ppclinux and solaris.
Well on solaris it did only fail halfway :)
(on solaris I had a LD_LIBRARY_PATH set to an old libstdc++)
The reason is, afaics, this statement:
..
foreach arg [split [libjava_find_lib libstdc++-v3/src stdc++] " "
..
..
# Strip the `.libs' directory; we link with libtool which
# doesn't need it.
..
Here we find the libstdc++.la, the libtool wrapper for libstdc++.so. In
my environment this .la points to /var/tmp/lib where I would install my
gcc build if I did :) But I did not. So it does not find any suitable
libstdc++. It would find it, if I ever installed a gcc build into
install path. (tested as well)
So now I have the question, do we have to install a build before testing
it?
If not, I could make the test successful on both, linuxppc and solaris
multilib with the appended patch.
Any thoughts/corrections?
Regards,
Andreas
Index: lib/libjava.exp
===================================================================
RCS file: /cvs/gcc/gcc/libjava/testsuite/lib/libjava.exp,v
retrieving revision 1.57
diff -u -r1.57 libjava.exp
--- lib/libjava.exp 12 Jan 2004 21:19:26 -0000 1.57
+++ lib/libjava.exp 9 May 2004 14:27:26 -0000
@@ -495,7 +495,21 @@
# Invoke a program and check its output. EXECUTABLE is the program;
# ARGS are the arguments to the program. Returns 1 if tests passed
# (or things were left untested), 0 otherwise.
-proc libjava_invoke {errname testName optName executable inpfile resultfile args} {
+proc libjava_invoke {errname testName optName executable inpfile resultfile
+ ld_library_additions args} {
+ global env
+ set lib_path $env(LD_LIBRARY_PATH)
+
+ set newval .
+ if {[llength $ld_library_additions] > 0} {
+ append newval :[join $ld_library_additions :]
+ }
+
+ append newval :$lib_path
+
+ setenv LD_LIBRARY_PATH $newval
+
+ verbose "LD_LIBRARY_PATH=$env(LD_LIBRARY_PATH)"
upvar $optName opts
if {[info exists opts(no-exec)]} {
@@ -512,6 +526,10 @@
set result [libjava_load $executable $args "$inpfile"]
set status [lindex $result 0]
set output [lindex $result 1]
+
+ # Restore LD_LIBRARY_PATH setting.
+ setenv LD_LIBRARY_PATH $lib_path
+
if {[info exists opts(xfail-exec)]} then {
setup_xfail *-*-*
}
@@ -658,7 +676,7 @@
set opts(xfail-output) x
}
if {[libjava_invoke $errname "source compiled test" opts $executable \
- $inpfile $resultfile]} {
+ $inpfile $resultfile ""]} {
# Everything ok, so clean up.
eval gcj_cleanup $removeList
}
@@ -796,7 +814,7 @@
# program; in this case we want to skip the test.
if {$INTERPRETER == "yes" && $gij != "gij"} {
libjava_invoke $errname "gij test" opts $gij \
- $inpfile $resultfile $main_name
+ $inpfile $resultfile "" $main_name
}
# Initial arguments.
@@ -859,7 +877,7 @@
set opts(xfail-output) x
}
if {[libjava_invoke $errname "bytecode->native test" opts $executable \
- $inpfile $resultfile]} {
+ $inpfile $resultfile ""]} {
# Everything ok, so clean up.
eval gcj_cleanup $removeList
}
Index: libjava.jni/jni.exp
===================================================================
RCS file: /cvs/gcc/gcc/libjava/testsuite/libjava.jni/jni.exp,v
retrieving revision 1.14
diff -u -r1.14 jni.exp
--- libjava.jni/jni.exp 7 May 2004 14:59:43 -0000 1.14
+++ libjava.jni/jni.exp 9 May 2004 14:27:26 -0000
@@ -126,6 +126,9 @@
}
}
lappend cxxflaglist $arg
+ # In case the libstdc++ is not installed yet, we pass the build
+ # directory of it to the cxxflaglist.
+ lappend cxxflaglist "-L$cxxldlibflags"
}
lappend cxxflaglist "-lstdc++"
@@ -149,17 +152,19 @@
# FIXME
return 0
}
-
+
# We purposely ignore errors here; we still want to run the other
# appropriate tests.
set errname [file rootname [file tail $file]]
set gij [libjava_find_gij]
# libjava_find_gij will return `gij' if it couldn't find the
# program; in this case we want to skip the test.
- if {$INTERPRETER == "yes" && $gij != "gij"} {
- libjava_invoke $errname "gij test" opts $gij \
- "" $resultfile $main
- }
+ # If the libraries are not installed yet, we have to pass them via
+ # cxxldlibflags to libjava_invoke.
+ if {$INTERPRETER == "yes" && $gij != "gij"} {
+ libjava_invoke $errname "gij test" opts $gij \
+ "" $resultfile $cxxldlibflags $main
+ }
# When we succeed we remove all our clutter.
eval gcj_cleanup [glob -nocomplain -- ${main}.*] [list $main lib${main}.${so_extension}]
Index: libjava.jar/jar.exp
===================================================================
RCS file: /cvs/gcc/gcc/libjava/testsuite/libjava.jar/jar.exp,v
retrieving revision 1.2
diff -u -r1.2 jar.exp
--- libjava.jar/jar.exp 18 Nov 2003 07:17:01 -0000 1.2
+++ libjava.jar/jar.exp 9 May 2004 14:27:26 -0000
@@ -31,7 +31,7 @@
set opts(_) {}
set out [file rootname $jarfile].out
libjava_invoke $jarfile "gij test" opts $gij {} $out \
- -jar $jarfile
+ "" -jar $jarfile
}
proc gcj_jar_run {} {