Hi!

On Wed, Oct 11, 2017 at 10:14:29AM +0200, Martin Liška wrote:
> This patch helps to find why an expected number of scan patterns does not 
> match:
> 
> FAIL: gcc.dg/unroll-3.c scan-tree-dump-times cunrolli "loop with 3 iterations 
> completely unrolled" 222 (found 1 times)
> FAIL: c-c++-common/attr-simd-2.c  -Wc++-compat   scan-assembler-times 
> _ZGVbN4_simd_attr: 111 (found 1 times)

Cool, looks fine to me (but I can't approve it).  Some suggestions:

> diff --git a/gcc/testsuite/lib/scanasm.exp b/gcc/testsuite/lib/scanasm.exp
> index bab23e8e165..e90e61c29ae 100644
> --- a/gcc/testsuite/lib/scanasm.exp
> +++ b/gcc/testsuite/lib/scanasm.exp
> @@ -247,10 +247,11 @@ proc scan-assembler-times { args } {
>      set text [read $fd]
>      close $fd
>  
> -    if { [llength [regexp -inline -all -- $pattern $text]] == [lindex $args 
> 1]} {
> +    set pattern_count [llength [regexp -inline -all -- $pattern $text]]
> +    if {$pattern_count == [lindex $args 1]} {
>       pass "$testcase scan-assembler-times $pp_pattern [lindex $args 1]"
>      } else {
> -     fail "$testcase scan-assembler-times $pp_pattern [lindex $args 1]"
> +     fail "$testcase scan-assembler-times $pp_pattern [lindex $args 1] 
> (found $pattern_count times)"
>      }
>  }

pattern_count is not such a great name (it's the result count, instead).

You could factor out the [lindex $args 1] to a variable.

You do both of these in scandump.exp already, so why not here :-)


Segher


> diff --git a/gcc/testsuite/lib/scandump.exp b/gcc/testsuite/lib/scandump.exp
> index 2e6eebfaf33..4a64ac6e05d 100644
> --- a/gcc/testsuite/lib/scandump.exp
> +++ b/gcc/testsuite/lib/scandump.exp
> @@ -86,6 +86,7 @@ proc scan-dump-times { args } {
>      }
>  
>      set testcase [testname-for-summary]
> +    set times [lindex $args 2]
>      set suf [dump-suffix [lindex $args 3]]
>      set printable_pattern [make_pattern_printable [lindex $args 1]]
>      set testname "$testcase scan-[lindex $args 0]-dump-times $suf 
> \"$printable_pattern\" [lindex $args 2]"
> @@ -101,10 +102,11 @@ proc scan-dump-times { args } {
>      set text [read $fd]
>      close $fd
>  
> -    if { [llength [regexp -inline -all -- [lindex $args 1] $text]] == 
> [lindex $args 2]} {
> +    set result_count [llength [regexp -inline -all -- [lindex $args 1] 
> $text]]
> +    if {$result_count == $times} {
>          pass "$testname"
>      } else {
> -        fail "$testname"
> +        fail "$testname (found $result_count times)"
>      }
>  }

Reply via email to