1 # Expect script
for LD cdtest Tests
2 # Copyright
1993, 1994, 1995, 1997, 2001 Free Software Foundation
, Inc.
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 -fno-exceptions" $srcdir/$subdir/cdtest-foo.cc tmpdir/cdtest-foo.o]
39 ||
![ld_compile
"$CXX $CXXFLAGS -fno-exceptions" $srcdir/$subdir/cdtest-bar.cc tmpdir/cdtest-bar.o]
40 ||
![ld_compile
"$CXX $CXXFLAGS -fno-exceptions" $srcdir/$subdir/cdtest-main.cc tmpdir/cdtest-main.o] } {
46 set expected_output
"$srcdir/$subdir/cdtest.dat"
48 if ![ld_link $
ld tmpdir
/cdtest
{tmpdir
/cdtest
-foo.o tmpdir
/cdtest
-bar.o tmpdir
/cdtest
-main.o
}] {
51 send_log
"tmpdir/cdtest >tmpdir/cdtest.out\n"
52 verbose
"tmpdir/cdtest >tmpdir/cdtest.out"
53 catch
"exec tmpdir/cdtest >tmpdir/cdtest.out" exec_output
55 if ![string match
"" $exec_output] then {
56 send_log
"$exec_output\n"
57 verbose
"$exec_output" 1
61 send_log
"diff tmpdir/cdtest.out $expected_output\n"
62 verbose
"diff tmpdir/cdtest.out $expected_output"
63 catch
"exec diff tmpdir/cdtest.out $expected_output" exec_output
64 set exec_output
[prune_warnings $exec_output
]
66 if ![string match
"" $exec_output] then {
67 send_log
"$exec_output\n"
68 verbose
"$exec_output" 1
70 send_log
"Checking against Named Return Value optimization\n"
71 verbose
"Checking against Named Return Value optimization" 1
73 set expected_output
"$srcdir/$subdir/cdtest-nrv.dat"
75 send_log
"diff tmpdir/cdtest.out $expected_output\n"
76 verbose
"diff tmpdir/cdtest.out $expected_output"
77 catch
"exec diff tmpdir/cdtest.out $expected_output" exec_output
78 set exec_output
[prune_warnings $exec_output
]
81 if [string match
"" $exec_output] then {
84 send_log
"$exec_output\n"
85 verbose
"$exec_output" 1
92 if ![ld_relocate $
ld tmpdir
/cdtest.o
{-Ur tmpdir
/cdtest
-foo.o tmpdir
/cdtest
-bar.o tmpdir
/cdtest
-main.o
}] {
95 if ![ld_link $
ld tmpdir
/cdtest tmpdir
/cdtest.o
] {
98 send_log
"tmpdir/cdtest >tmpdir/cdtest.out\n"
99 verbose
"tmpdir/cdtest >tmpdir/cdtest.out"
100 catch
"exec tmpdir/cdtest >tmpdir/cdtest.out" exec_output
102 if ![string match
"" $exec_output] then {
103 send_log
"$exec_output\n"
104 verbose
"$exec_output" 1
108 send_log
"diff tmpdir/cdtest.out $expected_output\n"
109 verbose
"diff tmpdir/cdtest.out $expected_output"
110 catch
"exec diff tmpdir/cdtest.out $expected_output" exec_output
111 set exec_output
[prune_warnings $exec_output
]
113 if [string match
"" $exec_output] then {
116 send_log
"$exec_output\n"
117 verbose
"$exec_output" 1