Commit | Line | Data |
---|---|---|
252b5132 RH |
1 | # Expect script for LD cdtest Tests |
2 | # Copyright (C) 1993,1994,1995, 1997 Free Software Foundation | |
3 | # | |
4 | # This file is free software; you can redistribute it and/or modify | |
5 | # it under the terms of the GNU General Public License as published by | |
6 | # the Free Software Foundation; either version 2 of the License, or | |
7 | # (at your option) any later version. | |
8 | # | |
9 | # This program is distributed in the hope that it will be useful, | |
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | # GNU General Public License for more details. | |
13 | # | |
14 | # You should have received a copy of the GNU General Public License | |
15 | # along with this program; if not, write to the Free Software | |
16 | # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |
17 | # | |
18 | # Written by Jeffrey Wheat (cassidy@cygnus.com) | |
19 | # Rewritten by Ian Lance Taylor (ian@cygnus.com) | |
20 | # | |
21 | ||
22 | # Make sure that constructors are handled correctly. | |
23 | ||
24 | set test1 "cdtest" | |
25 | set test2 "cdtest with -Ur" | |
26 | ||
27 | # This test requires running the executable generated by ld. | |
28 | if ![isnative] { | |
29 | return | |
30 | } | |
31 | ||
32 | if { [which $CXX] == 0 } { | |
33 | untested $test1 | |
34 | untested $test2 | |
35 | return | |
36 | } | |
37 | ||
38 | if { ![ld_compile "$CXX $CXXFLAGS -fgnu-linker" $srcdir/$subdir/cdtest-foo.cc tmpdir/cdtest-foo.o] | |
39 | || ![ld_compile "$CXX $CXXFLAGS -fgnu-linker" $srcdir/$subdir/cdtest-bar.cc tmpdir/cdtest-bar.o] | |
40 | || ![ld_compile "$CXX $CXXFLAGS -fgnu-linker" $srcdir/$subdir/cdtest-main.cc tmpdir/cdtest-main.o] } { | |
41 | unresolved $test1 | |
42 | unresolved $test2 | |
43 | return | |
44 | } | |
45 | ||
46 | if ![ld_link $ld tmpdir/cdtest {tmpdir/cdtest-foo.o tmpdir/cdtest-bar.o tmpdir/cdtest-main.o}] { | |
47 | fail $test1 | |
48 | } else { | |
49 | send_log "tmpdir/cdtest >tmpdir/cdtest.out\n" | |
50 | verbose "tmpdir/cdtest >tmpdir/cdtest.out" | |
51 | catch "exec tmpdir/cdtest >tmpdir/cdtest.out" exec_output | |
52 | if ![string match "" $exec_output] then { | |
53 | send_log "$exec_output\n" | |
54 | verbose "$exec_output" 1 | |
55 | fail $test1 | |
56 | } else { | |
57 | send_log "diff tmpdir/cdtest.out $srcdir/$subdir/cdtest.dat\n" | |
58 | verbose "diff tmpdir/cdtest.out $srcdir/$subdir/cdtest.dat" | |
59 | catch "exec diff tmpdir/cdtest.out $srcdir/$subdir/cdtest.dat" exec_output | |
60 | set exec_output [prune_warnings $exec_output] | |
61 | ||
62 | if [string match "" $exec_output] then { | |
63 | pass $test1 | |
64 | } else { | |
65 | send_log "$exec_output\n" | |
66 | verbose "$exec_output" 1 | |
67 | fail $test1 | |
68 | } | |
69 | } | |
70 | } | |
71 | ||
72 | if ![ld_relocate $ld tmpdir/cdtest.o {-Ur tmpdir/cdtest-foo.o tmpdir/cdtest-bar.o tmpdir/cdtest-main.o}] { | |
73 | fail $test2 | |
74 | } else { | |
75 | if ![ld_link $ld tmpdir/cdtest tmpdir/cdtest.o] { | |
76 | fail $test2 | |
77 | } else { | |
78 | send_log "tmpdir/cdtest >tmpdir/cdtest.out\n" | |
79 | verbose "tmpdir/cdtest >tmpdir/cdtest.out" | |
80 | catch "exec tmpdir/cdtest >tmpdir/cdtest.out" exec_output | |
81 | if ![string match "" $exec_output] then { | |
82 | send_log "$exec_output\n" | |
83 | verbose "$exec_output" 1 | |
84 | fail $test2 | |
85 | } else { | |
86 | send_log "diff tmpdir/cdtest.out $srcdir/$subdir/cdtest.dat\n" | |
87 | verbose "diff tmpdir/cdtest.out $srcdir/$subdir/cdtest.dat" | |
88 | catch "exec diff tmpdir/cdtest.out $srcdir/$subdir/cdtest.dat" exec_output | |
89 | set exec_output [prune_warnings $exec_output] | |
90 | ||
91 | if [string match "" $exec_output] then { | |
92 | pass $test2 | |
93 | } else { | |
94 | send_log "$exec_output\n" | |
95 | verbose "$exec_output" 1 | |
96 | fail $test2 | |
97 | } | |
98 | } | |
99 | } | |
100 | } |