1 # Expect script
for LD cdtest Tests
2 # Copyright
(C
) 1993,1994,1995, 1997 Free Software Foundation
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.
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.
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.
18 # Written by Jeffrey Wheat
(cassidy@cygnus.com
)
19 # Rewritten by Ian Lance Taylor
(ian@cygnus.com
)
22 # Make sure that constructors are handled correctly.
25 set test2
"cdtest with -Ur"
27 # This test requires running the executable generated by
ld.
32 if { [which $CXX
] == 0 } {
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] } {
46 if ![ld_link $
ld tmpdir
/cdtest
{tmpdir
/cdtest
-foo.o tmpdir
/cdtest
-bar.o tmpdir
/cdtest
-main.o
}] {
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
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
]
62 if [string match
"" $exec_output] then {
65 send_log
"$exec_output\n"
66 verbose
"$exec_output" 1
72 if ![ld_relocate $
ld tmpdir
/cdtest.o
{-Ur tmpdir
/cdtest
-foo.o tmpdir
/cdtest
-bar.o tmpdir
/cdtest
-main.o
}] {
75 if ![ld_link $
ld tmpdir
/cdtest tmpdir
/cdtest.o
] {
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
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
]
91 if [string match
"" $exec_output] then {
94 send_log
"$exec_output\n"
95 verbose
"$exec_output" 1