diff options
author | Jose E. Marchesi <jose.marchesi@oracle.com> | 2016-07-27 06:59:16 -0700 |
---|---|---|
committer | Jose E. Marchesi <jose.marchesi@oracle.com> | 2016-07-29 00:17:04 -0700 |
commit | c88960d081f0b37ec03c66a13115e2a68e40d1ad (patch) | |
tree | 7e85bf4592f3da65142956460fdddd2c2f96a8f3 /gas | |
parent | 76539d80f708c535133c4a2a1eef61da305a3e80 (diff) | |
download | gdb-c88960d081f0b37ec03c66a13115e2a68e40d1ad.zip gdb-c88960d081f0b37ec03c66a13115e2a68e40d1ad.tar.gz gdb-c88960d081f0b37ec03c66a13115e2a68e40d1ad.tar.bz2 |
gas: avoid spurious failures in non-ELF targets in the SPARC testsuite.
Many of the existing sparc tests fail in non-ELF targets (coff and
a.out) due to spurious differences in the expected results:
- Unlike ELF, a.out text sections are aligned to 2**3 and padded
accordingly. The padding instruction is a `nop' (01 00 00 00).
- Likewise, coff text sections are also aligned to 2**3 and padded
accordingly. However, the padding instruction in these targets is an
`illtrap 0' (00 00 00 00).
- Unlike ELF, a.out and coff binaries don't contain hardware
capabilities bits that could be used by BFD to determine the opcodes
architecture corresponding to the instructions encoded in the
objects (v9, v9a, v9b, v9c, etc). Consequently, in both a.out and
coff tests we would need to pass proper `-m sparc:vXXX' options when
invoking objdump before comparing results.
In order to fix these issues, the most obvious solution would be to have
three variants of .d files per impacted test. For example, for save.d
we would have: save-elf.d, save-aout.d and save-coff.d. Using the
`#source' directive, a single save.s file would provide the input for
all of them. However, this approach has the following problems:
- The #target and #notarget .d directives are very limited: they use
globs instead of regular expressions, and thus it is not possible (or
too messy) to use them to discriminate between elf, coff and a.out
sparc targets.
- It adds little or no value to have variants of all these tests for all
the target types, and it would be a burden to maintain them. Actually
the features tested in the spuriously failing tests (relatively modern
sparc instructions, registers and asis) are not really found in
running coff or a.out sparc systems.
This patch changes sparc.exp so it will run these tests only in
ELF-targets, using the more standard `is_elf_format' from
binutils-common.exp instead of the ad-hoc (and less convenient, as it
must be called before _every_ single elf-only test) sparc_elf_setup.
Incidentally, the patch also fixes the #name entry for save-args.d.
Tested in sparc*-*-linux-gnu, sparc-aout and sparc-coff targets.
gas/ChangeLog:
2016-07-27 Jose E. Marchesi <jose.marchesi@oracle.com>
* testsuite/gas/sparc/sparc.exp: Use is_elf_format to discriminate
ELF targets.
Run natural, natural-32, pr4587, ticc-imm-reg, v8-movwr-imm,
pause, save-args, cbcond, cfr, crypto edge, flush, hpcvis3, ima,
ld_st_fsr, ldtw_sttw, ldd_std, ldx_stx, ldx_efsr, mwait, mcdper,
sparc5vis4, xcrypto, v9branch1 and imm-plus-rreg only in ELF
targets.
(sparc_elf_setup): Delete.
* testsuite/gas/sparc/save-args.d: Fix a copy-paste typo in the
test's #name entry.
Diffstat (limited to 'gas')
-rw-r--r-- | gas/ChangeLog | 13 | ||||
-rw-r--r-- | gas/testsuite/gas/sparc/save-args.d | 2 | ||||
-rw-r--r-- | gas/testsuite/gas/sparc/sparc.exp | 89 |
3 files changed, 56 insertions, 48 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog index 0273942..9ffb962 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,16 @@ +2016-07-27 Jose E. Marchesi <jose.marchesi@oracle.com> + + * testsuite/gas/sparc/sparc.exp: Use is_elf_format to discriminate + ELF targets. + Run natural, natural-32, pr4587, ticc-imm-reg, v8-movwr-imm, + pause, save-args, cbcond, cfr, crypto edge, flush, hpcvis3, ima, + ld_st_fsr, ldtw_sttw, ldd_std, ldx_stx, ldx_efsr, mwait, mcdper, + sparc5vis4, xcrypto, v9branch1 and imm-plus-rreg only in ELF + targets. + (sparc_elf_setup): Delete. + * testsuite/gas/sparc/save-args.d: Fix a copy-paste typo in the + test's #name entry. + 2016-07-27 Maciej W. Rozycki <macro@imgtec.com> * config/tc-mips.c (RELAX_MICROMIPS_ENCODE): Add `nods' flag. diff --git a/gas/testsuite/gas/sparc/save-args.d b/gas/testsuite/gas/sparc/save-args.d index 19e6d72..af21100 100644 --- a/gas/testsuite/gas/sparc/save-args.d +++ b/gas/testsuite/gas/sparc/save-args.d @@ -1,6 +1,6 @@ #as: -Av8 #objdump: -dr -#name: software traps +#name: save args .*: +file format .* diff --git a/gas/testsuite/gas/sparc/sparc.exp b/gas/testsuite/gas/sparc/sparc.exp index f0a129d..8cb0904 100644 --- a/gas/testsuite/gas/sparc/sparc.exp +++ b/gas/testsuite/gas/sparc/sparc.exp @@ -31,25 +31,47 @@ proc gas_64_check { } { return [regexp "elf64\[_-\]sparc" [lindex $status 1]] } -proc sparc_elf_setup { } { - setup_xfail "sparc*-*-*aout*" "sparc*-*-sunos4*" - setup_xfail "sparc*-fujitsu-none" "sparc*-*-*n*bsd*" - setup_xfail "sparc*-*-coff" "sparc*-*-lynxos*" - clear_xfail "sparc64*-*-*n*bsd*" - clear_xfail "sparc*-*-netbsdelf*" -} - if [istarget sparc*-*-*] { - run_dump_test "synth" - # The next four tests are ELF only. - sparc_elf_setup - run_dump_test "unalign" - sparc_elf_setup - run_dump_test "pcrel" - sparc_elf_setup - run_dump_test "plt" - sparc_elf_setup - run_dump_test "gotop32" + + if [is_elf_format] { + # The next five tests are ELF only. + run_dump_test "unalign" + run_dump_test "pcrel" + run_dump_test "plt" + run_dump_test "gotop32" + run_dump_test "pc2210" + # The features tested in the tests below are not ELF-specific. + # However, these features are not present in practice in COFF + # and a.out targets. Running them only in ELF targets allows + # us to don't have to replicate pattern test files as that + # would bring no practical advantage. + run_dump_test "natural" + run_dump_test "natural-32" + run_list_test "pr4587" "" + run_dump_test "ticc-imm-reg" + run_dump_test "v8-movwr-imm" + run_dump_test "pause" + run_dump_test "save-args" + run_dump_test "cbcond" + run_dump_test "cfr" + run_dump_test "crypto" + run_dump_test "edge" + run_dump_test "flush" + run_dump_test "hpcvis3" + run_dump_test "ima" + run_dump_test "ld_st_fsr" + run_dump_test "ldtw_sttw" + run_dump_test "ldd_std" + run_dump_test "ldx_stx" + run_dump_test "ldx_efsr" + run_dump_test "mwait" + run_dump_test "mcdper" + run_dump_test "sparc5vis4" + run_dump_test "xcrypto" + run_dump_test "v9branch1" + run_dump_test "imm-plus-rreg" + } + if [gas_64_check] { run_dump_test "asi" run_dump_test "membar" @@ -68,39 +90,12 @@ if [istarget sparc*-*-*] { run_dump_test "plt64" run_dump_test "gotop64" } - run_dump_test "imm-plus-rreg" - run_dump_test "ticc-imm-reg" - run_dump_test "v8-movwr-imm" - run_dump_test "save-args" - run_dump_test "v9branch1" + + run_dump_test "synth" run_dump_test "v9branch2" run_dump_test "v9branch3" run_dump_test "v9branch4" run_dump_test "v9branch5" - run_dump_test "pc2210" - run_dump_test "hpcvis3" - run_dump_test "ima" - run_dump_test "crypto" - run_dump_test "xcrypto" - run_dump_test "cbcond" - run_dump_test "pause" - run_dump_test "cfr" - run_dump_test "ldtw_sttw" - run_dump_test "ldtxa" - run_dump_test "ldd_std" - run_dump_test "ldx_stx" - run_dump_test "ldx_efsr" - run_dump_test "ld_st_fsr" - run_dump_test "edge" - run_dump_test "flush" - run_dump_test "mwait" - run_dump_test "mcdper" - run_dump_test "sparc5vis4" - run_dump_test "natural" - run_dump_test "natural-32" - - run_list_test "pr4587" "" - run_dump_test "pr19910-1" run_list_test "pr19910-2" } |