1 # Expect script
for LD cdtest Tests
2 # Copyright
1993, 1994, 1995, 1997, 2001, 2004, 2007
3 # Free Software Foundation
, Inc.
5 # This file is part of the GNU Binutils.
7 # This
program is free software
; you can redistribute it and
/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation
; either version
3 of the License
, or
10 #
(at your option
) any later version.
12 # This
program is distributed in the hope that it will be useful
,
13 # but WITHOUT
ANY WARRANTY
; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License
for more details.
17 # You should have received a copy of the GNU General Public License
18 # along with this
program; if not
, write to the Free Software
19 # Foundation
, Inc.
, 51 Franklin Street
- Fifth Floor
, Boston
,
22 # Written by Jeffrey Wheat
(cassidy@cygnus.com
)
23 # Rewritten by Ian Lance Taylor
(ian@cygnus.com
)
26 # Make sure that constructors are handled correctly.
29 set test2
"cdtest with -Ur"
31 # This test requires running the executable generated by
ld.
36 if { [which $CXX
] == 0 } {
42 if { ![ld_compile
"$CXX $CXXFLAGS -fno-exceptions" $srcdir/$subdir/cdtest-foo.cc tmpdir/cdtest-foo.o]
43 ||
![ld_compile
"$CXX $CXXFLAGS -fno-exceptions" $srcdir/$subdir/cdtest-bar.cc tmpdir/cdtest-bar.o]
44 ||
![ld_compile
"$CXX $CXXFLAGS -fno-exceptions" $srcdir/$subdir/cdtest-main.cc tmpdir/cdtest-main.o] } {
50 set expected_output
"$srcdir/$subdir/cdtest.dat"
52 if ![ld_link $
ld tmpdir
/cdtest
{tmpdir
/cdtest
-foo.o tmpdir
/cdtest
-bar.o tmpdir
/cdtest
-main.o
}] {
55 send_log
"tmpdir/cdtest >tmpdir/cdtest.out\n"
56 verbose
"tmpdir/cdtest >tmpdir/cdtest.out"
57 catch
"exec tmpdir/cdtest >tmpdir/cdtest.out" exec_output
59 if ![string match
"" $exec_output] then {
60 send_log
"$exec_output\n"
61 verbose
"$exec_output" 1
65 send_log
"diff tmpdir/cdtest.out $expected_output\n"
66 verbose
"diff tmpdir/cdtest.out $expected_output"
67 catch
"exec diff tmpdir/cdtest.out $expected_output" exec_output
68 set exec_output
[prune_warnings $exec_output
]
70 if ![string match
"" $exec_output] then {
71 send_log
"$exec_output\n"
72 verbose
"$exec_output" 1
74 send_log
"Checking against Named Return Value optimization\n"
75 verbose
"Checking against Named Return Value optimization" 1
77 set expected_output
"$srcdir/$subdir/cdtest-nrv.dat"
79 send_log
"diff tmpdir/cdtest.out $expected_output\n"
80 verbose
"diff tmpdir/cdtest.out $expected_output"
81 catch
"exec diff tmpdir/cdtest.out $expected_output" exec_output
82 set exec_output
[prune_warnings $exec_output
]
85 if [string match
"" $exec_output] then {
88 send_log
"$exec_output\n"
89 verbose
"$exec_output" 1
96 if ![ld_relocate $
ld tmpdir
/cdtest.o
{-Ur tmpdir
/cdtest
-foo.o tmpdir
/cdtest
-bar.o tmpdir
/cdtest
-main.o
}] {
99 if ![ld_link $
ld tmpdir
/cdtest tmpdir
/cdtest.o
] {
102 send_log
"tmpdir/cdtest >tmpdir/cdtest.out\n"
103 verbose
"tmpdir/cdtest >tmpdir/cdtest.out"
104 catch
"exec tmpdir/cdtest >tmpdir/cdtest.out" exec_output
106 if ![string match
"" $exec_output] then {
107 send_log
"$exec_output\n"
108 verbose
"$exec_output" 1
112 send_log
"diff tmpdir/cdtest.out $expected_output\n"
113 verbose
"diff tmpdir/cdtest.out $expected_output"
114 catch
"exec diff tmpdir/cdtest.out $expected_output" exec_output
115 set exec_output
[prune_warnings $exec_output
]
117 if [string match
"" $exec_output] then {
120 send_log
"$exec_output\n"
121 verbose
"$exec_output" 1