1 # Expect script for ld-versados tests 2 # Copyright (C) 1995-2014 Free Software Foundation, Inc. 3 # 4 # This file is part of the GNU Binutils. 5 # 6 # This program is free software; you can redistribute it and/or modify 7 # it under the terms of the GNU General Public License as published by 8 # the Free Software Foundation; either version 3 of the License, or 9 # (at your option) any later version. 10 # 11 # This program is distributed in the hope that it will be useful, 12 # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 # GNU General Public License for more details. 15 # 16 # You should have received a copy of the GNU General Public License 17 # along with this program; if not, write to the Free Software 18 # Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, 19 # MA 02110-1301, USA. 20 # 21 # Written by Steve Chamberlain (sac (at) cygnus.com) 22 # 23 24 # Make sure that ld can read versados images and 25 # generate binaries which are identical to the customer's 26 # old method. 27 28 # This test can only be run if ld generates native executables. 29 30 # This test can only be run on 68k coff targets 31 # Square bracket expressions seem to confuse istarget. 32 if { ![istarget m68k-*-coff*] } then { 33 return 34 } 35 36 set testname "LD VERSADOS" 37 38 39 proc inspect { whichone } { 40 global objdump 41 global exec_output 42 global srcdir 43 global subdir 44 global testname 45 46 send_log "$objdump -s tmpdir/$whichone.out >tmpdir/$whichone.dump\n" 47 catch "exec $objdump -s tmpdir/$whichone.out | grep -v srec >tmpdir/$whichone.dump" exec_output 48 49 if ![string match "" $exec_output] { 50 send_log "$exec_output\n" 51 verbose $exec_output 52 unresolved $testname 53 return 0 54 } 55 56 send_log "$objdump -s $srcdir/$subdir/$whichone.ook >tmpdir/$whichone.dok\n" 57 catch "exec $objdump -s $srcdir/$subdir/$whichone.ook | grep -v srec >tmpdir/$whichone.dok" exec_output 58 59 if ![string match "" $exec_output] { 60 send_log "$exec_output\n" 61 verbose $exec_output 62 unresolved $testname 63 return 0 64 } 65 66 # compare it with the correct output 67 catch "exec diff tmpdir/$whichone.dump tmpdir/$whichone.dok" exec_output 68 if ![string match "" $exec_output] { 69 send_log "$exec_output\n" 70 verbose $exec_output 71 fail $testname 72 return 0 73 } 74 75 return 1 76 } 77 78 if ![ld_simple_link $ld tmpdir/t1.out \ 79 " -T $srcdir/$subdir/t1.ld $srcdir/$subdir/t1-1.ro $srcdir/$subdir/t1-2.ro"] { 80 fail $testname 81 return 82 } else { 83 # Get a dump of what we've got, and what we should have 84 if ![inspect t1] { 85 return 86 } 87 } 88 89 90 if ![ld_simple_link $ld tmpdir/t2.out \ 91 " -T $srcdir/$subdir/t2.ld $srcdir/$subdir/t2-2.ro \ 92 $srcdir/$subdir/t2-1.ro $srcdir/$subdir/t2-3.ro"] { 93 fail $testname 94 return 95 } else { 96 # Get a dump of what we've got, and what we should have 97 if ![inspect t2] { 98 return 99 } 100 } 101 102 pass $testname 103