bfd/
[binutils-gdb.git] / ld / testsuite / ld-elf / wrap.exp
1 # Expect script for wrap ELF tests.
2 # Copyright 2006 Free Software Foundation, Inc.
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., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
17 #
18
19 # Exclude non-ELF targets.
20
21 if ![is_elf_format] {
22 return
23 }
24
25 # The following tests require running the executable generated by ld.
26 if ![isnative] {
27 return
28 }
29
30 # Check if compiler works
31 if { [which $CC] == 0 } {
32 return
33 }
34
35 set build_tests {
36 {"Build libwrap1a.so"
37 "-shared" "-fPIC"
38 {wrap1a.c} {} "libwrap1a.so"}
39 {"Build libwrap1b.so"
40 "-shared tmpdir/libwrap1a.so" "-fPIC"
41 {wrap1b.c} {} "libwrap1b.so"}
42 }
43
44 set run_tests {
45 {"Run with libwrap1a.so and libwrap1b.so"
46 "--wrap par tmpdir/libwrap1a.so tmpdir/libwrap1b.so" ""
47 {wrap1.c} "wrap1" "wrap1.out"}
48 {"Run with libwrap1b.so and libwrap1a.so"
49 "--wrap par tmpdir/libwrap1b.so tmpdir/libwrap1a.so" ""
50 {wrap1.c} "wrap1" "wrap1.out"}
51 }
52
53 run_cc_link_tests $build_tests
54 run_ld_link_exec_tests [] $run_tests