1 # Expect script for ld-spu tests 2 # Copyright (C) 2006-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 22 if { ![istarget "spu-*-*"] } { 23 return 24 } 25 26 proc embed_test { } { 27 global subdir srcdir 28 global AS ASFLAGS LD LDFLAGS READELF READELFFLAGS 29 30 set cmd "$AS $ASFLAGS -o tmpdir/ear.o $srcdir/$subdir/ear.s" 31 send_log "$cmd\n" 32 set cmdret [catch "exec $cmd" comp_output] 33 set comp_output [prune_warnings $comp_output] 34 if { $cmdret != 0 || $comp_output != ""} then { 35 send_log "$comp_output\n" 36 verbose "$comp_output" 3 37 fail "ear assembly" 38 return 39 } 40 41 set cmd "$LD $LDFLAGS -o tmpdir/ear tmpdir/ear.o" 42 send_log "$cmd\n" 43 set cmdret [catch "exec $cmd" comp_output] 44 set comp_output [prune_warnings $comp_output] 45 if { $cmdret != 0 || $comp_output != ""} then { 46 send_log "$comp_output\n" 47 verbose "$comp_output" 3 48 fail "ear link" 49 return 50 } 51 52 set cmd "sh $srcdir/../../binutils/embedspu.sh -m32 ear tmpdir/ear tmpdir/embed.o" 53 send_log "$cmd\n" 54 set cmdret [catch "exec $cmd" comp_output] 55 set comp_output [prune_warnings $comp_output] 56 if { $cmdret != 0 || $comp_output != ""} then { 57 send_log "$comp_output\n" 58 verbose "$comp_output" 3 59 if { [regexp "unknown pseudo-op: `.reloc'" $comp_output] } { 60 untested "ear embedspu" 61 return 62 } 63 fail "ear embedspu" 64 return 65 } 66 67 set cmd "$READELF $READELFFLAGS -r --wide tmpdir/embed.o > tmpdir/embed.out" 68 send_log "$cmd\n" 69 set cmdret [catch "exec $cmd" comp_output] 70 set comp_output [prune_warnings $comp_output] 71 if { $cmdret != 0 || $comp_output != ""} then { 72 send_log "$comp_output\n" 73 verbose "$comp_output" 3 74 fail "ear embed readelf" 75 return 76 } 77 78 if { [regexp_diff "tmpdir/embed.out" $srcdir/$subdir/embed.rd] } then { 79 fail "ear embed output" 80 return 81 } 82 83 pass "ear embed" 84 } 85 86 set rd_test_list [lsort [glob -nocomplain $srcdir/$subdir/*.d]] 87 foreach sputest $rd_test_list { 88 verbose [file rootname $sputest] 89 run_dump_test [file rootname $sputest] 90 } 91 92 if { [isbuild "powerpc*-*-linux*"] } { 93 embed_test 94 } 95