aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Malcolm <dmalcolm@redhat.com>2015-12-10 17:12:38 +0000
committerDavid Malcolm <dmalcolm@gcc.gnu.org>2015-12-10 17:12:38 +0000
commitb5b44c62e66b07cec9aff58d87280080ef5287bd (patch)
treea8010e6ddf8c052e2414c516fadb2a8374ca4a6c
parent3daacdcd5f20d084294f2cc50f84e3e8769205f1 (diff)
downloadgcc-b5b44c62e66b07cec9aff58d87280080ef5287bd.zip
gcc-b5b44c62e66b07cec9aff58d87280080ef5287bd.tar.gz
gcc-b5b44c62e66b07cec9aff58d87280080ef5287bd.tar.bz2
testsuite/lib/multline.exp: show test name and line numbers
gcc/testsuite/ChangeLog: * lib/multiline.exp (_multiline_expected_outputs): Update comment. (dg-end-multiline-output): Capture line numbers within _multiline_expected_outputs. (handle-multiline-outputs): Access global $testname_with_flags and add it as a prefix to pass/fail results. Extract line numbers from $_multiline_expected_outputs and print them within pass/fail results, replacing the printing of $index. Consolidate the string prefix shared between pass/fail into a new local ($title). From-SVN: r231530
-rw-r--r--gcc/testsuite/ChangeLog11
-rw-r--r--gcc/testsuite/lib/multiline.exp26
2 files changed, 30 insertions, 7 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 6bcacab..bc79f6f 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,14 @@
+2015-12-10 David Malcolm <dmalcolm@redhat.com>
+
+ * lib/multiline.exp (_multiline_expected_outputs): Update comment.
+ (dg-end-multiline-output): Capture line numbers within
+ _multiline_expected_outputs.
+ (handle-multiline-outputs): Access global $testname_with_flags
+ and add it as a prefix to pass/fail results. Extract line numbers
+ from $_multiline_expected_outputs and print them within pass/fail
+ results, replacing the printing of $index. Consolidate the
+ string prefix shared between pass/fail into a new local ($title).
+
2015-12-10 Jeff Law <law@redhat.com>
PR tree-optimization/68619
diff --git a/gcc/testsuite/lib/multiline.exp b/gcc/testsuite/lib/multiline.exp
index c3d0506..5367437 100644
--- a/gcc/testsuite/lib/multiline.exp
+++ b/gcc/testsuite/lib/multiline.exp
@@ -54,7 +54,9 @@
# The line number of the last dg-begin-multiline-output directive.
set _multiline_last_beginning_line -1
-# A list of lists of strings.
+# A list of
+# first-line-number, last-line-number, lines
+# where each "lines" is a list of strings.
set _multiline_expected_outputs []
############################################################################
@@ -88,12 +90,15 @@ proc dg-end-multiline-output { args } {
# Load it and split it into lines
set lines [_get_lines $prog $_multiline_last_beginning_line $line]
- set _multiline_last_beginning_line -1
verbose "lines: $lines" 3
+ # Create an entry of the form: first-line, last-line, lines
+ set entry [list $_multiline_last_beginning_line $line $lines]
global _multiline_expected_outputs
- lappend _multiline_expected_outputs $lines
+ lappend _multiline_expected_outputs $entry
verbose "within dg-end-multiline-output: _multiline_expected_outputs: $_multiline_expected_outputs" 3
+
+ set _multiline_last_beginning_line -1
}
# Hook to be called by prune.exp's prune_gcc_output to
@@ -107,9 +112,14 @@ proc dg-end-multiline-output { args } {
proc handle-multiline-outputs { text } {
global _multiline_expected_outputs
+ global testname_with_flags
set index 0
- foreach multiline $_multiline_expected_outputs {
- verbose " multiline: $multiline" 4
+ foreach entry $_multiline_expected_outputs {
+ verbose " entry: $entry" 3
+ set start_line [lindex $entry 0]
+ set end_line [lindex $entry 1]
+ set multiline [lindex $entry 2]
+ verbose " multiline: $multiline" 3
set rexp [_build_multiline_regex $multiline $index]
verbose "rexp: ${rexp}" 4
# Escape newlines in $rexp so that we can print them in
@@ -117,12 +127,14 @@ proc handle-multiline-outputs { text } {
set escaped_regex [string map {"\n" "\\n"} $rexp]
verbose "escaped_regex: ${escaped_regex}" 4
+ set title "$testname_with_flags expected multiline pattern lines $start_line-$end_line"
+
# Use "regsub" to attempt to prune the pattern from $text
if {[regsub -line $rexp $text "" text]} {
# Success; the multiline pattern was pruned.
- pass "expected multiline pattern $index was found: \"$escaped_regex\""
+ pass "$title was found: \"$escaped_regex\""
} else {
- fail "expected multiline pattern $index not found: \"$escaped_regex\""
+ fail "$title not found: \"$escaped_regex\""
}
set index [expr $index + 1]