This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[patch] testsuite: fix to dg-xfail-if


This patch fixes a case where a test that uses dg-xfail-if is skipped,
but compiler_conditional_xfail_data is not cleared and so affects the
reported result of the test that is run next.  As far as I know this
doesn't affect any test currently in the GCC testsuite, but it could
cause confusing results later if such a test is added.  Tested using
artificial tests of the test framework that I'll submit shortly.  It
can also be seen by adding the following to testsuite/gcc.dg and
running only those tests; the first test is UNSUPPORTED as expected,
but the second is XPASS rather than PASS:

test1.c:
/* dg-do compile { target unknown-*-* } */
/* dg-xfail-if "" { *-*-* } { "*" } { "" } } */
int main () { return 0; }

test2.c:
int main () { return 0; }

OK for mainline?

2004-11-02  Janis Johnson  <janis187@us.ibm.com>

	* lib/gcc-dg.exp (dg-xfail-if): Ignore if skipping the test.

--- lib/gcc-dg.exp.orig	2004-11-02 13:58:33.000000000 -0800
+++ lib/gcc-dg.exp	2004-11-02 14:02:16.000000000 -0800
@@ -445,6 +445,12 @@ proc dg-prune-output { args } {
 # Like check_conditional_xfail, but callable from a dg test.
 
 proc dg-xfail-if { args } {
+    # Don't change anything if we're already skipping the test.
+    upvar dg-do-what dg-do-what
+    if { [lindex ${dg-do-what} 1] == "N" } {
+      return
+    }
+
     set args [lreplace $args 0 0]
     set selector "target [join [lindex $args 1]]"
     if { [dg-process-target $selector] == "S" } {


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]