Test binutils_assemble return value
authorAlan Modra <amodra@gmail.com>
Fri, 15 Dec 2017 06:38:56 +0000 (17:08 +1030)
committerAlan Modra <amodra@gmail.com>
Mon, 18 Dec 2017 20:21:33 +0000 (06:51 +1030)
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.

12 files changed:
binutils/ChangeLog
binutils/testsuite/binutils-all/ar.exp
binutils/testsuite/binutils-all/arc/objdump.exp
binutils/testsuite/binutils-all/arm/objdump.exp
binutils/testsuite/binutils-all/bfin/objdump.exp
binutils/testsuite/binutils-all/hppa/objdump.exp
binutils/testsuite/binutils-all/m68k/objdump.exp
binutils/testsuite/binutils-all/nm.exp
binutils/testsuite/binutils-all/objcopy.exp
binutils/testsuite/binutils-all/objdump.exp
binutils/testsuite/binutils-all/size.exp
binutils/testsuite/binutils-all/vax/objdump.exp

index ee53c3a8773e215ad3c5c7f1cb5f468b0ea933d8..f83aa5ca7936dc889af1bff597477a48330df9a7 100644 (file)
@@ -1,3 +1,20 @@
+2017-12-19  Alan Modra  <amodra@gmail.com>
+
+       * 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.
+
 2017-12-18  Nick Clifton  <nickc@redhat.com>
 
        PR 22532
