Remove perror from ld_assemble, ld_compile and ld_nm
authorAlan Modra <amodra@gmail.com>
Sat, 20 Jun 2020 06:23:37 +0000 (15:53 +0930)
committerAlan Modra <amodra@gmail.com>
Sat, 20 Jun 2020 06:23:37 +0000 (15:53 +0930)
commit348fe36b1d64f12c60e08f6313520b3191663063
tree0ba7dba17349d8877b3c73e1685405e8933f660a
parentb0ee49d21ba0c4b7f9817db01dc247255eebd516
Remove perror from ld_assemble, ld_compile and ld_nm

ERROR should really be reserved for errors in the testsuite framework,
not just normal errors from the tools under test.  Removing use of
perror has been suggested before but without action, over concerns
that some test failures might be missed.  This patch removes uses of
perror in ld_assemble, ld_compile and ld_nm, and updates numerous
places that ignored the result of these functions by inappropriately
returning an "unresolved" test status.  Net result over my large set
of targets look good, in some cases improving the diagnostics, eg:

i386-msdos  -ERROR: tmpdir/script: nm failed
i386-msdos  -ERROR: tmpdir/script: nm failed
i386-msdos  -ERROR: tmpdir/script: nm failed
i386-msdos  -ERROR: tmpdir/script: nm failed
i386-msdos  +FAIL: script
i386-msdos  +FAIL: MRI script
i386-msdos  +FAIL: MEMORY
i386-msdos  +FAIL: MEMORY with symbols

* testsuite/lib/ld-lib.exp (default_ld_compile): Don't perror on
a compiler error.
(default_ld_assemble): Similarly for an assembler error.
(default_ld_nm): Similarly for an nm error.
(run_ld_link_tests): Report ld_assemble errors as a fail.
(check_as_cfi): Remove now unnecessary perror substitution.
* testsuite/ld-elf/exclude.exp: Report ld_nm error return as test
fails rather then unresolved.
* testsuite/ld-gc/gc.exp: Likewise.
* testsuite/ld-scripts/alignof.exp: Likewise.
* testsuite/ld-scripts/defined.exp: Likewise.
* testsuite/ld-scripts/script.exp: Likewise.
* testsuite/ld-scripts/sizeof.exp: Likewise.
* testsuite/ld-selective/selective.exp: Likewise.
* testsuite/ld-scripts/extern.exp: Likewise.  Return on ld_link
failure.
* testsuite/ld-elfweak/elfweak.exp: Report compiler errors as
test unresolved.
* testsuite/ld-fastcall/fastcall.exp: Report assember errors as
test fails.
* testsuite/ld-i386/i386.exp (iamcu_tests): Likewise.
* testsuite/ld-ia64/line.exp: Likewise.
* testsuite/ld-mep/mep.exp: Likewise.
* testsuite/ld-mips-elf/mips-elf-flags.exp: Likewise.
* testsuite/ld-nios2/nios2.exp: Likewise.
* testsuite/ld-scripts/alignof.exp: Likewise.
* testsuite/ld-x86-64/line.exp: Likewise.
* testsuite/ld-x86-64/x86-64.exp: Likewise.
* testsuite/ld-scripts/log2.exp: Formatting.
* testsuite/ld-tic6x/tic6x.exp: Report ld_link errors as a test fail.
21 files changed:
ld/ChangeLog
ld/testsuite/ld-elf/exclude.exp
ld/testsuite/ld-elfweak/elfweak.exp
ld/testsuite/ld-fastcall/fastcall.exp
ld/testsuite/ld-gc/gc.exp
ld/testsuite/ld-i386/i386.exp
ld/testsuite/ld-ia64/line.exp
ld/testsuite/ld-mep/mep.exp
ld/testsuite/ld-mips-elf/mips-elf-flags.exp
ld/testsuite/ld-nios2/nios2.exp
ld/testsuite/ld-scripts/alignof.exp
ld/testsuite/ld-scripts/defined.exp
ld/testsuite/ld-scripts/extern.exp
ld/testsuite/ld-scripts/log2.exp
ld/testsuite/ld-scripts/script.exp
ld/testsuite/ld-scripts/sizeof.exp
ld/testsuite/ld-selective/selective.exp
ld/testsuite/ld-tic6x/tic6x.exp
ld/testsuite/ld-x86-64/line.exp
ld/testsuite/ld-x86-64/x86-64.exp
ld/testsuite/lib/ld-lib.exp