PATCH: Make ld testsuite usable outside build directory

Mark Mitchell mark@codesourcery.com
Thu Mar 24 14:45:00 GMT 2005


At present, the ld testsuite does not work on an installed linker due
to two minor problems:

1. The testsuite wants to read tmpdir/libpath.exp, which is generated
   by the Makefiles, but obviously not available when testing outside
   of the build directory.  Since the point of testing an installed
   toolchain is to see if it works by itself, this list of explict -L
   options is unncessary in that situation.

2. Several test scripts check [which $CC] to see if there's a compiler
   available.  That depends on the fact that "make check" passes in
   "CC=$(CC_FOR_TARGET)".  Users who run with "runtest" directly won't
   have CC set; this should be treated just like the case where there
   is no available compiler.

   (I think a further improvement would be to actually look for a
   compiler, using [transform gcc].  If people agree that this is a
   good idea, I can add that.)

Tested with an arm-linux toolchain.  OK?

--
Mark Mitchell
CodeSourcery, LLC
mark@codesourcery.com

2005-03-23  Mark Mitchell  <mark@codesourcery.com>

	* config/default.exp: Do not load libpath.exp if it does not
	exist.
	* ld-elfcomm/elfcomm.exp: Do not use CC if it does not exist.
	* ld-scripts/crossref.exp: Likewise.
	* ld-srec/srec.exp: Likewise.
	* ld-undefined/undefined.exp: Likewise.

Index: config/default.exp
===================================================================
RCS file: /home/cvs/Repository/binutils/ld/testsuite/config/default.exp,v
retrieving revision 1.1.5.1
diff -c -5 -p -r1.1.5.1 default.exp
*** config/default.exp	26 Nov 2003 04:18:08 -0000	1.1.5.1
--- config/default.exp	24 Mar 2005 03:36:57 -0000
*************** if {![file isdirectory tmpdir/ld]} then 
*** 68,81 ****
      catch "exec ln -s ../../ld-new tmpdir/ld/ld" status
  }
  set gcc_ld_flag "-B[pwd]/tmpdir/ld/"
  
  # load the linker path
! load_lib tmpdir/libpath.exp
  
! foreach dir $libpath {
!     set gcc_ld_flag "$gcc_ld_flag -L$dir"
  }
  
  # The mips64-*-linux-gnu compiler defaults to the N32 ABI after
  # installed, but to the O32 ABI in the build tree, because of some
  # specs-file hacks.  Make sure we use an ABI that is compatible with
--- 68,83 ----
      catch "exec ln -s ../../ld-new tmpdir/ld/ld" status
  }
  set gcc_ld_flag "-B[pwd]/tmpdir/ld/"
  
  # load the linker path
! if {[file exists tmpdir/libpath.exp]} {
!     load_lib tmpdir/libpath.exp
  
!     foreach dir $libpath {
! 	set gcc_ld_flag "$gcc_ld_flag -L$dir"
!     }
  }
  
  # The mips64-*-linux-gnu compiler defaults to the N32 ABI after
  # installed, but to the O32 ABI in the build tree, because of some
  # specs-file hacks.  Make sure we use an ABI that is compatible with
Index: ld-elfcomm/elfcomm.exp
===================================================================
RCS file: /home/cvs/Repository/binutils/ld/testsuite/ld-elfcomm/elfcomm.exp,v
retrieving revision 1.1.5.1
diff -c -5 -p -r1.1.5.1 elfcomm.exp
*** ld-elfcomm/elfcomm.exp	26 Nov 2003 04:18:09 -0000	1.1.5.1
--- ld-elfcomm/elfcomm.exp	24 Mar 2005 03:36:57 -0000
*************** set test1	"size/aligment change of commo
*** 29,39 ****
  set test1w1	"$test1 (warning 1)"
  set test1w2	"$test1 (warning 2)"
  set test1c1	"$test1 (change 1)"
  set test1c2	"$test1 (change 2)"
  
! if { [which $CC] == 0 } {
      untested $test1w1
      untested $test1w2
      untested $test1c1
      untested $test1c2
      return
--- 29,39 ----
  set test1w1	"$test1 (warning 1)"
  set test1w2	"$test1 (warning 2)"
  set test1c1	"$test1 (change 1)"
  set test1c2	"$test1 (change 2)"
  
! if { ![info exists CC] || [which $CC] == 0 } {
      untested $test1w1
      untested $test1w2
      untested $test1c1
      untested $test1c2
      return
Index: ld-scripts/crossref.exp
===================================================================
RCS file: /home/cvs/Repository/binutils/ld/testsuite/ld-scripts/crossref.exp,v
retrieving revision 1.1.5.2
diff -c -5 -p -r1.1.5.2 crossref.exp
*** ld-scripts/crossref.exp	17 Jan 2005 03:28:41 -0000	1.1.5.2
--- ld-scripts/crossref.exp	24 Mar 2005 03:36:57 -0000
***************
*** 18,28 ****
  # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  
  set test1 "NOCROSSREFS 1"
  set test2 "NOCROSSREFS 2"
  
! if { [which $CC] == 0 } {
      untested $test1
      untested $test2
      return
  }
  
--- 18,28 ----
  # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  
  set test1 "NOCROSSREFS 1"
  set test2 "NOCROSSREFS 2"
  
! if { ![info exists CC] || [which $CC] == 0 } {
      untested $test1
      untested $test2
      return
  }
  
Index: ld-srec/srec.exp
===================================================================
RCS file: /home/cvs/Repository/binutils/ld/testsuite/ld-srec/srec.exp,v
retrieving revision 1.1.5.2
diff -c -5 -p -r1.1.5.2 srec.exp
*** ld-srec/srec.exp	17 Jan 2005 03:28:41 -0000	1.1.5.2
--- ld-srec/srec.exp	24 Mar 2005 03:36:57 -0000
*************** set sizeof_headers [string match "*SIZEO
*** 332,342 ****
  # First test linking a C program.  We don't require any libraries.  We
  # link it normally, and objcopy to the S-record format, and then link
  # directly to the S-record format, and require that the two files
  # contain the same data.
  
! if { [which $CC] == 0 } {
      untested $test1
      untested $test2
      return
  }
  
--- 332,342 ----
  # First test linking a C program.  We don't require any libraries.  We
  # link it normally, and objcopy to the S-record format, and then link
  # directly to the S-record format, and require that the two files
  # contain the same data.
  
! if { ![info exists CC] || [which $CC] == 0 } {
      untested $test1
      untested $test2
      return
  }
  
Index: ld-undefined/undefined.exp
===================================================================
RCS file: /home/cvs/Repository/binutils/ld/testsuite/ld-undefined/undefined.exp,v
retrieving revision 1.1.5.2
diff -c -5 -p -r1.1.5.2 undefined.exp
*** ld-undefined/undefined.exp	17 Jan 2005 03:28:41 -0000	1.1.5.2
--- ld-undefined/undefined.exp	24 Mar 2005 03:36:57 -0000
***************
*** 20,30 ****
  
  set testund "undefined"
  set testfn "undefined function"
  set testline "undefined line"
  
! if { [which $CC] == 0 } {
      verbose "Could not find C compiler!" 1
      untested $testund
      untested $testfn
      untested $testline
      return
--- 20,30 ----
  
  set testund "undefined"
  set testfn "undefined function"
  set testline "undefined line"
  
! if { ![info exists CC] || [which $CC] == 0 } {
      verbose "Could not find C compiler!" 1
      untested $testund
      untested $testfn
      untested $testline
      return



More information about the Binutils mailing list