From 698bad8d4832f1c1250b253d655d8fb537a3d31d Mon Sep 17 00:00:00 2001 From: Nathan Sidwell Date: Mon, 13 Jul 2020 13:37:46 -0700 Subject: [PATCH] testsuite: scan-lang-dump-times & scan-lang-dump-not Sigh, last week's success at not breaking things failed with an incorrect 'fix' this morning. Let's reduce my confusion by making lib/scanlang.exp the same on trunk as modules. gcc/testsuite/ * lib/scanlang.exp (scan-lang-dump): Fix breakage. (scan-lang-dump-times, scan-lang-dump-not): New. --- gcc/testsuite/lib/scanlang.exp | 50 ++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/gcc/testsuite/lib/scanlang.exp b/gcc/testsuite/lib/scanlang.exp index d9f8c1e6e83..b85ec681666 100644 --- a/gcc/testsuite/lib/scanlang.exp +++ b/gcc/testsuite/lib/scanlang.exp @@ -35,6 +35,56 @@ proc scan-lang-dump { args } { error "scan-lang-dump: too many arguments" return } + if { [llength $args] >= 3 } { + scan-dump "lang" [lindex $args 0] \ + "\[0-9\]\[0-9\]\[0-9\]l.[lindex $args 1]" "" [lindex $args 2] + } else { + scan-dump "lang" [lindex $args 0] \ + "\[0-9\]\[0-9\]\[0-9\]l.[lindex $args 1]" "" + } +} + +# Call pass if pattern is present given number of times, otherwise fail. +# Argument 0 is the regexp to match +# Argument 1 is number of times the regexp must be found +# Argument 2 is the name of the dumped tree pass +# Argument 3 handles expected failures and the like +proc scan-lang-dump-times { args } { + + if { [llength $args] < 3 } { + error "scan-lang-dump-times: too few arguments" + return + } + if { [llength $args] > 4 } { + error "scan-lang-dump-times: too many arguments" + return + } + if { [llength $args] >= 4 } { + scan-dump-times "lang" [lindex $args 0] [lindex $args 1] \ + "\[0-9\]\[0-9\]\[0-9\]l.[lindex $args 2]" "" \ + [lindex $args 3] + } else { + scan-dump-times "lang" [lindex $args 0] [lindex $args 1] \ + "\[0-9\]\[0-9\]\[0-9\]l.[lindex $args 2]" "" + } +} + +# Utility for scanning compiler result, invoked via dg-final. +# Call pass if pattern is not present, otherwise fail. +# +# Argument 0 is the regexp to match +# Argument 1 is the name of the dumped lang pass +# Argument 2 handles expected failures and the like +proc scan-lang-dump-not { args } { + + if { [llength $args] < 2 } { + error "scan-lang-dump-not: too few arguments" + return + } + if { [llength $args] > 3 } { + error "scan-lang-dump-not: too many arguments" + return + } if { [llength $args] >= 3 } { scan-dump-not "lang" [lindex $args 0] \ "\[0-9\]\[0-9\]\[0-9\]l.[lindex $args 1]" "" \ -- 2.30.2