1 # Expect script
for LD cdtest Tests
2 # Copyright
1993, 1994, 1995, 1997, 2001, 2004
3 # Free Software Foundation
, Inc.
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.
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.
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.
, 51 Franklin Street
- Fifth Floor
, Boston
, MA
02110-1301, USA.
19 # Written by Jeffrey Wheat
(cassidy@cygnus.com
)
20 # Rewritten by Ian Lance Taylor
(ian@cygnus.com
)
23 # Make sure that constructors are handled correctly.
26 set test2
"cdtest with -Ur"
28 # This test requires running the executable generated by
ld.
33 if { [which $CXX
] == 0 } {
39 if { ![ld_compile
"$CXX $CXXFLAGS -fno-exceptions" $srcdir/$subdir/cdtest-foo.cc tmpdir/cdtest-foo.o]
40 ||
![ld_compile
"$CXX $CXXFLAGS -fno-exceptions" $srcdir/$subdir/cdtest-bar.cc tmpdir/cdtest-bar.o]
41 ||
![ld_compile
"$CXX $CXXFLAGS -fno-exceptions" $srcdir/$subdir/cdtest-main.cc tmpdir/cdtest-main.o] } {
47 set expected_output
"$srcdir/$subdir/cdtest.dat"
49 if ![ld_link $
ld tmpdir
/cdtest
{tmpdir
/cdtest
-foo.o tmpdir
/cdtest
-bar.o tmpdir
/cdtest
-main.o
}] {
52 send_log
"tmpdir/cdtest >tmpdir/cdtest.out\n"
53 verbose
"tmpdir/cdtest >tmpdir/cdtest.out"
54 catch
"exec tmpdir/cdtest >tmpdir/cdtest.out" exec_output
56 if ![string match
"" $exec_output] then {
57 send_log
"$exec_output\n"
58 verbose
"$exec_output" 1
62 send_log
"diff tmpdir/cdtest.out $expected_output\n"
63 verbose
"diff tmpdir/cdtest.out $expected_output"
64 catch
"exec diff tmpdir/cdtest.out $expected_output" exec_output
65 set exec_output
[prune_warnings $exec_output
]
67 if ![string match
"" $exec_output] then {
68 send_log
"$exec_output\n"
69 verbose
"$exec_output" 1
71 send_log
"Checking against Named Return Value optimization\n"
72 verbose
"Checking against Named Return Value optimization" 1
74 set expected_output
"$srcdir/$subdir/cdtest-nrv.dat"
76 send_log
"diff tmpdir/cdtest.out $expected_output\n"
77 verbose
"diff tmpdir/cdtest.out $expected_output"
78 catch
"exec diff tmpdir/cdtest.out $expected_output" exec_output
79 set exec_output
[prune_warnings $exec_output
]
82 if [string match
"" $exec_output] then {
85 send_log
"$exec_output\n"
86 verbose
"$exec_output" 1
93 if ![ld_relocate $
ld tmpdir
/cdtest.o
{-Ur tmpdir
/cdtest
-foo.o tmpdir
/cdtest
-bar.o tmpdir
/cdtest
-main.o
}] {
96 if ![ld_link $
ld tmpdir
/cdtest tmpdir
/cdtest.o
] {
99 send_log
"tmpdir/cdtest >tmpdir/cdtest.out\n"
100 verbose
"tmpdir/cdtest >tmpdir/cdtest.out"
101 catch
"exec tmpdir/cdtest >tmpdir/cdtest.out" exec_output
103 if ![string match
"" $exec_output] then {
104 send_log
"$exec_output\n"
105 verbose
"$exec_output" 1
109 send_log
"diff tmpdir/cdtest.out $expected_output\n"
110 verbose
"diff tmpdir/cdtest.out $expected_output"
111 catch
"exec diff tmpdir/cdtest.out $expected_output" exec_output
112 set exec_output
[prune_warnings $exec_output
]
114 if [string match
"" $exec_output] then {
117 send_log
"$exec_output\n"
118 verbose
"$exec_output" 1