This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [PATCH 11/15] MIPS/GAS/test: Add file format overrides
On Sun, 10 Oct 2010, Richard Sandiford wrote:
> This is subtle enough that it needs to be documented. How about
> adding something like this after the current run_dump_test_arch comment:
>
> # You can override the expected output for particular architectures
> # and file formats. The possible test names are, in order of preference:
> #
> # 1. CARCH@FORMAT@NAME.d
> # 2. CARCH@NAME.d
> # 3. FORMAT@NAME.d
> # 4. NAME.d
> #
> # where CARCH is the "canonical" name of architecture ARCH and where
> # FORMAT is the target's file format ("elf", "ecoff" or "aout").
Indeed. I have applied your comment with some small adjustments.
> > * gas/mips/mips.exp (run_dump_test_arch): Check for the presence
> > of a file-format-specific test too.
> > (run_dump_test_arches): Pull elf, ecoff and aout variables for use
> > by the above.
>
> OK with that change, thanks.
This is the change I have eventually committed, thanks.
Maciej
Index: binutils-2.20.51/gas/testsuite/gas/mips/mips.exp
===================================================================
--- binutils-2.20.51.orig/gas/testsuite/gas/mips/mips.exp
+++ binutils-2.20.51/gas/testsuite/gas/mips/mips.exp
@@ -286,13 +286,30 @@ proc mips_arch_list_matching {args} {
#
# Invoke "run_dump_test" for test NAME, with extra assembler and
# disassembler flags to test architecture ARCH.
+#
+# You can override the expected output for particular architectures
+# and file formats. The possible test names are, in order of preference:
+#
+# 1. CARCH@FORMAT@NAME.d
+# 2. CARCH@NAME.d
+# 3. FORMAT@NAME.d
+# 4. NAME.d
+#
+# where CARCH is the "canonical" name of architecture ARCH as recorded
+# in its associated property list, and where FORMAT is the target's
+# file format (one of "elf", "ecoff" or "aout").
proc run_dump_test_arch { name arch } {
+ upvar elf elf ecoff ecoff aout aout
global subdir srcdir
+ set format [expr { $elf ? "elf" : $ecoff ? "ecoff" : "aout" }]
set proparch [lindex [mips_arch_properties $arch 0] 0]
- set archname "${proparch}@${name}"
- if { [file exists "$srcdir/$subdir/${archname}.d"] } {
- set name $archname
+ foreach prefix [list ${proparch}@${format}@ ${proparch}@ ${format}@] {
+ set archname ${prefix}${name}
+ if { [file exists "$srcdir/$subdir/${archname}.d"] } {
+ set name $archname
+ break
+ }
}
if [catch {run_dump_test $name \
@@ -309,6 +326,7 @@ proc run_dump_test_arch { name arch } {
# Invoke "run_dump_test_arch" for test NAME, for each architecture
# listed in ARCH_LIST.
proc run_dump_test_arches { name arch_list } {
+ upvar elf elf ecoff ecoff aout aout
foreach arch $arch_list {
run_dump_test_arch "$name" "$arch"
}