aboutsummaryrefslogtreecommitdiff
path: root/ld
diff options
context:
space:
mode:
authorBob Manson <manson@cygnus>1997-01-29 09:40:31 +0000
committerBob Manson <manson@cygnus>1997-01-29 09:40:31 +0000
commit787f6220773d9174a9675dedd3bbfc8f070511a6 (patch)
tree64911c10d46bc93973cc825a730b4173b3367a49 /ld
parent1a2faf1f1e335ff32c1d8c5c7675cd7ce9055e33 (diff)
downloadbinutils-787f6220773d9174a9675dedd3bbfc8f070511a6.zip
binutils-787f6220773d9174a9675dedd3bbfc8f070511a6.tar.gz
binutils-787f6220773d9174a9675dedd3bbfc8f070511a6.tar.bz2
Major revision to testsuites for cross-testing and DOS testing support.
Diffstat (limited to 'ld')
-rw-r--r--ld/testsuite/ld-cdtest/cdtest.exp26
-rw-r--r--ld/testsuite/ld-empic/empic.exp22
-rw-r--r--ld/testsuite/ld-sh/sh.exp143
-rw-r--r--ld/testsuite/lib/ld.exp4
4 files changed, 172 insertions, 23 deletions
diff --git a/ld/testsuite/ld-cdtest/cdtest.exp b/ld/testsuite/ld-cdtest/cdtest.exp
index 68be616..8faeff4 100644
--- a/ld/testsuite/ld-cdtest/cdtest.exp
+++ b/ld/testsuite/ld-cdtest/cdtest.exp
@@ -13,7 +13,7 @@
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
# Written by Jeffrey Wheat (cassidy@cygnus.com)
# Rewritten by Ian Lance Taylor (ian@cygnus.com)
@@ -29,9 +29,15 @@ if ![isnative] {
return
}
-if { ![ld_compile "$CXX $CXXFLAGS -fgnu-linker" $srcdir$subdir/cdtest-foo.cc tmpdir/cdtest-foo.o]
- || ![ld_compile "$CXX $CXXFLAGS -fgnu-linker" $srcdir$subdir/cdtest-bar.cc tmpdir/cdtest-bar.o]
- || ![ld_compile "$CXX $CXXFLAGS -fgnu-linker" $srcdir$subdir/cdtest-main.cc tmpdir/cdtest-main.o] } {
+if { [which $CXX] == 0 } {
+ untested $test1
+ untested $test2
+ return
+}
+
+if { ![ld_compile "$CXX $CXXFLAGS -fgnu-linker" $srcdir/$subdir/cdtest-foo.cc tmpdir/cdtest-foo.o]
+ || ![ld_compile "$CXX $CXXFLAGS -fgnu-linker" $srcdir/$subdir/cdtest-bar.cc tmpdir/cdtest-bar.o]
+ || ![ld_compile "$CXX $CXXFLAGS -fgnu-linker" $srcdir/$subdir/cdtest-main.cc tmpdir/cdtest-main.o] } {
unresolved $test1
unresolved $test2
return
@@ -48,9 +54,9 @@ if ![ld_link $ld tmpdir/cdtest {tmpdir/cdtest-foo.o tmpdir/cdtest-bar.o tmpdir/c
verbose "$exec_output" 1
fail $test1
} else {
- send_log "diff tmpdir/cdtest.out $srcdir$subdir/cdtest.dat\n"
- verbose "diff tmpdir/cdtest.out $srcdir$subdir/cdtest.dat"
- catch "exec diff tmpdir/cdtest.out $srcdir$subdir/cdtest.dat" exec_output
+ send_log "diff tmpdir/cdtest.out $srcdir/$subdir/cdtest.dat\n"
+ verbose "diff tmpdir/cdtest.out $srcdir/$subdir/cdtest.dat"
+ catch "exec diff tmpdir/cdtest.out $srcdir/$subdir/cdtest.dat" exec_output
set exec_output [prune_system_crud $host_triplet $exec_output]
if [string match "" $exec_output] then {
@@ -77,9 +83,9 @@ if ![ld_relocate $ld tmpdir/cdtest.o {-Ur tmpdir/cdtest-foo.o tmpdir/cdtest-bar.
verbose "$exec_output" 1
fail $test2
} else {
- send_log "diff tmpdir/cdtest.out $srcdir$subdir/cdtest.dat\n"
- verbose "diff tmpdir/cdtest.out $srcdir$subdir/cdtest.dat"
- catch "exec diff tmpdir/cdtest.out $srcdir$subdir/cdtest.dat" exec_output
+ send_log "diff tmpdir/cdtest.out $srcdir/$subdir/cdtest.dat\n"
+ verbose "diff tmpdir/cdtest.out $srcdir/$subdir/cdtest.dat"
+ catch "exec diff tmpdir/cdtest.out $srcdir/$subdir/cdtest.dat" exec_output
set exec_output [prune_system_crud $host_triplet $exec_output]
if [string match "" $exec_output] then {
diff --git a/ld/testsuite/ld-empic/empic.exp b/ld/testsuite/ld-empic/empic.exp
index 97cb72f..9f3866d 100644
--- a/ld/testsuite/ld-empic/empic.exp
+++ b/ld/testsuite/ld-empic/empic.exp
@@ -38,15 +38,15 @@ if { [which $CC] == 0 } {
# (by experimentation) to force the linker to relax twice--that is,
# the first relaxation pass will force another call to be out of
# range, requiring a second relaxation pass.
-if { ![ld_compile "$CC $CFLAGS -membedded-pic" $srcdir$subdir/relax1.c tmpdir/relax1.o]
- || ![ld_compile "$CC $CFLAGS -membedded-pic" $srcdir$subdir/relax2.c tmpdir/relax2.o]
- || ![ld_compile "$CC $CFLAGS -membedded-pic" $srcdir$subdir/relax3.c tmpdir/relax3.o]
- || ![ld_compile "$CC $CFLAGS -membedded-pic" $srcdir$subdir/relax4.c tmpdir/relax4.o] } {
+if { ![ld_compile "$CC $CFLAGS -membedded-pic" $srcdir/$subdir/relax1.c tmpdir/relax1.o]
+ || ![ld_compile "$CC $CFLAGS -membedded-pic" $srcdir/$subdir/relax2.c tmpdir/relax2.o]
+ || ![ld_compile "$CC $CFLAGS -membedded-pic" $srcdir/$subdir/relax3.c tmpdir/relax3.o]
+ || ![ld_compile "$CC $CFLAGS -membedded-pic" $srcdir/$subdir/relax4.c tmpdir/relax4.o] } {
unresolved $testname
return
}
-if ![ld_simple_link $ld tmpdir/relax "--relax -T $srcdir$subdir/relax.t tmpdir/relax1.o tmpdir/relax2.o tmpdir/relax3.o tmpdir/relax4.o"] {
+if ![ld_simple_link $ld tmpdir/relax "--relax -T $srcdir/$subdir/relax.t tmpdir/relax1.o tmpdir/relax2.o tmpdir/relax3.o tmpdir/relax4.o"] {
fail $testname
} else {
# Check that the relaxation produced the correct result. Check
@@ -227,9 +227,9 @@ set testname "run embedded PIC code"
# Compile the program which will run the test. This code must be
# compiled for the host, not the target.
-send_log "$CC_FOR_HOST $CFLAGS_FOR_HOST -o tmpdir/run $srcdir$subdir/run.c\n"
-verbose "$CC_FOR_HOST $CFLAGS_FOR_HOST -o tmpdir/run $srcdir$subdir/run.c"
-catch "exec $CC_FOR_HOST $CFLAGS_FOR_HOST -o tmpdir/run $srcdir$subdir/run.c" exec_output
+send_log "$CC_FOR_HOST $CFLAGS_FOR_HOST -o tmpdir/run $srcdir/$subdir/run.c\n"
+verbose "$CC_FOR_HOST $CFLAGS_FOR_HOST -o tmpdir/run $srcdir/$subdir/run.c"
+catch "exec $CC_FOR_HOST $CFLAGS_FOR_HOST -o tmpdir/run $srcdir/$subdir/run.c" exec_output
if ![string match "" $exec_output] {
send_log "$exec_output\n"
verbose "$exec_output"
@@ -238,9 +238,9 @@ if ![string match "" $exec_output] {
}
# Compile and link the test.
-if { ![ld_compile "$CC $CFLAGS -membedded-pic" $srcdir$subdir/runtesti.s tmpdir/runtesti.o]
- || ![ld_compile "$CC $CFLAGS -membedded-pic" $srcdir$subdir/runtest1.c tmpdir/runtest1.o]
- || ![ld_compile "$CC $CFLAGS -membedded-pic" $srcdir$subdir/runtest2.c tmpdir/runtest2.o] } {
+if { ![ld_compile "$CC $CFLAGS -membedded-pic" $srcdir/$subdir/runtesti.s tmpdir/runtesti.o]
+ || ![ld_compile "$CC $CFLAGS -membedded-pic" $srcdir/$subdir/runtest1.c tmpdir/runtest1.o]
+ || ![ld_compile "$CC $CFLAGS -membedded-pic" $srcdir/$subdir/runtest2.c tmpdir/runtest2.o] } {
unresolved $testname
return
}
diff --git a/ld/testsuite/ld-sh/sh.exp b/ld/testsuite/ld-sh/sh.exp
new file mode 100644
index 0000000..45c8727
--- /dev/null
+++ b/ld/testsuite/ld-sh/sh.exp
@@ -0,0 +1,143 @@
+# Expect script for ld-sh tests
+# Copyright (C) 1995, 1996 Free Software Foundation
+#
+# This file is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+# Written by Ian Lance Taylor (ian@cygnus.com)
+#
+
+# Test SH relaxing. This tests the compiler and assembler as well as
+# the linker.
+
+if ![istarget sh*-*-*] {
+ return
+}
+
+set testsimple "SH simple relaxing"
+
+if ![ld_assemble $as "-relax $srcdir/$subdir/sh1.s" tmpdir/sh1.o] {
+ unresolved $testsimple
+} else { if ![ld_simple_link $ld tmpdir/sh1 "-relax tmpdir/sh1.o"] {
+ fail $testsimple
+} else {
+ if ![ld_nm $nm tmpdir/sh1] {
+ unresolved $testsimple
+ } else {
+ if {![info exists nm_output(bar)] \
+ || ![info exists nm_output(foo)]} {
+ send_log "bad output from nm\n"
+ verbose "bad output from nm"
+ fail $testsimple
+ } else {
+ if {$nm_output(bar) != $nm_output(foo) + 4} {
+ send_log "foo == $nm_output(foo)\n"
+ verbose "foo == $nm_output(foo)"
+ send_log "bar == $nm_output(bar)\n"
+ verbose "bar == $nm_output(bar)"
+ fail $testsimple
+ } else {
+ pass $testsimple
+ }
+ }
+ }
+} }
+
+set testsrec "SH relaxing to S-records"
+
+if ![ld_simple_link $ld tmpdir/sh1.s1 "-relax -oformat srec tmpdir/sh1.o"] {
+ fail $testsrec
+} else {
+ # The file name is embedded in the S-records, so create both
+ # files with the same name.
+ catch "exec rm -f tmpdir/sh1.s2" exec_output
+ send_log "mv tmpdir/sh1.s1 tmpdir/sh1.s2\n"
+ verbose "mv tmpdir/sh1.s1 tmpdir/sh1.s2"
+ catch "exec mv tmpdir/sh1.s1 tmpdir/sh1.s2" exec_output
+ if ![string match "" $exec_output] {
+ send_log "$exec_output\n"
+ verbose "$exec_output"
+ unresolved $testsrec
+ } else {
+ send_log "$objcopy -O srec tmpdir/sh1 tmpdir/sh1.s1"
+ verbose "$objcopy -O srec tmpdir/sh1 tmpdir/sh1.s1"
+ catch "exec $objcopy -O srec tmpdir/sh1 tmpdir/sh1.s1" exec_output
+ if ![string match "" $exec_output] {
+ send_log "$exec_output\n"
+ verbose "$exec_output"
+ unresolved $testsrec
+ } else {
+ send_log "cmp tmpdir/sh1.s1 tmpdir/sh1.s2\n"
+ verbose "cmp tmpdir/sh1.s1 tmpdir/sh1.s2"
+ catch "exec cmp tmpdir/sh1.s1 tmpdir/sh1.s2" exec_output
+ set exec_output [prune_system_crud $host_triplet $exec_output]
+ if ![string match "" $exec_output] {
+ send_log "$exec_output\n"
+ verbose "$exec_output"
+ fail $testsrec
+ } else {
+ pass $testsrec
+ }
+ }
+ }
+}
+
+set testlink "SH relaxing"
+set testjsr "SH confirm relaxing"
+set testrun "SH relaxing execution"
+
+if { [which $CC] == 0 } {
+ untested $testlink
+ untested $testjsr
+ untested $testrun
+ return
+}
+
+if {![ld_assemble $as "-relax $srcdir/$subdir/start.s" tmpdir/start.o] \
+ || ![ld_compile $CC "-O -mrelax $srcdir/$subdir/sh2.c" tmpdir/sh2.o]} {
+ unresolved $testlink
+ unresolved $testjsr
+ unresolved $testrun
+ return
+}
+
+if ![ld_simple_link $ld tmpdir/sh2 "-relax tmpdir/start.o tmpdir/sh2.o"] {
+ fail $testlink
+ unresolved $testjsr
+ unresolved $testrun
+ return
+}
+
+pass $testlink
+
+send_log "$objdump -d tmpdir/sh2\n"
+verbose "$objdump -d tmpdir/sh2"
+catch "exec $objdump -d tmpdir/sh2" exec_output
+if [string match "*jsr*" $exec_output] {
+ fail $testjsr
+} else {
+ pass $testjsr
+}
+
+if { ![info exists SIM] || [which $SIM] == 0 } {
+ untested $testrun
+ return
+}
+
+set status [catch "exec $SIM tmpdir/sh2" exec_output]
+if { $status == 0 } {
+ pass $testrun
+} else {
+ fail $testrun
+}
diff --git a/ld/testsuite/lib/ld.exp b/ld/testsuite/lib/ld.exp
index 849a6d8..6fd9829 100644
--- a/ld/testsuite/lib/ld.exp
+++ b/ld/testsuite/lib/ld.exp
@@ -124,9 +124,9 @@ proc default_ld_compile { cc source object } {
catch "exec rm -f $object" exec_output
- verbose -log "$cc -I$srcdir$subdir -c $CFLAGS $source -o $object"
+ verbose -log "$cc -I$srcdir/$subdir -c $CFLAGS $source -o $object"
- catch "exec $cc -I$srcdir$subdir -c $CFLAGS $source -o $object" exec_output
+ catch "exec $cc -I$srcdir/$subdir -c $CFLAGS $source -o $object" exec_output
set exec_output [prune_system_crud $host_triplet $exec_output]
if [string match "" $exec_output] then {
if {![file exists $object]} then {