From: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
To: gcc-patches@gcc.gnu.org
Cc: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>,
Mike Stump <mikestump@comcast.net>,
Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
Subject: [PATCH] PR52665 do not let .ident confuse assembler scan tests
Date: Sat, 18 Jun 2016 19:31:00 -0000 [thread overview]
Message-ID: <1466278273-7014-1-git-send-email-rep.dot.nop@gmail.com> (raw)
A branch with a name matching scan-assembler pattern triggers
inappropriate FAIL.
E.g. branch fixups-testsuite and
- gcc.target/i386/pr65871-?.c (scan-assembler-not "test")
- gcc.target/i386/pr41442.c (scan-assembler-times "test|cmp" 2)
etc.
This is a recurring problem as can be seen by some -fno-ident additions
by commits from e.g. Michael Meissner over the years: builtins-58.c,
powerpc/pr46728-?.c
The patch below adds -fno-ident if a testcase contains one of
scan-assembler, scan-assembler-not or scan-assembler-times.
Regression tested on x86_64-unknown-linux on a fixups-testsuite branch
where it fixes several false FAILs without regressions.
gcc/testsuite/ChangeLog
2016-06-18 Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
PR testsuite/52665
* lib/gcc-dg.exp (gcc-dg-test-1): Iterate over _required_options.
* lib/target-supports.exp (scan-assembler_required_options,
scan-assembler-not_required_options,
scan-assembler-times_required_options): Add -fno-ident.
* lib/scanasm.exp (scan-assembler-times): Fix error message.
* c-c++-common/ident-0a.c: New test.
* c-c++-common/ident-0b.c: New test.
* c-c++-common/ident-1a.c: New test.
* c-c++-common/ident-1b.c: New test.
* c-c++-common/ident-2a.c: New test.
* c-c++-common/ident-2b.c: New test.
Ok for trunk?
PS: proc force_conventional_output_for would be a bit misnomed by this,
not sure if it should be renamed to maybe set_required_options_for or
the like?
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
Cc: Mike Stump <mikestump@comcast.net>
Cc: Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
---
gcc/testsuite/c-c++-common/ident-0a.c | 6 ++++++
gcc/testsuite/c-c++-common/ident-0b.c | 10 ++++++++++
gcc/testsuite/c-c++-common/ident-1a.c | 8 ++++++++
gcc/testsuite/c-c++-common/ident-1b.c | 7 +++++++
gcc/testsuite/c-c++-common/ident-2a.c | 6 ++++++
gcc/testsuite/c-c++-common/ident-2b.c | 7 +++++++
gcc/testsuite/lib/gcc-dg.exp | 8 +++++---
gcc/testsuite/lib/scanasm.exp | 4 ++--
gcc/testsuite/lib/target-supports.exp | 6 ++++++
9 files changed, 57 insertions(+), 5 deletions(-)
create mode 100644 gcc/testsuite/c-c++-common/ident-0a.c
create mode 100644 gcc/testsuite/c-c++-common/ident-0b.c
create mode 100644 gcc/testsuite/c-c++-common/ident-1a.c
create mode 100644 gcc/testsuite/c-c++-common/ident-1b.c
create mode 100644 gcc/testsuite/c-c++-common/ident-2a.c
create mode 100644 gcc/testsuite/c-c++-common/ident-2b.c
diff --git a/gcc/testsuite/c-c++-common/ident-0a.c b/gcc/testsuite/c-c++-common/ident-0a.c
new file mode 100644
index 0000000..900d206
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/ident-0a.c
@@ -0,0 +1,6 @@
+/* PR testsuite/52665
+ * Make sure scan-assembler-not turns off .ident */
+/* { dg-do compile } */
+int i;
+
+/* { dg-final { scan-assembler-not "GCC: " } } */
diff --git a/gcc/testsuite/c-c++-common/ident-0b.c b/gcc/testsuite/c-c++-common/ident-0b.c
new file mode 100644
index 0000000..e08126d
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/ident-0b.c
@@ -0,0 +1,10 @@
+/* PR testsuite/52665
+ * Make sure scan-assembler-not turns off .ident unless -fident in testcase */
+/* { dg-do compile } */
+/* { dg-options "-fident" } */
+int i;
+
+/* { dg-final { scan-assembler-not "GCC: " { xfail *-*-* } } } */
+/* The testsuite saw scan-assembler-not and turned off .ident so the above
+ * has to fail for proper operation since the testsuite itself forced
+ * -fident on again. */
diff --git a/gcc/testsuite/c-c++-common/ident-1a.c b/gcc/testsuite/c-c++-common/ident-1a.c
new file mode 100644
index 0000000..867ee43
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/ident-1a.c
@@ -0,0 +1,8 @@
+/* PR testsuite/52665
+ * Make sure scan-assembler turns off .ident */
+/* { dg-do compile } */
+int i;
+
+/* { dg-final { scan-assembler "GCC: " { xfail *-*-* } } } */
+/* The testsuite saw scan-assembler and turned off .ident so the above
+ * has to fail for proper operation. */
diff --git a/gcc/testsuite/c-c++-common/ident-1b.c b/gcc/testsuite/c-c++-common/ident-1b.c
new file mode 100644
index 0000000..2431086
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/ident-1b.c
@@ -0,0 +1,7 @@
+/* PR testsuite/52665
+ * Make sure scan-assembler turns off .ident unless -fident in testcase */
+/* { dg-do compile } */
+/* { dg-options "-fident" } */
+int i;
+
+/* { dg-final { scan-assembler "GCC: " } } */
diff --git a/gcc/testsuite/c-c++-common/ident-2a.c b/gcc/testsuite/c-c++-common/ident-2a.c
new file mode 100644
index 0000000..131b867
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/ident-2a.c
@@ -0,0 +1,6 @@
+/* PR testsuite/52665
+ * Make sure scan-assembler-times turns off .ident */
+/* { dg-do compile } */
+int i;
+
+/* { dg-final { scan-assembler-times "GCC: " 0 } } */ /* internal test, keep -times 0 ! */
diff --git a/gcc/testsuite/c-c++-common/ident-2b.c b/gcc/testsuite/c-c++-common/ident-2b.c
new file mode 100644
index 0000000..a21e25f
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/ident-2b.c
@@ -0,0 +1,7 @@
+/* PR testsuite/52665
+ * Make sure scan-assembler-times turns off .ident unless -fident in testcase */
+/* { dg-do compile } */
+/* { dg-options "-fident" } */
+int ident;
+
+/* { dg-final { scan-assembler-times "GCC: " 1 } } */
diff --git a/gcc/testsuite/lib/gcc-dg.exp b/gcc/testsuite/lib/gcc-dg.exp
index 7039140..081b1a8 100644
--- a/gcc/testsuite/lib/gcc-dg.exp
+++ b/gcc/testsuite/lib/gcc-dg.exp
@@ -270,9 +270,11 @@ proc gcc-dg-test-1 { target_compile prog do_what extra_tool_flags } {
foreach x [split $finalcode "\n"] {
set finalcmd [lindex $x 0]
if { [info procs ${finalcmd}_required_options] != "" } {
- set req [${finalcmd}_required_options]
- if { $req != "" && [lsearch -exact $extra_tool_flags $req] == -1 } {
- lappend extra_tool_flags $req
+ foreach req [${finalcmd}_required_options] {
+ if { $req != ""
+ && [lsearch -exact $extra_tool_flags $req] == -1 } {
+ lappend extra_tool_flags $req
+ }
}
}
}
diff --git a/gcc/testsuite/lib/scanasm.exp b/gcc/testsuite/lib/scanasm.exp
index 07b8f7d..a368474 100644
--- a/gcc/testsuite/lib/scanasm.exp
+++ b/gcc/testsuite/lib/scanasm.exp
@@ -212,11 +212,11 @@ proc scan-ada-spec-not { args } {
# Call pass if pattern is present given number of times, otherwise fail.
proc scan-assembler-times { args } {
if { [llength $args] < 2 } {
- error "scan-assembler: too few arguments"
+ error "scan-assembler-times: too few arguments"
return
}
if { [llength $args] > 3 } {
- error "scan-assembler: too many arguments"
+ error "scan-assembler-times: too many arguments"
return
}
if { [llength $args] >= 3 } {
diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp
index ef5271a..d9ac988 100644
--- a/gcc/testsuite/lib/target-supports.exp
+++ b/gcc/testsuite/lib/target-supports.exp
@@ -6910,6 +6910,12 @@ proc force_conventional_output_for { test } {
}
proc ${test}_required_options {} {
global gcc_force_conventional_output
+ upvar 1 extra_tool_flags extra_tool_flags
+ if {[regexp -- "^scan-assembler" [info level 0]]
+ && ![string match "*-fident*" $extra_tool_flags]} {
+ # Do not let .ident confuse assembler scan tests
+ return [list $gcc_force_conventional_output "-fno-ident"]
+ }
return $gcc_force_conventional_output
}
}
--
2.8.1
next reply other threads:[~2016-06-18 19:31 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-18 19:31 Bernhard Reutner-Fischer [this message]
2016-06-18 23:49 ` Hans-Peter Nilsson
2016-06-19 20:21 ` Mike Stump
2018-02-02 13:25 ` Bernhard Reutner-Fischer
2018-02-02 18:56 ` Mike Stump
2018-05-01 17:47 ` Jeff Law
2022-04-25 23:00 ` testsuite -fno-file [was: Re: [PATCH] PR52665 do not let .ident confuse assembler scan tests] Bernhard Reutner-Fischer
2016-06-20 22:20 ` [PATCH] PR52665 do not let .ident confuse assembler scan tests Jeff Law
2018-09-05 15:32 ` Bernhard Reutner-Fischer
2023-05-31 18:50 ` Bernhard Reutner-Fischer
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=1466278273-7014-1-git-send-email-rep.dot.nop@gmail.com \
--to=rep.dot.nop@gmail.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=mikestump@comcast.net \
--cc=ro@CeBiTec.Uni-Bielefeld.DE \
/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).