From: David Malcolm <dmalcolm@redhat.com>
To: "gcc-patches@gcc.gnu.org" <gcc-patches@gcc.gnu.org>
Cc: Uros Bizjak <ubizjak@gmail.com>,
Bernd Schmidt <bschmidt@redhat.com>,
David Malcolm <dmalcolm@redhat.com>
Subject: [PATCH] PR testsuite/69181: ensure expected multiline outputs is cleared per-test
Date: Sat, 09 Jan 2016 00:30:00 -0000 [thread overview]
Message-ID: <1452300686-14972-1-git-send-email-dmalcolm@redhat.com> (raw)
In-Reply-To: <CAFULd4aPjN1E0gbe96z0f9bYzd+0ETaLOnKnRH16AzVfe5bi0g@mail.gmail.com>
The root cause here is that the logic to reset the list of expected
multiline outputs was being run from:
handle-multiline-outputs, called by
prune.exp's prune_gcc_output
and none of that happens if the test is skipped by a target exclusion
in dg-do.
This patch moves the clearing of the relevant list to happen in
gcc-dg.exp's wrapper for dg-test, so it happens per-test even if the
test is skipped.
Successfully bootstrapped®rtested on x86_64-pc-linux-gnu; adds
1 UNSUPPORTED (by design: gcc.dg/pr69181-1.c) and 1 PASS to gcc.sum.
OK for trunk?
gcc/testsuite/ChangeLog:
PR testsuite/69181
* gcc.dg/pr69181-1.c: New test file.
* gcc.dg/pr69181-2.c: New test file.
* lib/gcc-dg.exp (dg-test): Reset global
multiline_expected_outputs to the empty list after each
call to the real dg-test.
* lib/multiline.exp (_multiline_expected_outputs): Rename this
global to...
(multiline_expected_outputs): ...this, and updated comments to
note that it is modified from gcc-dg.exp.
(dg-end-multiline-output): Update for the above renaming.
(handle-multiline-outputs): Likewise. Remove the clearing
of the expected outputs to the empty list.
---
gcc/testsuite/gcc.dg/pr69181-1.c | 7 +++++++
gcc/testsuite/gcc.dg/pr69181-2.c | 4 ++++
gcc/testsuite/lib/gcc-dg.exp | 2 ++
gcc/testsuite/lib/multiline.exp | 22 +++++++++-------------
4 files changed, 22 insertions(+), 13 deletions(-)
create mode 100644 gcc/testsuite/gcc.dg/pr69181-1.c
create mode 100644 gcc/testsuite/gcc.dg/pr69181-2.c
diff --git a/gcc/testsuite/gcc.dg/pr69181-1.c b/gcc/testsuite/gcc.dg/pr69181-1.c
new file mode 100644
index 0000000..e851f0c
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr69181-1.c
@@ -0,0 +1,7 @@
+/* { dg-do compile { target this_will_not_be_matched-*-* } } */
+
+/* { dg-begin-multiline-output "" }
+ This message should never be checked for.
+ In particular, it shouldn't be checked for in the *next*
+ test case.
+ { dg-end-multiline-output "" } */
diff --git a/gcc/testsuite/gcc.dg/pr69181-2.c b/gcc/testsuite/gcc.dg/pr69181-2.c
new file mode 100644
index 0000000..dca90dc
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr69181-2.c
@@ -0,0 +1,4 @@
+/* Dummy test case, to verify that the dg-begin-multiline-output directive
+ from pr69181-1.c isn't erroneously expected to be handled in *this*
+ test case. */
+int make_non_empty;
diff --git a/gcc/testsuite/lib/gcc-dg.exp b/gcc/testsuite/lib/gcc-dg.exp
index f9ec206..f778bca 100644
--- a/gcc/testsuite/lib/gcc-dg.exp
+++ b/gcc/testsuite/lib/gcc-dg.exp
@@ -836,6 +836,7 @@ if { [info procs saved-dg-test] == [list] } {
global testname_with_flags
global set_target_env_var
global keep_saved_temps_suffixes
+ global multiline_expected_outputs
if { [ catch { eval saved-dg-test $args } errmsg ] } {
set saved_info $errorInfo
@@ -871,6 +872,7 @@ if { [info procs saved-dg-test] == [list] } {
if [info exists testname_with_flags] {
unset testname_with_flags
}
+ set multiline_expected_outputs []
}
}
diff --git a/gcc/testsuite/lib/multiline.exp b/gcc/testsuite/lib/multiline.exp
index 6b2c1da..fd7affc 100644
--- a/gcc/testsuite/lib/multiline.exp
+++ b/gcc/testsuite/lib/multiline.exp
@@ -47,17 +47,18 @@
# to have the testsuite verify the expected output.
############################################################################
-# Global variables. Although global, these are intended to only be used from
-# within multiline.exp.
+# Global variables.
############################################################################
+# This is intended to only be used from within multiline.exp.
# The line number of the last dg-begin-multiline-output directive.
set _multiline_last_beginning_line -1
# A list of
# first-line-number, last-line-number, lines
# where each "lines" is a list of strings.
-set _multiline_expected_outputs []
+# This is cleared at the end of each test by gcc-dg.exp's wrapper for dg-test.
+set multiline_expected_outputs []
############################################################################
# Exported functions.
@@ -94,9 +95,9 @@ proc dg-end-multiline-output { args } {
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 $entry
- verbose "within dg-end-multiline-output: _multiline_expected_outputs: $_multiline_expected_outputs" 3
+ global multiline_expected_outputs
+ lappend multiline_expected_outputs $entry
+ verbose "within dg-end-multiline-output: multiline_expected_outputs: $multiline_expected_outputs" 3
set _multiline_last_beginning_line -1
}
@@ -107,14 +108,12 @@ proc dg-end-multiline-output { args } {
# those that weren't found.
#
# It returns a pruned version of its output.
-#
-# It also clears the list of expected multiline outputs.
proc handle-multiline-outputs { text } {
- global _multiline_expected_outputs
+ global multiline_expected_outputs
global testname_with_flags
set index 0
- foreach entry $_multiline_expected_outputs {
+ foreach entry $multiline_expected_outputs {
verbose " entry: $entry" 3
set start_line [lindex $entry 0]
set end_line [lindex $entry 1]
@@ -140,9 +139,6 @@ proc handle-multiline-outputs { text } {
set index [expr $index + 1]
}
- # Clear the list of expected multiline outputs
- set _multiline_expected_outputs []
-
return $text
}
--
1.8.5.3
next prev parent reply other threads:[~2016-01-09 0:30 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-29 9:17 [PATCH] testsuite/lib/multline.exp: show test name and line numbers Uros Bizjak
2016-01-07 12:11 ` Bernd Schmidt
2016-01-07 12:23 ` Uros Bizjak
2016-01-09 0:30 ` David Malcolm [this message]
2016-01-09 2:07 ` [PATCH] PR testsuite/69181: ensure expected multiline outputs is cleared per-test Bernd Schmidt
2016-01-12 19:34 ` David Malcolm
2016-01-13 6:21 ` Jeff Law
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1452300686-14972-1-git-send-email-dmalcolm@redhat.com \
--to=dmalcolm@redhat.com \
--cc=bschmidt@redhat.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=ubizjak@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).