1993-08-12 23:20:25 +00:00
|
|
|
#
|
|
|
|
# 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. */
|
|
|
|
#
|
|
|
|
# Written by Jeffrey Wheat (cassidy@cygnus.com)
|
|
|
|
#
|
|
|
|
|
1994-01-28 20:09:26 +00:00
|
|
|
#
|
|
|
|
# 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.
|
|
|
|
#
|
|
|
|
|
1993-08-12 23:20:25 +00:00
|
|
|
if $tracelevel then {
|
|
|
|
strace $tracelevel
|
|
|
|
}
|
|
|
|
|
|
|
|
set tmpdir /tmp
|
|
|
|
set ld $objdir/ld.new
|
|
|
|
|
1994-05-11 23:49:21 +00:00
|
|
|
set objects "$tmpdir/cdtest-main.o $tmpdir/cdtest-bar.o $tmpdir/cdtest-foo.o"
|
1993-08-12 23:20:25 +00:00
|
|
|
|
|
|
|
# compile the dependant objects
|
|
|
|
|
|
|
|
verbose "### Compiling dependant objects\n"
|
|
|
|
|
1993-09-10 17:00:19 +00:00
|
|
|
ld_compile "$CXX $CXXFLAGS" $srcdir/$subdir/cdtest-foo.cc $tmpdir/cdtest-foo.o
|
1994-05-11 23:49:21 +00:00
|
|
|
ld_compile "$CXX $CXXFLAGS" $srcdir/$subdir/cdtest-bar.cc $tmpdir/cdtest-bar.o
|
1993-09-10 17:00:19 +00:00
|
|
|
ld_compile "$CXX $CXXFLAGS" $srcdir/$subdir/cdtest-main.cc $tmpdir/cdtest-main.o
|
1993-08-12 23:20:25 +00:00
|
|
|
|
|
|
|
#
|
|
|
|
# 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 {
|
1994-05-27 16:58:05 +00:00
|
|
|
unresolved "$tmptarget doesn't exist."
|
1993-08-12 23:20:25 +00:00
|
|
|
} 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
|
1994-01-28 20:09:26 +00:00
|
|
|
verbose "Exec exec rm -f $tmptarget.o $tmptarget.out $tmptarget $tmptarget.grt"
|
|
|
|
catch "exec rm -f $tmptarget.o $tmptarget.out $tmptarget.grt $tmptarget" result
|
1993-08-12 23:20:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
# remove dependant objects
|
|
|
|
verbose "Exec rm -f $objects"
|
|
|
|
catch "exec rm -f $objects" result
|
|
|
|
ld_exit
|
|
|
|
|
|
|
|
|