From 7a76132c80a7a5b832c93bf1ff44e14720d54a33 Mon Sep 17 00:00:00 2001 From: Martin Liska Date: Tue, 17 Oct 2017 09:31:30 +0200 Subject: [PATCH] Improve FAIL message for dump-*-times functions. 2017-10-17 Martin Liska * lib/scanasm.exp: Print how many times a regex pattern is found. * lib/scandump.exp: Likewise. From-SVN: r253804 --- gcc/testsuite/ChangeLog | 6 ++++++ gcc/testsuite/lib/scanasm.exp | 10 ++++++---- gcc/testsuite/lib/scandump.exp | 6 ++++-- 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 3059d23773d..5c3c5b2328f 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2017-10-17 Martin Liska + + * lib/scanasm.exp: Print how many times a regex pattern is + found. + * lib/scandump.exp: Likewise. + 17-10-2017 Olga Makhotina * gcc.target/i386/avx512dq-vreducesd-1.c (_mm_mask_reduce_sd, diff --git a/gcc/testsuite/lib/scanasm.exp b/gcc/testsuite/lib/scanasm.exp index bab23e8e165..32764cb9c4a 100644 --- a/gcc/testsuite/lib/scanasm.exp +++ b/gcc/testsuite/lib/scanasm.exp @@ -231,6 +231,7 @@ proc scan-assembler-times { args } { set testcase [testname-for-summary] set pattern [lindex $args 0] + set times [lindex $args 1] set pp_pattern [make_pattern_printable $pattern] # This must match the rule in gcc-dg.exp. @@ -239,7 +240,7 @@ proc scan-assembler-times { args } { set files [glob -nocomplain $output_file] if { $files == "" } { verbose -log "$testcase: output file does not exist" - unresolved "$testcase scan-assembler-times $pp_pattern [lindex $args 1]" + unresolved "$testcase scan-assembler-times $pp_pattern $times" return } @@ -247,10 +248,11 @@ proc scan-assembler-times { args } { set text [read $fd] close $fd - if { [llength [regexp -inline -all -- $pattern $text]] == [lindex $args 1]} { - pass "$testcase scan-assembler-times $pp_pattern [lindex $args 1]" + set result_count [llength [regexp -inline -all -- $pattern $text]] + if {$result_count == $times} { + pass "$testcase scan-assembler-times $pp_pattern $times" } else { - fail "$testcase scan-assembler-times $pp_pattern [lindex $args 1]" + fail "$testcase scan-assembler-times $pp_pattern $times (found $result_count times)" } } 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)" } } -- 2.30.2