index 7b93cc6e40b1b0e0dae52d0bf910de368133d855..ca422d12c62730b8c537a5f3f2961c6d7acf821d 100644 (file)
@@ -449,6 +449,7 @@ proc unique_symbol { } {
 
     if ![binutils_assemble $srcdir/$subdir/unique.s tmpdir/unique.o] {
        unresolved $testname
+       return
     }
 
     if [is_remote host] {
index a4e6ef05b637a6ddba7e47375a946da00d077567..9748d4ac6ab7a9cff164ee0403a6799c45648d34 100644 (file)
@@ -52,6 +52,10 @@ proc check_assembly { testname objfile expected { disas_flags "" } } {
     global OBJDUMP
     global OBJDUMPFLAGS
 
+    if [string equal "" $objfile] then {
+       fail $testname
+       return
+    }
     set got [binutils_run $OBJDUMP "$OBJDUMPFLAGS --disassemble $disas_flags \
        $objfile"]
 
index 0e74ebbe36880fec844ab6c540a865a4966da698..3485d3aa46072f37b578119841ac972d9ff22063 100644 (file)
@@ -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"
+    }
 }
index 13305fc273441589cae856726d2c78a3a84e259d..e063a624ff86c78040a57134e9716c1d3702fcde 100644 (file)
@@ -30,23 +30,24 @@ send_user "Version [binutil_version $OBJDUMP]"
 ###################################
 
 if {![binutils_assemble $srcdir/$subdir/unknown-mode.s tmpdir/unknown-mode.o]} then {
-    return
-}
-
-if [is_remote host] {
-    set objfile [remote_download host tmpdir/unknown-mode.o]
+    fail "unknown mode test (assembling)"
 } else {
-    set objfile tmpdir/unknown-mode.o
-}
 
-# Make sure that the unknown mode does not cause abort.
+    if [is_remote host] {
+       set objfile [remote_download host tmpdir/unknown-mode.o]
+    } else {
+       set objfile tmpdir/unknown-mode.o
+    }
 
-set got [binutils_run $OBJDUMP "$OBJDUMPFLAGS -D $objfile"]
+    # Make sure that the unknown mode does not cause abort.
 
-set want "e1 c1\[ \t\]*ILLEGAL.*34 98 .*\[\r\n\]"
+    set got [binutils_run $OBJDUMP "$OBJDUMPFLAGS -D $objfile"]
 
-if [regexp $want $got] then {
-    pass "unknown mode test"
-} else {
-    fail "unknown mode test"
+    set want "e1 c1\[ \t\]*ILLEGAL.*34 98 .*\[\r\n\]"
+
+    if [regexp $want $got] then {
+       pass "unknown mode test"
+    } else {
+       fail "unknown mode test"
+    }
 }
index b834a22f9c3958b98d3ddc1e2856b104b4fccef4..3f69f34a3f73476488c88f72200f710dc7a413a7 100644 (file)
@@ -42,30 +42,31 @@ if {[which $OBJDUMP] == 0} then {
 send_user "Version [binutil_version $OBJDUMP]"
 
 if {![binutils_assemble $srcdir/$subdir/addendbug.s tmpdir/addendbug.o]} then {
-    return
-}
-
-if [is_remote host] {
-    set objfile [remote_download host tmpdir/addendbug.o]
+    fail "addendbug test (assembling)"
 } else {
-    set objfile tmpdir/addendbug.o
-}
 
-# Make sure the SOM BFD code sign extends constants in R_DATA_OVERRIDE fixups.
+    if [is_remote host] {
+       set objfile [remote_download host tmpdir/addendbug.o]
+    } else {
+       set objfile tmpdir/addendbug.o
+    }
 
-set got [binutils_run $OBJDUMP "$OBJDUMPFLAGS -r $objfile"]
+    # Make sure the SOM BFD code sign extends constants in
+    # R_DATA_OVERRIDE fixups.
 
-if [istarget hppa*-*-*elf*] then {
-  set want "00000000 R_PARISC_DPREL21L\[       \]+is_idchar-0x00000020.*"
-} else {
-  set want "00000000 R_DP_RELATIVE\[   \]+is_idchar-0x00000020.*"
-}
+    set got [binutils_run $OBJDUMP "$OBJDUMPFLAGS -r $objfile"]
 
+    if [istarget hppa*-*-*elf*] then {
+       set want "00000000 R_PARISC_DPREL21L\[  \]+is_idchar-0x00000020.*"
+    } else {
+       set want "00000000 R_DP_RELATIVE\[      \]+is_idchar-0x00000020.*"
+    }
 
-if [regexp $want $got] then {
-    pass "addendbug test"
-} else {
-    fail "addendbug test"
+    if [regexp $want $got] then {
+       pass "addendbug test"
+    } else {
+       fail "addendbug test"
+    }
 }
 
 ###########################
@@ -73,23 +74,24 @@ if [regexp $want $got] then {
 ###########################
 
 if {![binutils_assemble $srcdir/$subdir/freg.s tmpdir/freg.o]} then {
-    return
-}
-
-if [is_remote host] {
-    set objfile [remote_download host tmpdir/freg.o]
+    fail "freg test (assembling)"
 } else {
-    set objfile tmpdir/freg.o
-}
 
-# Make sure that we get R float regs like we're supposed to
+    if [is_remote host] {
+       set objfile [remote_download host tmpdir/freg.o]
+    } else {
+       set objfile tmpdir/freg.o
+    }
 
-set got [binutils_run $OBJDUMP "$OBJDUMPFLAGS --disassemble $objfile"]
+    # Make sure that we get R float regs like we're supposed to
 
-set want "fmpyfadd,sgl fr4,fr4R,fr5R,fr5"
+    set got [binutils_run $OBJDUMP "$OBJDUMPFLAGS --disassemble $objfile"]
 
-if [regexp $want $got] then {
-    pass "freg test"
-} else {
-    fail "freg test"
+    set want "fmpyfadd,sgl fr4,fr4R,fr5R,fr5"
+
+    if [regexp $want $got] then {
+       pass "freg test"
+    } else {
+       fail "freg test"
+    }
 }
index f1f53dd7559202e420790c61ae48543f8a920cb6..10872525d726e8a14d201f18d1f0c5eae732ffe5 100644 (file)
@@ -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"
+    }
 }
index e60e061ee6c668da3439e28c1e1b72e363cbf46e..8cdd3d1ea0060f534157bf1fc7553f2885db1af0 100644 (file)
@@ -31,119 +31,94 @@ send_user "Version [binutil_version $NM]"
 
 
 if {![binutils_assemble $srcdir/$subdir/bintest.s tmpdir/bintest.o]} then {
-    return
-}
-
-if [is_remote host] {
-    set tempfile [remote_download host tmpdir/bintest.o]
+    fail "nm (assembling)"
 } else {
-    set tempfile tmpdir/bintest.o
-}
 
-# Test nm with no arguments.
+    if [is_remote host] {
+       set tempfile [remote_download host tmpdir/bintest.o]
+    } else {
+       set tempfile tmpdir/bintest.o
+    }
 
-# This test does not work correctly on ECOFF targets, because ECOFF
-# stores most symbols twice, which messes up the nm output.
-setup_xfail "alpha*-*-osf*" "alpha*-*-netware*"
-setup_xfail "mips*-*-ultrix*" "mips*-*-ecoff*" "mips*-*-irix4*"
-setup_xfail "mips*-*-riscos*" "mips*-*-sysv3*" "mips*-sony-bsd*"
+    # Test nm with no arguments.
 
-# This test does not work correctly on XCOFF targets, because XCOFF
-# does not enter static symbols in the symbol table.
-setup_xfail "*-*-aix*"
+    # This test does not work correctly on ECOFF targets, because ECOFF
+    # stores most symbols twice, which messes up the nm output.
+    setup_xfail "alpha*-*-osf*" "alpha*-*-netware*"
+    setup_xfail "mips*-*-ultrix*" "mips*-*-ecoff*" "mips*-*-irix4*"
+    setup_xfail "mips*-*-riscos*" "mips*-*-sysv3*" "mips*-sony-bsd*"
 
-set got [binutils_run $NM "$NMFLAGS $tempfile"]
+    # This test does not work correctly on XCOFF targets, because XCOFF
+    # does not enter static symbols in the symbol table.
+    setup_xfail "*-*-aix*"
 
-if [info exists vars] then { unset vars }
-while {[regexp "(\[a-zA-Z\]) (\[a-z_\]*_symbol)(.*)" $got all type symbol rest]} {
-    set vars($symbol) $type
-    set got $rest
-}
+    set got [binutils_run $NM "$NMFLAGS $tempfile"]
 
-if {![info exists vars(text_symbol)] \
-     || $vars(text_symbol) != "T" \
-     || ![info exists vars(data_symbol)] \
-     || $vars(data_symbol) != "D" \
-     || ![info exists vars(common_symbol)] \
-     || $vars(common_symbol) != "C" \
-     || ![info exists vars(external_symbol)] \
-     || $vars(external_symbol) != "U" \
-     || ![info exists vars(static_text_symbol)] \
-     || $vars(static_text_symbol) != "t" \
-     || ![info exists vars(static_data_symbol)] \
-     || $vars(static_data_symbol) != "d"} {
-    fail "nm (no arguments)"
-} else {
-    pass "nm (no arguments)"
-}
+    if [info exists vars] then { unset vars }
+    while {[regexp "(\[a-zA-Z\]) (\[a-z_\]*_symbol)(.*)" $got all type symbol rest]} {
+       set vars($symbol) $type
+       set got $rest
+    }
 
-# Test nm -g
+    if {![info exists vars(text_symbol)] \
+           || $vars(text_symbol) != "T" \
+           || ![info exists vars(data_symbol)] \
+           || $vars(data_symbol) != "D" \
+           || ![info exists vars(common_symbol)] \
+           || $vars(common_symbol) != "C" \
+           || ![info exists vars(external_symbol)] \
+           || $vars(external_symbol) != "U" \
+           || ![info exists vars(static_text_symbol)] \
+           || $vars(static_text_symbol) != "t" \
+           || ![info exists vars(static_data_symbol)] \
+           || $vars(static_data_symbol) != "d"} {
+       fail "nm (no arguments)"
+    } else {
+       pass "nm (no arguments)"
+    }
 
-set got [binutils_run $NM "$NMFLAGS -g $tempfile"]
+    # Test nm -g
 
-if [info exists vars] then { unset vars }
-while {[regexp "(\[a-z_\]*_symbol)(.*)" $got all symbol rest]} {
-    set vars($symbol) 1
-    set got $rest
-}
+    set got [binutils_run $NM "$NMFLAGS -g $tempfile"]
 
-if {![info exists vars(text_symbol)] \
-     || ![info exists vars(data_symbol)] \
-     || ![info exists vars(common_symbol)] \
-     || ![info exists vars(external_symbol)] \
-     || [info exists vars(static_text_symbol)] \
-     || [info exists vars(static_data_symbol)]} {
-    fail "nm -g"
-} else {
-    pass "nm -g"
-}
+    if [info exists vars] then { unset vars }
+    while {[regexp "(\[a-z_\]*_symbol)(.*)" $got all symbol rest]} {
+       set vars($symbol) 1
+       set got $rest
+    }
 
-if [is_elf_format] {
-    # PR binutils/12753
-    # Test nm -g on a unique global symbol.
-    if {![binutils_assemble $srcdir/$subdir/unique.s tmpdir/unique.o]} then {
-       unsupported "nm -g on unique symbols"
+    if {![info exists vars(text_symbol)] \
+           || ![info exists vars(data_symbol)] \
+           || ![info exists vars(common_symbol)] \
+           || ![info exists vars(external_symbol)] \
+           || [info exists vars(static_text_symbol)] \
+           || [info exists vars(static_data_symbol)]} {
+       fail "nm -g"
     } else {
-       if [is_remote host] {
-           set tmpfile [remote_download host tmpdir/unique.o]
-       } else {
-           set tmpfile tmpdir/unique.o
-       }
-
-       set got [binutils_run $NM "$NMFLAGS -g $tmpfile"]
-
-       if [regexp "u foo" $got] then {
-           pass "nm -g on unique symbols"
-       } else {
-           fail "nm -g on unique symbols"
-       }
-
-       if { $verbose < 1 } {
-           remote_file host delete "tmpdir/unique.o"
-       }
+       pass "nm -g"
     }
-}
 
-# Test nm -P
+    # Test nm -P
 
-# This test does not work correctly on ECOFF targets, because ECOFF
-# stores most symbols twice, which messes up the nm output.
-setup_xfail "alpha*-*-osf*" "alpha*-*-netware*"
-setup_xfail "mips*-*-ultrix*" "mips*-*-ecoff*" "mips*-*-irix4*"
-setup_xfail "mips*-*-riscos*" "mips*-*-sysv3*" "mips*-sony-bsd*"
+    # This test does not work correctly on ECOFF targets, because ECOFF
+    # stores most symbols twice, which messes up the nm output.
+    setup_xfail "alpha*-*-osf*" "alpha*-*-netware*"
+    setup_xfail "mips*-*-ultrix*" "mips*-*-ecoff*" "mips*-*-irix4*"
+    setup_xfail "mips*-*-riscos*" "mips*-*-sysv3*" "mips*-sony-bsd*"
 
-# This test does not work correctly on XCOFF targets, because XCOFF
-# does not enter static symbols in the symbol table.
-setup_xfail "*-*-aix*"
+    # This test does not work correctly on XCOFF targets, because XCOFF
+    # does not enter static symbols in the symbol table.
+    setup_xfail "*-*-aix*"
 
-set got [binutils_run $NM "$NMFLAGS -P $tempfile"]
+    set got [binutils_run $NM "$NMFLAGS -P $tempfile"]
 
-set want "common_symbol C \[0\]*4.*data_symbol D \[0-9a-fA-F\]*.*external_symbol U.*static_data_symbol d \[0-9a-fA-F\]*.*static_text_symbol t \[0-9a-fA-F\]*.*text_symbol T \[0-9a-fA-F\]*"
+    set want "common_symbol C \[0\]*4.*data_symbol D \[0-9a-fA-F\]*.*external_symbol U.*static_data_symbol d \[0-9a-fA-F\]*.*static_text_symbol t \[0-9a-fA-F\]*.*text_symbol T \[0-9a-fA-F\]*"
 
-if [regexp $want $got] then {
-    pass "nm -P"
-} else {
-    fail "nm -P"
+    if [regexp $want $got] then {
+       pass "nm -P"
+    } else {
+       fail "nm -P"
+    }
 }
 
 # Test nm --size-sort
@@ -174,32 +149,57 @@ if {   [is_elf_format]
 }
 
 if {![binutils_assemble $srcdir/$subdir/$nm_1_src tmpdir/nm-1.o]} then {
-    return
-}
-
-if [is_remote host] {
-    set tempfile [remote_download host tmpdir/nm-1.o]
+    fail "nm --size-sort (assembling)"
 } else {
-    set tempfile tmpdir/nm-1.o
-}
 
-# This test does not work correctly on ECOFF targets, because ECOFF
-# stores most symbols twice, which messes up the nm output.
-setup_xfail "alpha*-*-osf*" "alpha*-*-netware*"
-setup_xfail "mips*-*-ultrix*" "mips*-*-ecoff*" "mips*-*-irix4*"
-setup_xfail "mips*-*-riscos*" "mips*-*-sysv3*" "mips*-sony-bsd*"
+    if [is_remote host] {
+       set tempfile [remote_download host tmpdir/nm-1.o]
+    } else {
+       set tempfile tmpdir/nm-1.o
+    }
 
-set got [binutils_run $NM "$NMFLAGS --size-sort $tempfile"]
+    # This test does not work correctly on ECOFF targets, because ECOFF
+    # stores most symbols twice, which messes up the nm output.
+    setup_xfail "alpha*-*-osf*" "alpha*-*-netware*"
+    setup_xfail "mips*-*-ultrix*" "mips*-*-ecoff*" "mips*-*-irix4*"
+    setup_xfail "mips*-*-riscos*" "mips*-*-sysv3*" "mips*-sony-bsd*"
 
-set want "0*4 T text_symbol3.*0*8 T text_symbol2.*0*c T text_symbol1"
+    set got [binutils_run $NM "$NMFLAGS --size-sort $tempfile"]
 
-if [regexp $want $got] then {
-    pass "nm --size-sort"
-} else {
-    fail "nm --size-sort"
+    set want "0*4 T text_symbol3.*0*8 T text_symbol2.*0*c T text_symbol1"
+
+    if [regexp $want $got] then {
+       pass "nm --size-sort"
+    } else {
+       fail "nm --size-sort"
+    }
 }
 
 if [is_elf_format] {
+    # PR binutils/12753
+    # Test nm -g on a unique global symbol.
+    if {![binutils_assemble $srcdir/$subdir/unique.s tmpdir/unique.o]} then {
+       unsupported "nm -g on unique symbols"
+    } else {
+       if [is_remote host] {
+           set tmpfile [remote_download host tmpdir/unique.o]
+       } else {
+           set tmpfile tmpdir/unique.o
+       }
+
+       set got [binutils_run $NM "$NMFLAGS -g $tmpfile"]
+
+       if [regexp "u foo" $got] then {
+           pass "nm -g on unique symbols"
+       } else {
+           fail "nm -g on unique symbols"
+       }
+
+       if { $verbose < 1 } {
+           remote_file host delete "tmpdir/unique.o"
+       }
+    }
+
     # PR binutils/20751
     # Test nm --with-symbol-versions
 
index ef62edfe5dc0d9fbd4c3004a9c6b68d19a906602..4695724659435ebfe14cfa26c60daa11b234f00b 100644 (file)
@@ -47,7 +47,6 @@ proc objcopy_test {testname srcfile} {
     global copyfile
 
     if {![binutils_assemble $srcdir/$subdir/${srcfile} $tempfile]} then {
-       perror "unresolved $testname"
        unresolved "objcopy ($testname)"
        remote_file host delete $tempfile
        return
index 8ee350ff89013cdb5d273336aec11e7e07b85324..e780bb5fa9fb820ef03e7fcbfec45f10adaa8b87 100644 (file)
@@ -62,9 +62,11 @@ if [regexp $want $got] then {
 
 
 if {![binutils_assemble $srcdir/$subdir/bintest.s tmpdir/bintest.o]} then {
+    fail "objdump (assembling)"
     return
 }
 if {![binutils_assemble $srcdir/$subdir/bintest.s tmpdir/bintest2.o]} then {
+    fail "objdump (assembling)"
     return
 }
 if [is_remote host] {
index 81dacab15ec17a52638f77e248c273f2ba252ec6..a01b3686d67f7f7bf00a7d18f081f5cd42988a9b 100644 (file)
@@ -31,51 +31,52 @@ send_user "Version [binutil_version $SIZE]"
 
 
 if {![binutils_assemble $srcdir/$subdir/bintest.s tmpdir/bintest.o]} then {
-    return
-}
-
-if [is_remote host] {
-    set testfile [remote_download host tmpdir/bintest.o]
+    fail "size (assembling)"
 } else {
-    set testfile tmpdir/bintest.o
-}
 
-set dec "\[0-9\]+"
-set hex "\[0-9a-fA-F\]+"
+    if [is_remote host] {
+       set testfile [remote_download host tmpdir/bintest.o]
+    } else {
+       set testfile tmpdir/bintest.o
+    }
 
-# Test size with no arguments
+    set dec "\[0-9\]+"
+    set hex "\[0-9a-fA-F\]+"
 
-set got [binutils_run $SIZE "$SIZEFLAGS $testfile"]
+    # Test size with no arguments
 
-set want "($dec)\[     \]+($dec)\[     \]+($dec)\[     \]+($dec)\[     \]+($hex)\[     \]+${testfile}"
+    set got [binutils_run $SIZE "$SIZEFLAGS $testfile"]
 
-if ![regexp $want $got all text data bss dtot hextot] then {
-    fail "size (no arguments)"
-} else {
-    if {$text < 8 || $data < 4} then {
-       # The z80-coff port defaults to a "binary" like output
-       # file format which does not include a data section.
-       setup_xfail "z80-*-coff"
+    set want "($dec)\[         \]+($dec)\[     \]+($dec)\[     \]+($dec)\[     \]+($hex)\[     \]+${testfile}"
+
+    if ![regexp $want $got all text data bss dtot hextot] then {
        fail "size (no arguments)"
     } else {
-       pass "size (no arguments)"
+       if {$text < 8 || $data < 4} then {
+           # The z80-coff port defaults to a "binary" like output
+           # file format which does not include a data section.
+           setup_xfail "z80-*-coff"
+           fail "size (no arguments)"
+       } else {
+           pass "size (no arguments)"
+       }
     }
-}
 
-# Test size -A
+    # Test size -A
 
-set got [binutils_run $SIZE "$SIZEFLAGS -A ${testfile}"]
+    set got [binutils_run $SIZE "$SIZEFLAGS -A ${testfile}"]
 
-set want "${testfile}.*(text|TEXT|P)\[^\n\r\]*\[       \]($dec)\[      \]+$dec.*(\\.data|DATA|D_1)\[^\n\r\]*\[         \]($dec)\[      \]+$dec"
+    set want "${testfile}.*(text|TEXT|P)\[^\n\r\]*\[   \]($dec)\[      \]+$dec.*(\\.data|DATA|D_1)\[^\n\r\]*\[         \]($dec)\[      \]+$dec"
 
-if ![regexp $want $got all textname textsize dataname datasize] then {
-    fail "size -A"
-} else {
-    verbose "text size: $textsize"
-    verbose "data size: $datasize"
-    if {$textsize < 8 || $datasize < 4} then {
+    if ![regexp $want $got all textname textsize dataname datasize] then {
        fail "size -A"
     } else {
-       pass "size -A"
+       verbose "text size: $textsize"
+       verbose "data size: $datasize"
+       if {$textsize < 8 || $datasize < 4} then {
+           fail "size -A"
+       } else {
+           pass "size -A"
+       }
     }
 }
index 5f9b54712c742f2236191411ab0d7b90a2232c1a..b3d09f8f1388035a979c2a72fa6dcd57a2790a5c 100644 (file)
@@ -34,30 +34,31 @@ if {[which $OBJDUMP] == 0} then {
 send_user "Version [binutil_version $OBJDUMP]"
 
 if {![binutils_assemble $srcdir/$subdir/entrymask.s tmpdir/entrymask.o]} then {
-    return
-}
-
-if [is_remote host] {
-    set objfile [remote_download host tmpdir/entrymask.o]
+    fail "entrymask test (assembling)"
 } else {
-    set objfile tmpdir/entrymask.o
-}
 
-#
-# We check both function entry points. The second one at offset 2 will
-# show up automatically on ELF targets, but needs to be set on a.out
-# targets.
-#
-set got [binutils_run $OBJDUMP "$OBJDUMPFLAGS -d -M entry:0x0 -M entry:2 $objfile"]
-set want1 "\[  \]+0:\[         \]+10 01\[      \]+\\.word 0x0110.\*r8 r4"
-set want2 "\[  \]+2:\[         \]+24 02\[      \]+\\.word 0x0224.\*r9 r5 r2"
-if [regexp $want1 $got] then {
-    pass "entrymask test 1"
-} else {
-    fail "entrymask test 1"
-}
-if [regexp $want2 $got] then {
-    pass "entrymask test 2"
-} else {
-    fail "entrymask test 2"
+    if [is_remote host] {
+       set objfile [remote_download host tmpdir/entrymask.o]
+    } else {
+       set objfile tmpdir/entrymask.o
+    }
+
+    #
+    # We check both function entry points. The second one at offset 2 will
+    # show up automatically on ELF targets, but needs to be set on a.out
+    # targets.
+    #
+    set got [binutils_run $OBJDUMP "$OBJDUMPFLAGS -d -M entry:0x0 -M entry:2 $objfile"]
+    set want1 "\[      \]+0:\[         \]+10 01\[      \]+\\.word 0x0110.\*r8 r4"
+    set want2 "\[      \]+2:\[         \]+24 02\[      \]+\\.word 0x0224.\*r9 r5 r2"
+    if [regexp $want1 $got] then {
+       pass "entrymask test 1"
+    } else {
+       fail "entrymask test 1"
+    }
+    if [regexp $want2 $got] then {
+       pass "entrymask test 2"
+    } else {
+       fail "entrymask test 2"
+    }
 }
This page took 0.038202 seconds and 4 git commands to generate.