This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
PATCH: testsuite cleanup
- From: Mark Mitchell <mark at codesourcery dot com>
- To: gcc-patches at gcc dot gnu dot org
- Cc: janis187 at us dot ibm dot com
- Date: Thu, 24 Mar 2005 20:14:51 -0800
- Subject: PATCH: testsuite cleanup
- Reply-to: mark at codesourcery dot com
This patch unifies code that had been copied into multiple language
files to deal with LD_LIBRARY_PATH. Tested on
x86_64-unknown-linux-gnu, but using a machine without multilib
support. Also, I could not test gfortran. So, if anyone has the
ability to test those two things, I would much appreciate it.
I plan to check this in tomorrow, if there are no objections, or
reports of failure, and assuming that I can get the other testing
done, either myself, or by a volunter.
--
Mark Mitchell
CodeSourcery, LLC
mark@codesourcery.com
2005-03-24 Mark Mitchell <mark@codesourcery.com>
* lib/g++.exp (g++_link_flags): Use gcc-set-multilib-library-path.
(g++_init): Make sure that CXXFLAGS is set.
* gcc-defs.exp (gcc-set-multilib-library-path): New function.
* gcc-dg.exp: Use gcc-set-multilib-library-path.
* gfortran.exp (gfortran_link_flags): Likewise.
* objc.exp (objc_init): Likewise.
* treelang.exp (treelang_init): Likewise.
Index: g++.exp
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/lib/g++.exp,v
retrieving revision 1.45
diff -c -5 -p -r1.45 g++.exp
*** g++.exp 8 Mar 2005 22:10:33 -0000 1.45
--- g++.exp 25 Mar 2005 04:08:08 -0000
*************** proc g++_include_flags { paths } {
*** 95,105 ****
# g++_link_flags -- provide new version of g++_link_flags
# (originally from libgloss.exp) which knows about the gcc tree structure
#
proc g++_link_flags { paths } {
- global rootme
global srcdir
global ld_library_path
global GXX_UNDER_TEST
set gccpath ${paths}
--- 95,104 ----
*************** proc g++_link_flags { paths } {
*** 127,151 ****
append flags "-L${gccpath}/libiberty "
}
if [file exists "${gccpath}/librx/librx.a"] {
append flags "-L${gccpath}/librx "
}
! append ld_library_path ":${rootme}"
! set compiler [lindex $GXX_UNDER_TEST 0]
! if { [is_remote host] == 0 && [which $compiler] != 0 } {
! foreach i "[exec $compiler --print-multi-lib]" {
! set mldir ""
! regexp -- "\[a-z0-9=/\.-\]*;" $i mldir
! set mldir [string trimright $mldir "\;@"]
! if { "$mldir" == "." } {
! continue
! }
! if { [llength [glob -nocomplain ${rootme}/${mldir}/libgcc_s*.so.*]] >= 1 } {
! append ld_library_path ":${rootme}/${mldir}"
! }
! }
! }
} else {
global tool_root_dir
set libgpp [lookfor_file ${tool_root_dir} libg++]
if { $libgpp != "" } {
--- 126,136 ----
append flags "-L${gccpath}/libiberty "
}
if [file exists "${gccpath}/librx/librx.a"] {
append flags "-L${gccpath}/librx "
}
! append ld_library_path [gcc-set-multilib-library-path $GXX_UNDER_TEST]
} else {
global tool_root_dir
set libgpp [lookfor_file ${tool_root_dir} libg++]
if { $libgpp != "" } {
*************** proc g++_init { args } {
*** 183,192 ****
--- 168,178 ----
global tmpdir
global libdir
global gluefile wrap_flags
global objdir srcdir
global ALWAYS_CXXFLAGS
+ global CXXFLAGS
global TOOL_EXECUTABLE TOOL_OPTIONS
global GXX_UNDER_TEST
global TESTING_IN_BUILD_TREE
global target_triplet
*************** proc g++_init { args } {
*** 225,234 ****
--- 211,224 ----
unset gluefile
}
g++_maybe_build_wrapper "${tmpdir}/g++-testglue.o"
+ if {![info exists CXXFLAGS]} {
+ set CXXFLAGS ""
+ }
+
set ALWAYS_CXXFLAGS ""
if ![is_remote host] {
if [info exists TOOL_OPTIONS] {
lappend ALWAYS_CXXFLAGS "additional_flags=[g++_include_flags [get_multilibs ${TOOL_OPTIONS}] ]"
Index: gcc-defs.exp
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/lib/gcc-defs.exp,v
retrieving revision 1.4
diff -c -5 -p -r1.4 gcc-defs.exp
*** gcc-defs.exp 8 Mar 2005 22:10:33 -0000 1.4
--- gcc-defs.exp 25 Mar 2005 04:08:08 -0000
*************** proc dg-additional-files-options { optio
*** 217,221 ****
--- 217,253 ----
}
}
return $options
}
+
+ # Return a colon-separate list of directories to search for libraries
+ # for COMPILER, including multilib directories.
+
+ proc gcc-set-multilib-library-path { compiler } {
+ global rootme
+
+ # ??? rootme will not be set when testing an installed compiler.
+ # In that case, we should perhaps use some other method to find
+ # libraries.
+ if {![info exists rootme]} {
+ return ""
+ }
+
+ set libpath ":${rootme}"
+ set compiler [lindex $compiler 0]
+ if { [is_remote host] == 0 && [which $compiler] != 0 } {
+ foreach i "[exec $compiler --print-multi-lib]" {
+ set mldir ""
+ regexp -- "\[a-z0-9=/\.-\]*;" $i mldir
+ set mldir [string trimright $mldir "\;@"]
+ if { "$mldir" == "." } {
+ continue
+ }
+ if { [llength [glob -nocomplain ${rootme}/${mldir}/libgcc_s*.so.*]] >= 1 } {
+ append libpath ":${rootme}/${mldir}"
+ }
+ }
+ }
+
+ return $libpath
+ }
Index: gcc-dg.exp
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/lib/gcc-dg.exp,v
retrieving revision 1.51
diff -c -5 -p -r1.51 gcc-dg.exp
*** gcc-dg.exp 8 Mar 2005 22:10:33 -0000 1.51
--- gcc-dg.exp 25 Mar 2005 04:08:08 -0000
*************** if ![info exists TORTURE_OPTIONS] {
*** 50,81 ****
global GCC_UNDER_TEST
if ![info exists GCC_UNDER_TEST] {
set GCC_UNDER_TEST "[find_gcc]"
}
- global rootme
- global ld_library_path
global orig_environment_saved
# This file may be sourced, so don't override environment settings
# that have been previously setup.
if { $orig_environment_saved == 0 } {
! set ld_library_path "${rootme}"
! set compiler [lindex $GCC_UNDER_TEST 0]
! if { [is_remote host] == 0 && [which $compiler] != 0 } {
! foreach i "[exec $compiler --print-multi-lib]" {
! set mldir ""
! regexp -- "\[a-z0-9=/\.-\]*;" $i mldir
! set mldir [string trimright $mldir "\;@"]
! if { "$mldir" == "." } {
! continue
! }
! if { [llength [glob -nocomplain ${rootme}/${mldir}/libgcc_s*.so.*]] >= 1 } {
! append ld_library_path ":${rootme}/${mldir}"
! }
! }
! }
set_ld_library_path_env_vars
}
# Split TORTURE_OPTIONS into two choices: one for testcases with loops and
# one for testcases without loops.
--- 50,65 ----
global GCC_UNDER_TEST
if ![info exists GCC_UNDER_TEST] {
set GCC_UNDER_TEST "[find_gcc]"
}
global orig_environment_saved
# This file may be sourced, so don't override environment settings
# that have been previously setup.
if { $orig_environment_saved == 0 } {
! append ld_library_path [gcc-set-multilib-library-path $GCC_UNDER_TEST]
set_ld_library_path_env_vars
}
# Split TORTURE_OPTIONS into two choices: one for testcases with loops and
# one for testcases without loops.
Index: gfortran.exp
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/lib/gfortran.exp,v
retrieving revision 1.10
diff -c -5 -p -r1.10 gfortran.exp
*** gfortran.exp 8 Mar 2005 22:10:34 -0000 1.10
--- gfortran.exp 25 Mar 2005 04:08:08 -0000
*************** proc gfortran_version { } {
*** 71,81 ****
# gfortran_link_flags -- provide new version of gfortran_link_flags
# (originally from libgloss.exp) which knows about the gcc tree structure
#
proc gfortran_link_flags { paths } {
- global rootme
global srcdir
global ld_library_path
global GFORTRAN_UNDER_TEST
set gccpath ${paths}
--- 71,80 ----
*************** proc gfortran_link_flags { paths } {
*** 92,116 ****
append flags "-L${gccpath}/libgfortran "
}
if [file exists "${gccpath}/libiberty/libiberty.a"] {
append flags "-L${gccpath}/libiberty "
}
! append ld_library_path ":${rootme}"
! set compiler [lindex $GFORTRAN_UNDER_TEST 0]
! if { [is_remote host] == 0 && [which $compiler] != 0 } {
! foreach i "[exec $compiler --print-multi-lib]" {
! set mldir ""
! regexp -- "\[a-z0-9=/\.-\]*;" $i mldir
! set mldir [string trimright $mldir "\;@"]
! if { "$mldir" == "." } {
! continue
! }
! if { [llength [glob -nocomplain ${rootme}/${mldir}/libgcc_s*.so.*]] >= 1 } {
! append ld_library_path ":${rootme}/${mldir}"
! }
! }
! }
}
set_ld_library_path_env_vars
return "$flags"
--- 91,102 ----
append flags "-L${gccpath}/libgfortran "
}
if [file exists "${gccpath}/libiberty/libiberty.a"] {
append flags "-L${gccpath}/libiberty "
}
! append ld_library_path \
! [gcc-set-multilib-library-path $GFORTRAN_UNDER_TEST]
}
set_ld_library_path_env_vars
return "$flags"
Index: objc.exp
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/lib/objc.exp,v
retrieving revision 1.31
diff -c -5 -p -r1.31 objc.exp
*** objc.exp 8 Mar 2005 22:10:34 -0000 1.31
--- objc.exp 25 Mar 2005 04:08:08 -0000
*************** proc objc_init { args } {
*** 113,137 ****
set tmpdir /tmp
}
objc_maybe_build_wrapper "${tmpdir}/objc-testglue.o"
! set objc_libgcc_s_path "${rootme}"
! set compiler [lindex $OBJC_UNDER_TEST 0]
! if { [is_remote host] == 0 && [which $compiler] != 0 } {
! foreach i "[exec $compiler --print-multi-lib]" {
! set mldir ""
! regexp -- "\[a-z0-9=/\.-\]*;" $i mldir
! set mldir [string trimright $mldir "\;@"]
! if { "$mldir" == "." } {
! continue
! }
! if { [llength [glob -nocomplain ${rootme}/${mldir}/libgcc_s*.so.*]] >= 1 } {
! append objc_libgcc_s_path ":${rootme}/${mldir}"
! }
! }
! }
}
proc objc_target_compile { source dest type options } {
global rootme
global tmpdir
--- 113,123 ----
set tmpdir /tmp
}
objc_maybe_build_wrapper "${tmpdir}/objc-testglue.o"
! append objc_libgcc_s_path [gcc-set-multilib-library-path $OBJC_UNDER_TEST]
}
proc objc_target_compile { source dest type options } {
global rootme
global tmpdir
Index: treelang.exp
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/lib/treelang.exp,v
retrieving revision 1.10
diff -c -5 -p -r1.10 treelang.exp
*** treelang.exp 8 Mar 2005 22:10:34 -0000 1.10
--- treelang.exp 25 Mar 2005 04:08:08 -0000
*************** proc default_treelang_version { } {
*** 82,92 ****
#
set treelang_initialized 0
proc treelang_init { args } {
- global rootme
global tmpdir
global libdir
global gluefile wrap_flags
global treelang_initialized
global TREELANG_UNDER_TEST
--- 82,91 ----
*************** proc treelang_init { args } {
*** 113,137 ****
set tmpdir /tmp
}
treelang_maybe_build_wrapper "${tmpdir}/treelang-testglue.o"
! set treelang_libgcc_s_path "${rootme}"
! set compiler [lindex $TREELANG_UNDER_TEST 0]
! if { [is_remote host] == 0 && [which $compiler] != 0 } {
! foreach i "[exec $compiler --print-multi-lib]" {
! set mldir ""
! regexp -- "\[a-z0-9=/\.-\]*;" $i mldir
! set mldir [string trimright $mldir "\;@"]
! if { "$mldir" == "." } {
! continue
! }
! if { [llength [glob -nocomplain ${rootme}/${mldir}/libgcc_s*.so.*]] >= 1 } {
! append treelang_libgcc_s_path ":${rootme}/${mldir}"
! }
! }
! }
}
proc treelang_target_compile { source dest type options } {
global rootme
global tmpdir
--- 112,123 ----
set tmpdir /tmp
}
treelang_maybe_build_wrapper "${tmpdir}/treelang-testglue.o"
! set treelang_libgcc_s_path \
! [gcc-set-multilib-library-path $TREELANG_UNDER_TEST]
}
proc treelang_target_compile { source dest type options } {
global rootme
global tmpdir