Testsuite: Allow multiple lines of "as" in testsuite.

Committed on behalf of Matthew Malcomson.

This allows checking the command line parsing more easily than before by
allowing many command line invokations from the same .d file.

Each line is used as a set of flags, and the tests are ran against the output
of the assembler with each set.
Each line of assembler is treated as another set of tests (as if the test file
were copied to another with a different #as: line).

This patch includes some example uses where multiple testcases can be merged
into one file using this new functionality.

binutils/ChangeLog:

	* testsuite/lib/binutils-common.exp: Allow multiple "as" lines.

gas/ChangeLog:

	* testsuite/gas/aarch64/dotproduct.d: Use multiple "as" lines.
	* testsuite/gas/aarch64/dotproduct_armv8_4.d: Remove.
	* testsuite/gas/aarch64/dotproduct_armv8_4.s: Remove.
	* testsuite/gas/aarch64/illegal-dotproduct.d: Use multiple "as"
	lines.
	* testsuite/gas/aarch64/ldst-rcpc-armv8_2.d: Remove.
	* testsuite/gas/aarch64/ldst-rcpc.d: Use multiple "as" lines.
This commit is contained in:
Matthew Malcomson
2019-02-27 13:15:10 +00:00
committed by Tamar Christina
parent bf9a735e23
commit 52d6f3ee94
9 changed files with 367 additions and 350 deletions

View File

@ -1,3 +1,7 @@
2019-02-27 Matthew Malcomson <matthew.malcomson@arm.com>
* testsuite/lib/binutils-common.exp: Allow multiple "as" lines.
2019-02-25 Nick Clifton <nickc@redhat.com> 2019-02-25 Nick Clifton <nickc@redhat.com>
* objdump.c (sym_ok): New function. * objdump.c (sym_ok): New function.

View File

@ -523,6 +523,13 @@ if ![string length [info proc prune_warnings]] {
# When assembling, pass FLAGS to the assembler. # When assembling, pass FLAGS to the assembler.
# If assembling several files, you can pass different assembler # If assembling several files, you can pass different assembler
# options in the "source" directives. See below. # options in the "source" directives. See below.
# Multiple instances of this directive tells run_dump_test to run the test
# multiple times -- one time with each set of flags provided.
# Each instance will run exactly as a file with a single "as" line, it is
# not possible to condition any behaviour on which set of "as" flags is
# used. That means that the "source" specific options are appended to
# the "as" flags for their corresponding files, and any extra processing
# (e.g. with "ld" and "objcopy") is repeated for each test.
# #
# ld: FLAGS # ld: FLAGS
# Link assembled files using FLAGS, in the order of the "source" # Link assembled files using FLAGS, in the order of the "source"
@ -690,6 +697,8 @@ proc run_dump_test { name {extra_options {}} } {
set opts(anyskip) {} set opts(anyskip) {}
set opts(ar) {} set opts(ar) {}
set opts(as) {} set opts(as) {}
set as_final_flags {}
set as_additional_flags {}
set opts(dump) {} set opts(dump) {}
set opts(elfedit) {} set opts(elfedit) {}
set opts(error) {} set opts(error) {}
@ -781,7 +790,9 @@ proc run_dump_test { name {extra_options {}} } {
lappend objfile_names $new_objfile lappend objfile_names $new_objfile
} }
default { default {
if { !$in_extra && [string length $opts($opt_name)] } { if { !$in_extra
&& [string length $opts($opt_name)]
&& $opt_name != "as" } {
perror "option $opt_name multiply set in $file.d" perror "option $opt_name multiply set in $file.d"
unresolved $subdir/$name unresolved $subdir/$name
return return
@ -805,16 +816,35 @@ proc run_dump_test { name {extra_options {}} } {
error { error {
append opts($opt_name) $opt_val append opts($opt_name) $opt_val
} }
as {
if { $in_extra } {
set as_additional_flags [concat $as_additional_flags $opt_val]
} else {
lappend opts(as) $opt_val
}
}
default { default {
set opts($opt_name) [concat $opts($opt_name) $opt_val] set opts($opt_name) [concat $opts($opt_name) $opt_val]
} }
} }
} }
foreach opt { as ld } { # Ensure there is something in $opts(as) for the lmap below.
regsub {\[big_or_little_endian\]} $opts($opt) \ if { [llength $opts(as)] == 0 } {
[big_or_little_endian] opts($opt) set opts(as) [list " "]
} }
set as_final_flags [lmap x $opts(as) {
if { [string length $x] && [string length $as_additional_flags] } {
append x " "
}
append x $as_additional_flags
regsub {\[big_or_little_endian\]} $x \
[big_or_little_endian] x
expr {$x}
}]
regsub {\[big_or_little_endian\]} $opts(ld) \
[big_or_little_endian] opts(ld)
if { $opts(name) == "" } { if { $opts(name) == "" } {
set testname "$subdir/$name" set testname "$subdir/$name"
@ -947,6 +977,7 @@ proc run_dump_test { name {extra_options {}} } {
setup_xfail $targ setup_xfail $targ
} }
foreach as_flags $as_final_flags {
# 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 } {
@ -963,7 +994,7 @@ proc run_dump_test { name {extra_options {}} } {
catch "exec rm -f $objfile" exec_output catch "exec rm -f $objfile" exec_output
lappend objfiles $objfile lappend objfiles $objfile
if { $opts(as) == "binary" } { if { $as_flags == "binary" } {
while {[file type $sourcefile] eq "link"} { while {[file type $sourcefile] eq "link"} {
set newfile [file readlink $sourcefile] set newfile [file readlink $sourcefile]
if {[string index $newfile 0] ne "/"} { if {[string index $newfile 0] ne "/"} {
@ -987,11 +1018,11 @@ proc run_dump_test { name {extra_options {}} } {
if { $cmdret != 0 } { if { $cmdret != 0 } {
perror "sed failure" perror "sed failure"
unresolved $testname unresolved $testname
return continue
} }
set sourcefile tmpdir/asm.s set sourcefile tmpdir/asm.s
} }
set cmd "$AS $ASFLAGS $opts(as) $sourceasflags -o $objfile $sourcefile" set cmd "$AS $ASFLAGS $as_flags $sourceasflags -o $objfile $sourcefile"
send_log "$cmd\n" send_log "$cmd\n"
set cmdret [remote_exec host [concat sh -c [list "$cmd 2>&1"]] "" "/dev/null" "dump.tmp"] set cmdret [remote_exec host [concat sh -c [list "$cmd 2>&1"]] "" "/dev/null" "dump.tmp"]
@ -1094,7 +1125,7 @@ proc run_dump_test { name {extra_options {}} } {
default { default {
perror "unrecognized PROG option $opts(PROG) in $file.d" perror "unrecognized PROG option $opts(PROG) in $file.d"
unresolved $testname unresolved $testname
return continue
} }
} }
@ -1104,7 +1135,7 @@ proc run_dump_test { name {extra_options {}} } {
if { ![is_remote host] && [which $binary] == 0 } { if { ![is_remote host] && [which $binary] == 0 } {
untested $testname untested $testname
return continue
} }
verbose "running $binary $progopts $progopts1" 3 verbose "running $binary $progopts $progopts1" 3
@ -1179,18 +1210,18 @@ proc run_dump_test { name {extra_options {}} } {
# We have the expected output. # We have the expected output.
if { $want_out(terminal) || $dumpprogram == "" } { if { $want_out(terminal) || $dumpprogram == "" } {
pass $testname pass $testname
return continue
} }
} else { } else {
fail $testname fail $testname
return continue
} }
} }
# We must not have expected failure if we get here. # We must not have expected failure if we get here.
if { $opts(error) != "" } { if { $opts(error) != "" } {
fail $testname fail $testname
return continue
} }
if { $opts(map) != "" } then { if { $opts(map) != "" } then {
@ -1204,7 +1235,7 @@ proc run_dump_test { name {extra_options {}} } {
} }
if { $dumpprogram == "" } then { if { $dumpprogram == "" } then {
return continue
} }
} }
@ -1214,7 +1245,7 @@ proc run_dump_test { name {extra_options {}} } {
if { ![is_remote host] && [which $binary] == 0 } { if { ![is_remote host] && [which $binary] == 0 } {
untested $testname untested $testname
return continue
} }
# For objdump of gas output, automatically translate standard section names # For objdump of gas output, automatically translate standard section names
@ -1255,7 +1286,7 @@ proc run_dump_test { name {extra_options {}} } {
if { $cmdret != 0 || $comp_output != "" } { if { $cmdret != 0 || $comp_output != "" } {
send_log "exited abnormally with $cmdret, output:$comp_output\n" send_log "exited abnormally with $cmdret, output:$comp_output\n"
fail $testname fail $testname
return continue
} }
if { $verbose > 2 } then { verbose "output is [file_contents $dumpfile]" 3 } if { $verbose > 2 } then { verbose "output is [file_contents $dumpfile]" 3 }
@ -1271,11 +1302,12 @@ proc run_dump_test { name {extra_options {}} } {
if { [regexp_diff $dumpfile "${dfile}" $regexp_subst] } then { if { [regexp_diff $dumpfile "${dfile}" $regexp_subst] } then {
fail $testname fail $testname
if { $verbose == 2 } then { verbose "output is [file_contents $dumpfile]" 2 } if { $verbose == 2 } then { verbose "output is [file_contents $dumpfile]" 2 }
return continue
} }
pass $testname pass $testname
} }
}
proc slurp_options { file } { proc slurp_options { file } {
# If options_regsub(foo) is set to {a b}, then the contents of a # If options_regsub(foo) is set to {a b}, then the contents of a

View File

@ -1,3 +1,13 @@
2019-02-27 Matthew Malcomson <matthew.malcomson@arm.com>
* testsuite/gas/aarch64/dotproduct.d: Use multiple "as" lines.
* testsuite/gas/aarch64/dotproduct_armv8_4.d: Remove.
* testsuite/gas/aarch64/dotproduct_armv8_4.s: Remove.
* testsuite/gas/aarch64/illegal-dotproduct.d: Use multiple "as"
lines.
* testsuite/gas/aarch64/ldst-rcpc-armv8_2.d: Remove.
* testsuite/gas/aarch64/ldst-rcpc.d: Use multiple "as" lines.
2019-02-24 Alan Modra <amodra@gmail.com> 2019-02-24 Alan Modra <amodra@gmail.com>
* config/tc-ppc.c (parse_tls_arg): Wrap in #ifdef OBJ_ELF. * config/tc-ppc.c (parse_tls_arg): Wrap in #ifdef OBJ_ELF.

View File

@ -1,4 +1,5 @@
#as: -march=armv8.2-a+dotprod #as: -march=armv8.2-a+dotprod
#as: -march=armv8.4-a
#objdump: -dr #objdump: -dr
.*: file format .* .*: file format .*

View File

@ -1,10 +0,0 @@
#as: -march=armv8.4-a
#objdump: -dr
.*: file format .*
Disassembly of section \.text:
0+ <.*>:
[^:]+:\s+2e809400 udot v0.2s, v0.8b, v0.8b
[^:]+:\s+2e8b9400 udot v0.2s, v0.8b, v11.8b

View File

@ -1,2 +0,0 @@
UDOT V0.2S, V0.8B, V0.8B
UDOT V0.2S, V0.8B, V11.8B

View File

@ -1,4 +1,5 @@
#as: -march=armv8.2-a+dotprod #as: -march=armv8.2-a+dotprod
#as: -march=armv8.4-a
#name: Invalid dotproduct instructions. #name: Invalid dotproduct instructions.
#source: illegal-dotproduct.s #source: illegal-dotproduct.s
#error_output: illegal-dotproduct.l #error_output: illegal-dotproduct.l

View File

@ -1,21 +0,0 @@
#objdump: -dr
#as: -march=armv8.2-a+rcpc
#source: ldst-rcpc.s
.*: file format .*
Disassembly of section \.text:
0+ <.*>:
0: 38bfc0e1 ldaprb w1, \[x7\]
4: 38bfc0e1 ldaprb w1, \[x7\]
8: 38bfc0e1 ldaprb w1, \[x7\]
c: 78bfc0e1 ldaprh w1, \[x7\]
10: 78bfc0e1 ldaprh w1, \[x7\]
14: 78bfc0e1 ldaprh w1, \[x7\]
18: b8bfc0e1 ldapr w1, \[x7\]
1c: b8bfc0e1 ldapr w1, \[x7\]
20: b8bfc0e1 ldapr w1, \[x7\]
24: f8bfc0e1 ldapr x1, \[x7\]
28: f8bfc0e1 ldapr x1, \[x7\]
2c: f8bfc0e1 ldapr x1, \[x7\]

View File

@ -1,5 +1,7 @@
#objdump: -dr #objdump: -dr
#as: -march=armv8.3-a #as: -march=armv8.3-a
#as: -march=armv8.2-a+rcpc
#source: ldst-rcpc.s
.*: file format .* .*: file format .*