This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
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 duplicated but with a different #as: line). This patch includes some example uses where multiple testcases can be merged into one file using this new functionality. Regression done on aarch64-none-linux-gnu. binutils/ChangeLog: 2019-02-07 Matthew Malcomson <matthew.malcomson@arm.com> * testsuite/lib/binutils-common.exp: Allow multiple "as" lines. gas/ChangeLog: 2019-02-07 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. ############### `git diff -w` attached for ease of reply/read ############### diff --git a/binutils/testsuite/lib/binutils-common.exp b/binutils/testsuite/lib/binutils-common.exp index bbbbfbe..8c6f7ff 100644 --- a/binutils/testsuite/lib/binutils-common.exp +++ b/binutils/testsuite/lib/binutils-common.exp @@ -523,6 +523,8 @@ if ![string length [info proc prune_warnings]] { # When assembling, pass FLAGS to the assembler. # If assembling several files, you can pass different assembler # 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. # # ld: FLAGS # Link assembled files using FLAGS, in the order of the "source" @@ -690,6 +692,8 @@ proc run_dump_test { name {extra_options {}} } { set opts(anyskip) {} set opts(ar) {} set opts(as) {} + set as_final_flags {} + set as_additional_flags {} set opts(dump) {} set opts(elfedit) {} set opts(error) {} @@ -781,7 +785,9 @@ proc run_dump_test { name {extra_options {}} } { lappend objfile_names $new_objfile } 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" unresolved $subdir/$name return @@ -805,16 +811,35 @@ proc run_dump_test { name {extra_options {}} } { error { append opts($opt_name) $opt_val } + as { + if { $in_extra } { + set as_additional_flags $opt_val + } else { + lappend opts(as) $opt_val + } + } default { set opts($opt_name) [concat $opts($opt_name) $opt_val] } } } - foreach opt { as ld } { - regsub {\[big_or_little_endian\]} $opts($opt) \ - [big_or_little_endian] opts($opt) + # Ensure there is something in $opts(as) for the lmap below. + if { [llength $opts(as)] == 0 } { + 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) == "" } { set testname "$subdir/$name" @@ -947,6 +972,7 @@ proc run_dump_test { name {extra_options {}} } { setup_xfail $targ } + foreach as_flags $as_final_flags { # Assemble each file. set objfiles {} for { set i 0 } { $i < [llength $sourcefiles] } { incr i } { @@ -963,7 +989,7 @@ proc run_dump_test { name {extra_options {}} } { catch "exec rm -f $objfile" exec_output lappend objfiles $objfile - if { $opts(as) == "binary" } { + if { $as_flags == "binary" } { while {[file type $sourcefile] eq "link"} { set newfile [file readlink $sourcefile] if {[string index $newfile 0] ne "/"} { @@ -987,11 +1013,11 @@ proc run_dump_test { name {extra_options {}} } { if { $cmdret != 0 } { perror "sed failure" unresolved $testname - return + continue } 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" set cmdret [remote_exec host [concat sh -c [list "$cmd 2>&1"]] "" "/dev/null" "dump.tmp"] @@ -1094,7 +1120,7 @@ proc run_dump_test { name {extra_options {}} } { default { perror "unrecognized PROG option $opts(PROG) in $file.d" unresolved $testname - return + continue } } @@ -1104,7 +1130,7 @@ proc run_dump_test { name {extra_options {}} } { if { ![is_remote host] && [which $binary] == 0 } { untested $testname - return + continue } verbose "running $binary $progopts $progopts1" 3 @@ -1179,18 +1205,18 @@ proc run_dump_test { name {extra_options {}} } { # We have the expected output. if { $want_out(terminal) || $dumpprogram == "" } { pass $testname - return + continue } } else { fail $testname - return + continue } } # We must not have expected failure if we get here. if { $opts(error) != "" } { fail $testname - return + continue } if { $opts(map) != "" } then { @@ -1204,7 +1230,7 @@ proc run_dump_test { name {extra_options {}} } { } if { $dumpprogram == "" } then { - return + continue } } @@ -1214,7 +1240,7 @@ proc run_dump_test { name {extra_options {}} } { if { ![is_remote host] && [which $binary] == 0 } { untested $testname - return + continue } # For objdump of gas output, automatically translate standard section names @@ -1255,7 +1281,7 @@ proc run_dump_test { name {extra_options {}} } { if { $cmdret != 0 || $comp_output != "" } { send_log "exited abnormally with $cmdret, output:$comp_output\n" fail $testname - return + continue } if { $verbose > 2 } then { verbose "output is [file_contents $dumpfile]" 3 } @@ -1271,11 +1297,12 @@ proc run_dump_test { name {extra_options {}} } { if { [regexp_diff $dumpfile "${dfile}" $regexp_subst] } then { fail $testname if { $verbose == 2 } then { verbose "output is [file_contents $dumpfile]" 2 } - return + continue } pass $testname } +} proc slurp_options { file } { # If options_regsub(foo) is set to {a b}, then the contents of a diff --git a/gas/testsuite/gas/aarch64/dotproduct.d b/gas/testsuite/gas/aarch64/dotproduct.d index 54ac62b..fd2f0eb 100644 --- a/gas/testsuite/gas/aarch64/dotproduct.d +++ b/gas/testsuite/gas/aarch64/dotproduct.d @@ -1,4 +1,5 @@ #as: -march=armv8.2-a+dotprod +#as: -march=armv8.4-a #objdump: -dr .*: file format .* diff --git a/gas/testsuite/gas/aarch64/dotproduct_armv8_4.d b/gas/testsuite/gas/aarch64/dotproduct_armv8_4.d deleted file mode 100644 index 121eb11..0000000 --- a/gas/testsuite/gas/aarch64/dotproduct_armv8_4.d +++ /dev/null @@ -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 diff --git a/gas/testsuite/gas/aarch64/dotproduct_armv8_4.s b/gas/testsuite/gas/aarch64/dotproduct_armv8_4.s deleted file mode 100644 index 37538d9..0000000 --- a/gas/testsuite/gas/aarch64/dotproduct_armv8_4.s +++ /dev/null @@ -1,2 +0,0 @@ -UDOT V0.2S, V0.8B, V0.8B -UDOT V0.2S, V0.8B, V11.8B diff --git a/gas/testsuite/gas/aarch64/illegal-dotproduct.d b/gas/testsuite/gas/aarch64/illegal-dotproduct.d index 3f8928d..0e15b9f 100644 --- a/gas/testsuite/gas/aarch64/illegal-dotproduct.d +++ b/gas/testsuite/gas/aarch64/illegal-dotproduct.d @@ -1,4 +1,5 @@ #as: -march=armv8.2-a+dotprod +#as: -march=armv8.4-a #name: Invalid dotproduct instructions. #source: illegal-dotproduct.s #error_output: illegal-dotproduct.l diff --git a/gas/testsuite/gas/aarch64/ldst-rcpc-armv8_2.d b/gas/testsuite/gas/aarch64/ldst-rcpc-armv8_2.d deleted file mode 100644 index ac8938f..0000000 --- a/gas/testsuite/gas/aarch64/ldst-rcpc-armv8_2.d +++ /dev/null @@ -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\] diff --git a/gas/testsuite/gas/aarch64/ldst-rcpc.d b/gas/testsuite/gas/aarch64/ldst-rcpc.d index 73a0c9f..f9e951b 100644 --- a/gas/testsuite/gas/aarch64/ldst-rcpc.d +++ b/gas/testsuite/gas/aarch64/ldst-rcpc.d @@ -1,5 +1,7 @@ #objdump: -dr #as: -march=armv8.3-a +#as: -march=armv8.2-a+rcpc +#source: ldst-rcpc.s .*: file format .*
Attachment:
allow-multiple-as-lines.patch
Description: allow-multiple-as-lines.patch
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |