diff options
author | Ian Lance Taylor <ian@airs.com> | 1994-09-27 22:23:51 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@airs.com> | 1994-09-27 22:23:51 +0000 |
commit | 5c680d3f29a0f7073b32e00bc5d4fda17c5e89f0 (patch) | |
tree | 2dd43ebea6d3376b5827327667b5a14beadc849d /ld/testsuite/ld.cdtest/cdtest.exp | |
parent | 50f01d6d2aac3b374b122ab9c5fb941978931572 (diff) | |
download | gdb-5c680d3f29a0f7073b32e00bc5d4fda17c5e89f0.zip gdb-5c680d3f29a0f7073b32e00bc5d4fda17c5e89f0.tar.gz gdb-5c680d3f29a0f7073b32e00bc5d4fda17c5e89f0.tar.bz2 |
* config/unix-ld.exp: Set ld using findfile.
* lib/ld.exp (default_ld_relocate): Return a value. Change format
of log messages.
(default_ld_compile): Likewise.
(default_ld_link): Likewise. Also, don't include $BFDLIB and
$LIBIBERTY in link.
* ld.bootstrap/bootstrap.exp: Rewrite.
* ld.cdtest/cdtest.exp: Rewrite.
* ld.cdtest/cdtest-foo.cc: Update from top level ld directory.
* ld.cdtest/cdtest-foo.h: Likewise.
* ld.cdtest/cdtest-main.cc: Likewise.
Diffstat (limited to 'ld/testsuite/ld.cdtest/cdtest.exp')
-rw-r--r-- | ld/testsuite/ld.cdtest/cdtest.exp | 118 |
1 files changed, 60 insertions, 58 deletions
diff --git a/ld/testsuite/ld.cdtest/cdtest.exp b/ld/testsuite/ld.cdtest/cdtest.exp index 43acad4..e605c61 100644 --- a/ld/testsuite/ld.cdtest/cdtest.exp +++ b/ld/testsuite/ld.cdtest/cdtest.exp @@ -1,6 +1,5 @@ -# # Expect script for LD cdtest Tests -# Copyright (C) 1993 Free Software Foundation +# Copyright (C) 1993,1994 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 @@ -17,71 +16,74 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ # # Written by Jeffrey Wheat (cassidy@cygnus.com) +# Rewritten by Ian Lance Taylor (ian@cygnus.com) # -# -# Bugs: -# + Assumes native toolchain, not cross. -# + Doesn't detect compilation failures (including lack of C++ compiler) -# cleanly. -# + Shouldn't use fixed names in /tmp for temp files -- either use names -# in current directory, or generate unique names. -# - -if $tracelevel then { - strace $tracelevel -} +# Make sure that constructors are handled correctly. -set tmpdir /tmp -set ld $objdir/ld.new +# This test requires running the executable generated by ld. +if ![isnative] {return} -set objects "$tmpdir/cdtest-main.o $tmpdir/cdtest-bar.o $tmpdir/cdtest-foo.o" +if ![file isdirectory tmpdir] {catch "exec mkdir tmpdir" status} -# compile the dependant objects - -verbose "### Compiling dependant objects\n" - -ld_compile "$CXX $CXXFLAGS" $srcdir/$subdir/cdtest-foo.cc $tmpdir/cdtest-foo.o -ld_compile "$CXX $CXXFLAGS" $srcdir/$subdir/cdtest-bar.cc $tmpdir/cdtest-bar.o -ld_compile "$CXX $CXXFLAGS" $srcdir/$subdir/cdtest-main.cc $tmpdir/cdtest-main.o +if ![ld_compile "$CXX $CXXFLAGS -fgnu-linker" $srcdir$subdir/cdtest-foo.cc tmpdir/cdtest-foo.o] { + return +} +if ![ld_compile "$CXX $CXXFLAGS -fgnu-linker" $srcdir$subdir/cdtest-bar.cc tmpdir/cdtest-bar.o] { + return +} +if ![ld_compile "$CXX $CXXFLAGS -fgnu-linker" $srcdir$subdir/cdtest-main.cc tmpdir/cdtest-main.o] { + return +} -# -# main test loop -# -foreach test [glob -nocomplain $srcdir/$subdir/*.dat] { - global target - global status - global result - - set target "$srcdir/$subdir/[file tail [file rootname $test]]" - set tmptarget "$tmpdir/[file tail [file rootname $test]]" - - verbose "### Running test $target\n" - - # link the target with objects and libraries - ld_link $ld $tmptarget $objects - - # load (execute) the target - if ![file exists $tmptarget] then { - unresolved "$tmptarget doesn't exist." +if ![ld_link $ld tmpdir/cdtest {tmpdir/cdtest-foo.o tmpdir/cdtest-bar.o tmpdir/cdtest-main.o}] { + fail cdtest +} else { + send_log "tmpdir/cdtest >tmpdir/cdtest.out\n" + verbose "tmpdir/cdtest >tmpdir/cdtest.out" + catch "exec tmpdir/cdtest >tmpdir/cdtest.out" exec_output + if ![string match "" $exec_output] then { + send_log "$exec_output\n" + verbose "$exec_output" 1 + fail cdtest } else { - catch "exec $tmptarget > $tmptarget.out" exec_output - - # diff the expected and actual outputs - if [file exists $tmptarget.out] then { - catch "simple_diff $target.dat $tmptarget.out" status + 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 + if [string match "" $exec_output] then { + pass cdtest } else { - fail "$tmptarget.out doesn't exist. error was $status" + send_log "$exec_output\n" + verbose "$exec_output" 1 + fail cdtest } } - # remove generated targets - verbose "Exec exec rm -f $tmptarget.o $tmptarget.out $tmptarget $tmptarget.grt" - catch "exec rm -f $tmptarget.o $tmptarget.out $tmptarget.grt $tmptarget" result } - -# remove dependant objects -verbose "Exec rm -f $objects" -catch "exec rm -f $objects" result -ld_exit - +if ![ld_relocate $ld tmpdir/cdtest.o {-Ur tmpdir/cdtest-foo.o tmpdir/cdtest-bar.o tmpdir/cdtest-main.o}] { + fail "cdtest with -Ur" +} else { + if ![ld_link $ld tmpdir/cdtest tmpdir/cdtest.o] { + fail "cdtest with -Ur" + } else { + send_log "tmpdir/cdtest >tmpdir/cdtest.out\n" + verbose "tmpdir/cdtest >tmpdir/cdtest.out" + catch "exec tmpdir/cdtest >tmpdir/cdtest.out" exec_output + if ![string match "" $exec_output] then { + send_log "$exec_output\n" + verbose "$exec_output" 1 + fail "cdtest with -Ur" + } 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 + if [string match "" $exec_output] then { + pass "cdtest with -Ur" + } else { + send_log "$exec_output\n" + verbose "$exec_output" 1 + fail "cdtest with -Ur" + } + } + } +} |