added support for the original "make chech-cdtest"
[deliverable/binutils-gdb.git] / ld / testsuite / ld.cdtest / cdtest.exp
1 #
2 # Expect script for LD cdtest Tests
3 # Copyright (C) 1993 Free Software Foundation
4 #
5 # This file is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 2 of the License, or
8 # (at your option) any later version.
9 #
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
14 #
15 # You should have received a copy of the GNU General Public License
16 # along with this program; if not, write to the Free Software
17 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
18 #
19 # $Id$
20 #
21 # Written by Jeffrey Wheat (cassidy@cygnus.com)
22 #
23
24 if $tracelevel then {
25 strace $tracelevel
26 }
27
28 set tmpdir /tmp
29 set ld $objdir/ld.new
30
31 set objects "$tmpdir/cdtest-main.o $tmpdir/cdtest-func.o $tmpdir/cdtest-foo.o"
32
33 # compile the dependant objects
34
35 verbose "### Compiling dependant objects\n"
36
37 ld_compile $CXX $srcdir/$subdir/cdtest-foo.cc $tmpdir/cdtest-foo.o
38 ld_compile $CXX $srcdir/$subdir/cdtest-func.cc $tmpdir/cdtest-func.o
39 ld_compile $CXX $srcdir/$subdir/cdtest-main.cc $tmpdir/cdtest-main.o
40
41 #
42 # main test loop
43 #
44 foreach test [glob -nocomplain $srcdir/$subdir/*.dat] {
45 global target
46 global status
47 global result
48
49 set target "$srcdir/$subdir/[file tail [file rootname $test]]"
50 set tmptarget "$tmpdir/[file tail [file rootname $test]]"
51
52 verbose "### Running test $target\n"
53
54 # link the target with objects and libraries
55 ld_link $ld $tmptarget $objects
56
57 # load (execute) the target
58 if ![file exists $tmptarget] then {
59 unresolved "$tmptarget doesn't exist." $result
60 } else {
61 catch "exec $tmptarget > $tmptarget.out" exec_output
62
63 # diff the expected and actual outputs
64 if [file exists $tmptarget.out] then {
65 catch "simple_diff $target.dat $tmptarget.out" status
66 } else {
67 fail "$tmptarget.out doesn't exist. error was $status"
68 }
69 }
70 # remove generated targets
71 verbose "Exec exec rm -f $tmptarget.o $tmptarget.out"
72 catch "exec rm -f $tmptarget.o $tmptarget.out" result
73 verbose "Exec exec rm -f $tmptarget.grt $tmptarget"
74 catch "exec rm -f $tmptarget.grt $tmptarget" result
75 }
76
77 # remove dependant objects
78 verbose "Exec rm -f $objects"
79 catch "exec rm -f $objects" result
80 ld_exit
81
82
This page took 0.031185 seconds and 4 git commands to generate.