aboutsummaryrefslogtreecommitdiff
path: root/binutils/testsuite/binutils-all/objcopy.exp
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2016-06-22 14:42:26 +0100
committerNick Clifton <nickc@redhat.com>2016-06-22 14:42:26 +0100
commit96037eb0b8c22e0b080863362bee4a4f6fc476ed (patch)
tree4d69ede78b95060a6a049cfeca9668b676fb61a6 /binutils/testsuite/binutils-all/objcopy.exp
parent6b1edb94fedc7103b4929354d27304d0bd756f49 (diff)
downloadgdb-96037eb0b8c22e0b080863362bee4a4f6fc476ed.zip
gdb-96037eb0b8c22e0b080863362bee4a4f6fc476ed.tar.gz
gdb-96037eb0b8c22e0b080863362bee4a4f6fc476ed.tar.bz2
Fix various binutils testsuite failures.
* testsuite/binutils-all/ar.exp: Skip tests for Alpha target. Skip bfdtest1 tests for tic30 target. * testsuite/binutils-all/arm/objdump.exp: Skip for aout arm target. * testsuite/binutils-all/compress.exp: Expect some tests to fail on the nds32. * testsuite/binutils-all/copy-3.d: Skip for go32 targets. * testsuite/binutils-all/copy-4.d: Skip for AIX and linuxecoff targets. * testsuite/binutils-all/nm.exp: Treat beos based targets as ELF targets. * testsuite/binutils-all/objcopy.exp: Only run reverse bytes tests if the bintest.o file was created. Use the get_standard_section_names proc to get the name of the data section. * testsuite/binutils-all/objdump.exp: Update regexps to allow for RX section names. * testsuite/binutils-all/readelf.exp: Use get_standard_section_names proc to get the name of the data section. * testsuite/binutils-all/readelf.r: Allow for non standard text section names. * testsuite/binutils-all/readelf.s: Update regexps for tilepro. * testsuite/binutils-all/size.exp: Allow for non standard section names. * testsuite/binutils-all/update-section.exp: Expect comapre 1vs4 to fail on mips targets. * testsuite/lib/utils-lib.exp (default_binutils_run): Use get_standard_section_names proc. (run_dump_test): Likewise. (proc get_standard_section_names): New proc.
Diffstat (limited to 'binutils/testsuite/binutils-all/objcopy.exp')
-rw-r--r--binutils/testsuite/binutils-all/objcopy.exp148
1 files changed, 79 insertions, 69 deletions
diff --git a/binutils/testsuite/binutils-all/objcopy.exp b/binutils/testsuite/binutils-all/objcopy.exp
index af333ac..94075f0 100644
--- a/binutils/testsuite/binutils-all/objcopy.exp
+++ b/binutils/testsuite/binutils-all/objcopy.exp
@@ -46,9 +46,10 @@ proc objcopy_test {testname srcfile} {
global tempfile
global copyfile
- if {![binutils_assemble $srcdir/$subdir/${srcfile} tmpdir/bintest.o]} then {
+ if {![binutils_assemble $srcdir/$subdir/${srcfile} $tempfile]} then {
perror "unresolved $testname"
unresolved "objcopy ($testname)"
+ remote_file host delete $tempfile
return
}
@@ -107,41 +108,48 @@ proc objcopy_test {testname srcfile} {
objcopy_test "simple copy" bintest.s
-# Test reversing bytes in a section.
-
-set reversed ${tempfile}-reversed
-set got [binutils_run $OBJCOPY "$OBJCOPYFLAGS -j .data --reverse-bytes=4 $tempfile $reversed"]
+if { [file exists $tempfile] } {
+ # Test reversing bytes in a section.
-if ![string equal "" $got] then {
- fail "objcopy --reverse-bytes"
-} else {
- if [is_remote host] {
- remote_upload host ${reversed} tmpdir/copy-reversed.o
- set reversed tmpdir/copy-reversed.o
+ set reversed ${tempfile}-reversed
+ set sect_names [get_standard_section_names]
+ if { $sect_names != "" } {
+ set got [binutils_run $OBJCOPY "$OBJCOPYFLAGS -j [lindex $sect_names 1] --reverse-bytes=4 $tempfile $reversed"]
+ } else {
+ set got [binutils_run $OBJCOPY "$OBJCOPYFLAGS -j .data --reverse-bytes=4 $tempfile $reversed"]
}
- set origdata [binutils_run $OBJDUMP "$OBJDUMPFLAGS -s -j .data $tempfile"]
- set revdata [binutils_run $OBJDUMP "$OBJDUMPFLAGS -s -j .data $reversed"]
+ if ![string equal "" $got] then {
+ fail "objcopy --reverse-bytes"
+ } else {
+ if [is_remote host] {
+ remote_upload host ${reversed} tmpdir/copy-reversed.o
+ set reversed tmpdir/copy-reversed.o
+ }
+
+ set origdata [binutils_run $OBJDUMP "$OBJDUMPFLAGS -s -j .data $tempfile"]
+ set revdata [binutils_run $OBJDUMP "$OBJDUMPFLAGS -s -j .data $reversed"]
- set want "^ \[0-9\]+ (\[0-9\]+)"
- set found_orig [regexp -lineanchor $want $origdata -> origdata]
- set found_rev [regexp -lineanchor $want $revdata -> revdata]
+ set want "^ \[0-9\]+ (\[0-9\]+)"
+ set found_orig [regexp -lineanchor $want $origdata -> origdata]
+ set found_rev [regexp -lineanchor $want $revdata -> revdata]
- if {$found_orig == 0 || $found_rev == 0} then {
- # som doesn't have a .data section
- setup_xfail "hppa*-*-hpux*"
- clear_xfail "hppa*64*-*-hpux*"
+ if {$found_orig == 0 || $found_rev == 0} then {
+ # som doesn't have a .data section
+ setup_xfail "hppa*-*-hpux*"
+ clear_xfail "hppa*64*-*-hpux*"
- fail "objcopy --reverse-bytes"
- } else {
- scan $origdata "%2x%2x%2x%2x" b1 b2 b3 b4
- scan $revdata "%2x%2x%2x%2x" c4 c3 c2 c1
+ fail "objcopy --reverse-bytes"
+ } else {
+ scan $origdata "%2x%2x%2x%2x" b1 b2 b3 b4
+ scan $revdata "%2x%2x%2x%2x" c4 c3 c2 c1
- if {$b1 == $c1 && $b2 == $c2 && $b3 == $c3 && $b4 == $c4} then {
- pass "objcopy --reverse-bytes"
- } else {
- fail "objcopy --reverse-bytes"
- }
+ if {$b1 == $c1 && $b2 == $c2 && $b3 == $c3 && $b4 == $c4} then {
+ pass "objcopy --reverse-bytes"
+ } else {
+ fail "objcopy --reverse-bytes"
+ }
+ }
}
}
@@ -184,66 +192,68 @@ if ![string equal "" $got] then {
# Test generating S records.
-# We make the srec filename 8.3 compatible. Note that the header string
-# matched against depends on the name of the file. Ugh.
-
-if [is_remote host] {
- set srecfile copy.sre
- set header_string S00B0000636F70792E737265C1
-} else {
- set srecfile ${copyfile}.srec
- set header_string S0130000746D706469722F636F70792E7372656397
-}
+if { [file exists $tempfile] } {
+ # We make the srec filename 8.3 compatible. Note that the header string
+ # matched against depends on the name of the file. Ugh.
-set got [binutils_run $OBJCOPY "$OBJCOPYFLAGS -O srec $tempfile ${srecfile}"]
-
-if ![string equal "" $got] then {
- fail "objcopy -O srec"
-} else {
if [is_remote host] {
- remote_upload host ${srecfile} tmpdir/copy.srec
- set srecfile tmpdir/copy.srec
+ set srecfile copy.sre
+ set header_string S00B0000636F70792E737265C1
+ } else {
+ set srecfile ${copyfile}.srec
+ set header_string S0130000746D706469722F636F70792E7372656397
}
- set file [open ${srecfile} r]
- # The first S record is fixed by the file name we are using.
- gets $file line
- send_log "$line\n"
- verbose $line
- if ![regexp "$header_string.*" $line] {
- send_log "bad header\n"
+ set got [binutils_run $OBJCOPY "$OBJCOPYFLAGS -O srec $tempfile ${srecfile}"]
+
+ if ![string equal "" $got] then {
fail "objcopy -O srec"
} else {
- while {[gets $file line] != -1 \
- && [regexp "^S\[123\]\[0-9a-fA-F\]+\[\r\n\]*$" $line]} {
- send_log "$line\n"
- verbose $line
- set line "**EOF**"
+ if [is_remote host] {
+ remote_upload host ${srecfile} tmpdir/copy.srec
+ set srecfile tmpdir/copy.srec
}
+ set file [open ${srecfile} r]
+
+ # The first S record is fixed by the file name we are using.
+ gets $file line
send_log "$line\n"
verbose $line
- if ![regexp "^S\[789\]\[0-9a-fA-F\]+\[\r\n\]*$" $line] then {
- send_log "bad trailer\n"
+ if ![regexp "$header_string.*" $line] {
+ send_log "bad header\n"
fail "objcopy -O srec"
} else {
- if {[gets $file line] != -1} then {
- send_log "garbage at end\n"
+ while {[gets $file line] != -1 \
+ && [regexp "^S\[123\]\[0-9a-fA-F\]+\[\r\n\]*$" $line]} {
send_log "$line\n"
verbose $line
+ set line "**EOF**"
+ }
+ send_log "$line\n"
+ verbose $line
+ if ![regexp "^S\[789\]\[0-9a-fA-F\]+\[\r\n\]*$" $line] then {
+ send_log "bad trailer\n"
fail "objcopy -O srec"
} else {
- set got [binutils_run $OBJDUMP "$OBJDUMPFLAGS -f ${srecfile}"]
- if ![regexp "file format srec" $got] then {
- send_log "objdump failed\n"
+ if {[gets $file line] != -1} then {
+ send_log "garbage at end\n"
+ send_log "$line\n"
+ verbose $line
fail "objcopy -O srec"
} else {
- pass "objcopy -O srec"
+ set got [binutils_run $OBJDUMP "$OBJDUMPFLAGS -f ${srecfile}"]
+ if ![regexp "file format srec" $got] then {
+ send_log "objdump failed\n"
+ fail "objcopy -O srec"
+ } else {
+ pass "objcopy -O srec"
+ }
}
}
}
- }
- close $file
+ close $file
+ }
}
# Test setting and adjusting the start address. We only test this
@@ -644,7 +654,7 @@ proc copy_executable { prog flags test1 test2 } {
# This also fails for mips*-*-elf targets. See elf32-mips.c
# mips_elf_sym_is_global.
- setup_xfail "mips*-*-elf"
+ setup_xfail "mips*-*-elf" "tx39-*-*"
setup_xfail "arm*-*-coff"
setup_xfail "arm*-*-pe"