* ld-spu/spu.exp (embed_test): New.
[binutils.git] / ld / testsuite / ld-spu / spu.exp
blobcb6f0dd6398646915d56067bc1317536d40cf4a4
1 # Expect script for ld-spu tests
2 # Copyright (C) 2006 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.
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 Foundation,
16 # 51 Franklin Street - Fifth Floor, Boston, MA 02111-1307, USA.
19 if { ![istarget "spu-*-*"] } {
20 return
23 proc embed_test { } {
24 global subdir srcdir
25 global AS ASFLAGS LD LDFLAGS READELF READELFFLAGS
27 set cmd "$AS $ASFLAGS -o tmpdir/ear.o $srcdir/$subdir/ear.s"
28 send_log "$cmd\n"
29 set cmdret [catch "exec $cmd" comp_output]
30 set comp_output [prune_warnings $comp_output]
31 if { $cmdret != 0 || $comp_output != ""} then {
32 send_log "$comp_output\n"
33 verbose "$comp_output" 3
34 fail "ear assembly"
35 return
38 set cmd "$LD $LDFLAGS -o tmpdir/ear tmpdir/ear.o"
39 send_log "$cmd\n"
40 set cmdret [catch "exec $cmd" comp_output]
41 set comp_output [prune_warnings $comp_output]
42 if { $cmdret != 0 || $comp_output != ""} then {
43 send_log "$comp_output\n"
44 verbose "$comp_output" 3
45 fail "ear link"
46 return
49 set cmd "sh $srcdir/../../binutils/embedspu.sh -m32 ear tmpdir/ear tmpdir/embed.o"
50 send_log "$cmd\n"
51 set cmdret [catch "exec $cmd" comp_output]
52 set comp_output [prune_warnings $comp_output]
53 if { $cmdret != 0 || $comp_output != ""} then {
54 send_log "$comp_output\n"
55 verbose "$comp_output" 3
56 if { [regexp "unknown pseudo-op: `.reloc'" $comp_output] } {
57 untested "ear embedspu"
58 return
60 fail "ear embedspu"
61 return
64 set cmd "$READELF $READELFFLAGS -r --wide tmpdir/embed.o > tmpdir/embed.out"
65 send_log "$cmd\n"
66 set cmdret [catch "exec $cmd" comp_output]
67 set comp_output [prune_warnings $comp_output]
68 if { $cmdret != 0 || $comp_output != ""} then {
69 send_log "$comp_output\n"
70 verbose "$comp_output" 3
71 fail "ear embed readelf"
72 return
75 if { [regexp_diff "tmpdir/embed.out" $srcdir/$subdir/embed.rd] } then {
76 fail "ear embed output"
77 return
80 pass "ear embed"
83 set rd_test_list [lsort [glob -nocomplain $srcdir/$subdir/*.d]]
84 foreach sputest $rd_test_list {
85 verbose [file rootname $sputest]
86 run_dump_test [file rootname $sputest]
89 if { [isbuild "powerpc*-*-linux*"] } {
90 embed_test