From f795c49463234dc347ddd9a1b07ee5b506295b96 Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Fri, 15 Dec 2017 17:08:56 +1030 Subject: 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. --- binutils/testsuite/binutils-all/m68k/objdump.exp | 58 ++++++++++++------------ 1 file changed, 30 insertions(+), 28 deletions(-) (limited to 'binutils/testsuite/binutils-all/m68k/objdump.exp') diff --git a/binutils/testsuite/binutils-all/m68k/objdump.exp b/binutils/testsuite/binutils-all/m68k/objdump.exp index f1f53dd7559..10872525d72 100644 --- a/binutils/testsuite/binutils-all/m68k/objdump.exp +++ b/binutils/testsuite/binutils-all/m68k/objdump.exp @@ -30,25 +30,26 @@ send_user "Version [binutil_version $OBJDUMP]" ########################### if {![binutils_assemble $srcdir/$subdir/movem.s tmpdir/movem.o]} then { - return -} - -if [is_remote host] { - set objfile [remote_download host tmpdir/movem.o] + fail "movem test" } else { - set objfile tmpdir/movem.o -} -# Make sure that the movem is correctly decoded. + if [is_remote host] { + set objfile [remote_download host tmpdir/movem.o] + } else { + set objfile tmpdir/movem.o + } -set got [binutils_run $OBJDUMP "$OBJDUMPFLAGS --disassemble $objfile"] + # Make sure that the movem is correctly decoded. -set want "moveml %d0-%d3,%sp@-.*moveml %d0-%d3,%sp@\[\r\n\]" + set got [binutils_run $OBJDUMP "$OBJDUMPFLAGS --disassemble $objfile"] -if [regexp $want $got] then { - pass "movem test" -} else { - fail "movem test" + set want "moveml %d0-%d3,%sp@-.*moveml %d0-%d3,%sp@\[\r\n\]" + + if [regexp $want $got] then { + pass "movem test" + } else { + fail "movem test" + } } ########################### @@ -56,23 +57,24 @@ if [regexp $want $got] then { ########################### if {![binutils_assemble $srcdir/$subdir/fnop.s tmpdir/fnop.o]} then { - return -} - -if [is_remote host] { - set objfile [remote_download host tmpdir/fnop.o] + fail "fnop test" } else { - set objfile tmpdir/fnop.o -} -# Make sure that fnop is decoded as fnop, not fbf. + if [is_remote host] { + set objfile [remote_download host tmpdir/fnop.o] + } else { + set objfile tmpdir/fnop.o + } -set got [binutils_run $OBJDUMP "$OBJDUMPFLAGS --disassemble $objfile"] + # Make sure that fnop is decoded as fnop, not fbf. -set want "fnop *\[\r\n\]" + set got [binutils_run $OBJDUMP "$OBJDUMPFLAGS --disassemble $objfile"] -if [regexp $want $got] then { - pass "fnop test" -} else { - fail "fnop test" + set want "fnop *\[\r\n\]" + + if [regexp $want $got] then { + pass "fnop test" + } else { + fail "fnop test" + } } -- cgit v1.2.3-65-gdbad