diff options
author | Adam Nemet <anemet@caviumnetworks.com> | 2009-09-24 18:27:31 +0000 |
---|---|---|
committer | Adam Nemet <nemet@gcc.gnu.org> | 2009-09-24 18:27:31 +0000 |
commit | 4851726d28a60d59345e8a8ab06575885d98e74f (patch) | |
tree | 6d7a4b7ad44246d551ba8e6fdfe28dcdb708160d /gcc | |
parent | 2d84a33774e1201a09b07eaec60b4e019cb40dd5 (diff) | |
download | gcc-4851726d28a60d59345e8a8ab06575885d98e74f.zip gcc-4851726d28a60d59345e8a8ab06575885d98e74f.tar.gz gcc-4851726d28a60d59345e8a8ab06575885d98e74f.tar.bz2 |
scanasm.exp (make_pattern_printable): New function.
* lib/scanasm.exp (make_pattern_printable): New function.
(dg-scan, scan-assembler-times, scan-assembler-dem,
scan-assembler-dem-not): Use it.
From-SVN: r152136
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/testsuite/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/testsuite/lib/scanasm.exp | 31 |
2 files changed, 27 insertions, 10 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 8e5395f..51993a1 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2009-09-24 Adam Nemet <anemet@caviumnetworks.com> + + * lib/scanasm.exp (make_pattern_printable): New function. + (dg-scan, scan-assembler-times, scan-assembler-dem, + scan-assembler-dem-not): Use it. + 2009-09-24 H.J. Lu <hongjiu.lu@intel.com> * gcc.target/i386/pr12329.c (dg-do): Changed to run. diff --git a/gcc/testsuite/lib/scanasm.exp b/gcc/testsuite/lib/scanasm.exp index 24de1871..abc01b7 100644 --- a/gcc/testsuite/lib/scanasm.exp +++ b/gcc/testsuite/lib/scanasm.exp @@ -19,6 +19,11 @@ # Utility for scanning compiler result, invoked via dg-final. +# Transform newline and similar characters into their escaped form. +proc make_pattern_printable { pattern } { + return [string map {\t \\t \n \\n \r \\r \\ \\\\} $pattern] +} + # Scan the OUTPUT_FILE for a pattern. If it is present and POSITIVE # is non-zero, or it is not present and POSITIVE is zero, the test # passes. The ORIG_ARGS is the list of arguments provided by dg-final @@ -52,7 +57,7 @@ proc dg-scan { name positive testcase output_file orig_args } { close $fd set pattern [lindex $orig_args 0] - set printable_pattern [string map {\t \\t \n \\n \r \\r \\ \\\\} $pattern] + set printable_pattern [make_pattern_printable $pattern] set match [regexp -- $pattern $text] if { $match == $positive } { @@ -181,10 +186,12 @@ proc scan-assembler-times { args } { set text [read $fd] close $fd - if { [llength [regexp -inline -all -- [lindex $args 0] $text]] == [lindex $args 1]} { - pass "$testcase scan-assembler-times [lindex $args 0] [lindex $args 1]" + set pattern [lindex $args 0] + set pp_pattern [make_pattern_printable $pattern] + if { [llength [regexp -inline -all -- $pattern $text]] == [lindex $args 1]} { + pass "$testcase scan-assembler-times $pp_pattern [lindex $args 1]" } else { - fail "$testcase scan-assembler-times [lindex $args 0] [lindex $args 1]" + fail "$testcase scan-assembler-times $pp_pattern [lindex $args 1]" } } @@ -228,10 +235,12 @@ proc scan-assembler-dem { args } { set output [remote_exec host "$cxxfilt" "" "$output_file"] set text [lindex $output 1] - if [regexp -- [lindex $args 0] $text] { - pass "$testcase scan-assembler-dem [lindex $args 0]" + set pattern [lindex $args 0] + set pp_pattern [make_pattern_printable $pattern] + if [regexp -- $pattern $text] { + pass "$testcase scan-assembler-dem $pp_pattern" } else { - fail "$testcase scan-assembler-dem [lindex $args 0]" + fail "$testcase scan-assembler-dem $pp_pattern" } } @@ -274,9 +283,11 @@ proc scan-assembler-dem-not { args } { set output [remote_exec host "$cxxfilt" "" "$output_file"] set text [lindex $output 1] - if ![regexp -- [lindex $args 0] $text] { - pass "$testcase scan-assembler-dem-not [lindex $args 0]" + set pattern [lindex $args 0] + set pp_pattern [make_pattern_printable $pattern] + if ![regexp -- $pattern $text] { + pass "$testcase scan-assembler-dem-not $pp_pattern" } else { - fail "$testcase scan-assembler-dem-not [lindex $args 0]" + fail "$testcase scan-assembler-dem-not $pp_pattern" } } |