testsuite: scan-lang-dump-times & scan-lang-dump-not
authorNathan Sidwell <nathan@acm.org>
Mon, 13 Jul 2020 20:37:46 +0000 (13:37 -0700)
committerNathan Sidwell <nathan@acm.org>
Mon, 13 Jul 2020 20:41:49 +0000 (13:41 -0700)
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

index d9f8c1e..b85ec68 100644 (file)
@@ -36,6 +36,56 @@ proc scan-lang-dump { args } {
        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]" "" \
            [lindex $args 2]