diff options
author | Alan Modra <amodra@gmail.com> | 2017-12-15 17:08:56 +1030 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2017-12-19 06:51:33 +1030 |
commit | f795c49463234dc347ddd9a1b07ee5b506295b96 (patch) | |
tree | e55a82360d64a55d45ed88ade2d1e9c4438ac470 /binutils/testsuite/binutils-all/arm | |
parent | c54207d32681bb205c28facba73b6173ef15eabf (diff) | |
download | binutils-f795c49463234dc347ddd9a1b07ee5b506295b96.zip binutils-f795c49463234dc347ddd9a1b07ee5b506295b96.tar.gz binutils-f795c49463234dc347ddd9a1b07ee5b506295b96.tar.bz2 |
Test binutils_assemble return value
This is a followup to "binutils nm testsuite tidy". Since the perror
in binutils_assemble has been removed, we need to take more care in
failure paths.
The patch also fixed a number of .exp files that have multiple tests,
where an assembly failure returns from the .exp file. In most cases
it is nicer to attempt all tests.
* testsuite/binutils-all/ar.exp (unique_symbol): Don't run AR
if assembly fails.
* testsuite/binutils-all/arc/objdump.exp (check_assembly): If
objfile is empty, fail test.
* testsuite/binutils-all/arm/objdump.exp: Don't return if assembly
fails for a test, continue on to other tests.
* testsuite/binutils-all/bfin/objdump.exp: Likewise.
* testsuite/binutils-all/hppa/objdump.exp: Likewise.
* testsuite/binutils-all/m68k/objdump.exp: Likewise.
* testsuite/binutils-all/vax/objdump.exp: Likewise.
* testsuite/binutils-all/size.exp: Likewise.
* testsuite/binutils-all/nm.exp: Likewise. Move PR12753 test.
* testsuite/binutils-all/objcopy.exp: Don't perror on assembly fail.
* testsuite/binutils-all/objdump.exp: Report assembly fails.
Diffstat (limited to 'binutils/testsuite/binutils-all/arm')
-rw-r--r-- | binutils/testsuite/binutils-all/arm/objdump.exp | 101 |
1 files changed, 52 insertions, 49 deletions
diff --git a/binutils/testsuite/binutils-all/arm/objdump.exp b/binutils/testsuite/binutils-all/arm/objdump.exp index 0e74ebb..3485d3a 100644 --- a/binutils/testsuite/binutils-all/arm/objdump.exp +++ b/binutils/testsuite/binutils-all/arm/objdump.exp @@ -34,35 +34,36 @@ send_user "Version [binutil_version $OBJDUMP]" ########################### if {![binutils_assemble $srcdir/$subdir/thumb2-cond.s tmpdir/thumb2-cond.o]} then { - return -} - -if [is_remote host] { - set objfile [remote_download host tmpdir/thumb2-cond.o] + fail "thumb2-cond (assembling)" } else { - set objfile tmpdir/thumb2-cond.o -} -# Make sure that conditional instructions are correctly decoded. + if [is_remote host] { + set objfile [remote_download host tmpdir/thumb2-cond.o] + } else { + set objfile tmpdir/thumb2-cond.o + } -set got [binutils_run $OBJDUMP "$OBJDUMPFLAGS --disassemble --start-address=6 $objfile"] + # Make sure that conditional instructions are correctly decoded. -set want "bcc.w\[ \t\]*e12.*bx\[ \t\]*lr" + set got [binutils_run $OBJDUMP "$OBJDUMPFLAGS --disassemble --start-address=6 $objfile"] -if [regexp $want $got] then { - pass "thumb2-cond test1" -} else { - fail "thumb2-cond test1" -} + set want "bcc.w\[ \t\]*e12.*bx\[ \t\]*lr" -set got [binutils_run $OBJDUMP "$OBJDUMPFLAGS --disassemble --start-address=10 $objfile"] + if [regexp $want $got] then { + pass "thumb2-cond test1" + } else { + fail "thumb2-cond test1" + } -set want "bx\[ \t\]*lr" + set got [binutils_run $OBJDUMP "$OBJDUMPFLAGS --disassemble --start-address=10 $objfile"] -if [regexp $want $got] then { - pass "thumb2-cond test2" -} else { - fail "thumb2-cond test2" + set want "bx\[ \t\]*lr" + + if [regexp $want $got] then { + pass "thumb2-cond test2" + } else { + fail "thumb2-cond test2" + } } ########################### @@ -70,45 +71,47 @@ if [regexp $want $got] then { ########################### if {![binutils_assemble $srcdir/$subdir/simple.s tmpdir/simple.o]} then { - return -} - -if [is_remote host] { - set objfile [remote_download host tmpdir/simple.o] + fail "multiple input files" } else { - set objfile tmpdir/simple.o -} -# Make sure multiple disassemblies come out the same + if [is_remote host] { + set objfile [remote_download host tmpdir/simple.o] + } else { + set objfile tmpdir/simple.o + } -set got [binutils_run $OBJDUMP "-dr $objfile $objfile"] + # Make sure multiple disassemblies come out the same -set want "$objfile:\[ \]*file format.*$objfile:\[ \]*file format.*push.*add.*sub.*str.*add.*ldmfd" + set got [binutils_run $OBJDUMP "-dr $objfile $objfile"] -if [regexp $want $got] then { - pass "multiple input files" -} else { - fail "multiple input files" -} + set want "$objfile:\[ \]*file format.*$objfile:\[ \]*file format.*push.*add.*sub.*str.*add.*ldmfd" -if {![binutils_assemble $srcdir/$subdir/rvct_symbol.s tmpdir/rvct_symbol.o]} then { - return + if [regexp $want $got] then { + pass "multiple input files" + } else { + fail "multiple input files" + } } -if [is_remote host] { - set objfile [remote_download host tmpdir/rvct_symbol.o] +if {![binutils_assemble $srcdir/$subdir/rvct_symbol.s tmpdir/rvct_symbol.o]} then { + fail "skip rvct symbol" } else { - set objfile tmpdir/rvct_symbol.o -} -# Make sure multiple disassemblies come out the same + if [is_remote host] { + set objfile [remote_download host tmpdir/rvct_symbol.o] + } else { + set objfile tmpdir/rvct_symbol.o + } -set got [binutils_run $OBJDUMP "-D $objfile $objfile"] + # Make sure multiple disassemblies come out the same -set want "foo.*global_a.*global_b" + set got [binutils_run $OBJDUMP "-D $objfile $objfile"] -if [regexp $want $got] then { - pass "skip rvct symbol" -} else { - fail "skip rvct symbol" + set want "foo.*global_a.*global_b" + + if [regexp $want $got] then { + pass "skip rvct symbol" + } else { + fail "skip rvct symbol" + } } |