Initial revision
[binutils.git] / ld / testsuite / ld-versados / versados.exp
blob2d2c0663bed6332463384b2d957f2a1a85297c27
1 # Expect script for ld-versados tests
2 # Copyright (C) 1995, 1996, 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.
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.
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 Steve Chamberlain (sac@cygnus.com)
21 # Make sure that ld can read versados images and
22 # generate binaries which are identical to the customer's
23 # old method.
25 # This test can only be run if ld generates native executables.
27 # This test can only be run on 68k coff targets
28 # Square bracket expressions seem to confuse istarget.
29 if { ![istarget m68k-*-coff*] } then {
30 return
33 set testname "LD VERSADOS"
36 proc inspect { whichone } {
37 global objdump
38 global exec_output
39 global srcdir
40 global subdir
41 global testname
43 send_log "$objdump -s tmpdir/$whichone.out >tmpdir/$whichone.dump\n"
44 catch "exec $objdump -s tmpdir/$whichone.out | grep -v srec >tmpdir/$whichone.dump" exec_output
46 if ![string match "" $exec_output] {
47 send_log "$exec_output\n"
48 verbose $exec_output
49 unresolved $testname
50 return 0
53 send_log "$objdump -s $srcdir/$subdir/$whichone.ook >tmpdir/$whichone.dok\n"
54 catch "exec $objdump -s $srcdir/$subdir/$whichone.ook | grep -v srec >tmpdir/$whichone.dok" exec_output
56 if ![string match "" $exec_output] {
57 send_log "$exec_output\n"
58 verbose $exec_output
59 unresolved $testname
60 return 0
63 # compare it with the correct output
64 catch "exec diff tmpdir/$whichone.dump tmpdir/$whichone.dok" exec_output
65 if ![string match "" $exec_output] {
66 send_log "$exec_output\n"
67 verbose $exec_output
68 fail $testname
69 return 0
72 return 1
75 if ![ld_simple_link $ld tmpdir/t1.out \
76 " -T $srcdir/$subdir/t1.ld $srcdir/$subdir/t1-1.ro $srcdir/$subdir/t1-2.ro"] {
77 fail $testname
78 return
79 } else {
80 # Get a dump of what we've got, and what we should have
81 if ![inspect t1] {
82 return
87 if ![ld_simple_link $ld tmpdir/t2.out \
88 " -T $srcdir/$subdir/t2.ld $srcdir/$subdir/t2-2.ro \
89 $srcdir/$subdir/t2-1.ro $srcdir/$subdir/t2-3.ro"] {
90 fail $testname
91 return
92 } else {
93 # Get a dump of what we've got, and what we should have
94 if ![inspect t2] {
95 return
99 pass $testname