binutils: testsuite: avoid dup names when using multiple as: directives

binutils tests support running a test with distinct options to the
assembler by allowing

	#as: <optset-1>
	#as: <optset-2>

But results in both test runs using the same test name in the summary
file.  This causes confusion if one test fails but the other doesn't
(and GCC's compare_tests script will diagnose this as an error).  To
fix the ambiguity append the appropriate optset to the test name.

We only do this if a test has multiple runs in this way to avoid
causing every test result name to change.
This commit is contained in:
Richard Earnshaw
2025-09-15 15:52:23 +01:00
parent a2b55b8fde
commit f52a9a2b06

View File

@@ -1174,17 +1174,17 @@ proc run_dump_test { name {extra_options {}} } {
[big_or_little_endian] opts(ld) [big_or_little_endian] opts(ld)
if { $opts(name) == "" } { if { $opts(name) == "" } {
set testname "$subdir/$name" set base_testname "$subdir/$name"
} else { } else {
set testname $opts(name) set base_testname $opts(name)
} }
set err_warn 0 set err_warn 0
foreach opt { warning error warning_output error_output } { foreach opt { warning error warning_output error_output } {
if { $opts($opt) != "" } { if { $opts($opt) != "" } {
if { $err_warn } { if { $err_warn } {
perror "$testname: bad mix of warning and error test directives" perror "$base_testname: bad mix of warning and error test directives"
unresolved $testname unresolved $base_testname
return return
} }
set err_warn 1 set err_warn 1
@@ -1223,19 +1223,19 @@ proc run_dump_test { name {extra_options {}} } {
} }
} }
if { $targmatch == 0 } { if { $targmatch == 0 } {
unsupported $testname unsupported $base_testname
return return
} }
} }
foreach targ $opts(alltargets) { foreach targ $opts(alltargets) {
if ![match_target $targ] { if ![match_target $targ] {
unsupported $testname unsupported $base_testname
return return
} }
} }
foreach targ $opts(notarget) { foreach targ $opts(notarget) {
if [match_target $targ] { if [match_target $targ] {
unsupported $testname unsupported $base_testname
return return
} }
} }
@@ -1253,7 +1253,7 @@ proc run_dump_test { name {extra_options {}} } {
size { set dumpprogram size } size { set dumpprogram size }
default { default {
perror "unrecognized DUMPPROG option $opts(DUMPPROG) in $file.d" perror "unrecognized DUMPPROG option $opts(DUMPPROG) in $file.d"
unresolved $testname unresolved $base_testname
return return
} }
} }
@@ -1263,7 +1263,7 @@ proc run_dump_test { name {extra_options {}} } {
if {$opts($p) != ""} { if {$opts($p) != ""} {
if {$dumpprogram != ""} { if {$dumpprogram != ""} {
perror "ambiguous dump program in $file.d" perror "ambiguous dump program in $file.d"
unresolved $testname unresolved $base_testname
return return
} else { } else {
set dumpprogram $p set dumpprogram $p
@@ -1273,7 +1273,7 @@ proc run_dump_test { name {extra_options {}} } {
} }
if { $dumpprogram == "" && $opts(map) == "" && !$err_warn } { if { $dumpprogram == "" && $opts(map) == "" && !$err_warn } {
perror "dump program unspecified in $file.d" perror "dump program unspecified in $file.d"
unresolved $testname unresolved $base_testname
return return
} }
} }
@@ -1312,7 +1312,7 @@ proc run_dump_test { name {extra_options {}} } {
if { $cmdret != 0} { if { $cmdret != 0} {
send_log "compilation of $cfile failed, exit status $cmdret with <$comp_output>" send_log "compilation of $cfile failed, exit status $cmdret with <$comp_output>"
# Should this be 'unresolved', or is that too silent? # Should this be 'unresolved', or is that too silent?
fail $testname fail $base_testname
return 0 return 0
} }
} }
@@ -1355,6 +1355,11 @@ proc run_dump_test { name {extra_options {}} } {
} }
foreach as_flags $as_final_flags { foreach as_flags $as_final_flags {
if { [llength $as_final_flags] > 1 } {
set testname [concat $base_testname $as_flags]
} else {
set testname $base_testname
}
# Assemble each file. # Assemble each file.
set objfiles {} set objfiles {}
for { set i 0 } { $i < [llength $sourcefiles] } { incr i } { for { set i 0 } { $i < [llength $sourcefiles] } { incr i } {