old-cross-binutils/ld/testsuite/ld.cdtest/cdtest.exp
Ken Raeburn 6e0a904fd0 Fix test case to be valid ANSI C++.
Don't require use of fixed C++ header files, so "../gcc/xgcc -B../gcc/" ought
to work for CXX.

In cdtest.exp: Combine "rm" lines.  Added some commentary on things still
broken in this test case.
1994-01-28 20:09:26 +00:00

89 lines
2.7 KiB
Text

#
# Expect script for LD cdtest Tests
# Copyright (C) 1993 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., 675 Mass Ave, Cambridge, MA 02139, USA. */
#
# $Id$
#
# Written by Jeffrey Wheat (cassidy@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
}
set tmpdir /tmp
set ld $objdir/ld.new
set objects "$tmpdir/cdtest-main.o $tmpdir/cdtest-func.o $tmpdir/cdtest-foo.o"
# 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-func.cc $tmpdir/cdtest-func.o
ld_compile "$CXX $CXXFLAGS" $srcdir/$subdir/cdtest-main.cc $tmpdir/cdtest-main.o
#
# 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. $result"
} 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
} else {
fail "$tmptarget.out doesn't exist. error was $status"
}
}
# 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