This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
[dejagnu patch] tweak conditional_xfail empty 'includes' listbehaviour
- From: cgd at broadcom dot com
- To: bug-dejagnu at gnu dot org,gdb-patches at sources dot redhat dot com
- Date: 30 Apr 2003 13:31:08 -0700
- Subject: [dejagnu patch] tweak conditional_xfail empty 'includes' listbehaviour
I'd like to get the patch below applied to the master dejagnu sources,
and (if it's acceptable in the master sources) also either to have it
applied to the sources.redhat.com dejagnu sources or approval to apply
it there myself.
I believe the change is fairly self-explanatory. The situation that
i'm trying to address is certain tests which should, say, be
conditionally-xfailed for certain MIPS targets, but only with certain
flags.
In particular, gcc's gcc.c-torture/execute/20020227-1.c will fail for
64-bit MIPS targets ** unless ** one of the 32-bit compilation mode
flags is specified. i.e. always unless one of the 'excludes' list
entries matches.
My feeling was that the most intuitive way to do this was to specify
an empty 'includes' list, and so i produced code like:
[ ... ]
} elseif { [istarget "mips*64*-*-*"] || [istarget "mips*-*-irix6*"] } {
# 64-bit MIPS fails at all optimization levels, but doesn't fail
# with a 32-bit ISA spec.
set torture_eval_before_execute {
global compiler_conditional_xfail_data
set compiler_conditional_xfail_data {
"This test fails on 64-bit targets, see PR6221." \
{ "*-*-*" } \
{ } \
{ "-mips1" "-mips2" "-mips32" "-mips32r2" }
}
}
[ ... ]
which works with this patch.
An alternative that happens to work for the particular test in
question is to specify an includes list like:
{ {*} }
However, that matches "* * *" against the command being tested. In
this case (and probably in most cases that would be OK) but if one
happened to be testing a command with 0 or 1 arguments, it would fail.
That seemed like a ... really strange restriction, so i figured i'd
try to get it lifted.
(Note that { {} } does *not* work, because there aren't double-spaces
in the command line. Amusingly, a few of gcc tests seem to use { "" }
as their excludes list, when they want to exclude nothing, which would
break if there were double-spaces in the command line. Instead, it
seems the right thing to do there is to provide an empty excludes
list, or heck, just omit the excludes list altogether!)
I believe that this should be a safe change in semantics, because an
empty includes list used to mean "the condition will never be true,"
and, well, there's no point in doing the whole conditional xfail dance
if the condition will enver be true. 8-)
What say you?
chris
--
[ dejagnu/ChangeLog ]
2003-03-28 Chris Demetriou <cgd@broadcom.com>
* lib/framework.exp (check_conditional_xfail): Adjust so that
an empty 'includes' list matches all sets of flags.
* doc/dejagnu.texi: Document the above.
* doc/ref.sgml: Likewise.
Index: doc/dejagnu.texi
===================================================================
RCS file: /cvs/src/src/dejagnu/doc/dejagnu.texi,v
retrieving revision 1.4
diff -u -p -r1.4 dejagnu.texi
--- doc/dejagnu.texi 13 Sep 2002 21:02:20 -0000 1.4
+++ doc/dejagnu.texi 30 Apr 2003 20:16:00 -0000
@@ -1984,7 +1984,7 @@ results.
@cindex failure, conditional expected
@cindex conditional expected failure
-This procedure adds a condition xfail, based on compiler options used to
+This procedure adds a conditional xfail, based on compiler options used to
create a test case executable. If an include options is found in the
compiler flags, and it's the right architecture, it'll trigger an
XFAIL. Otherwise it'll produce an ordinary FAIL. You can also specify
@@ -2007,8 +2007,10 @@ is a string with the targets to activate
@item includes
is a list of sets of options to search for in the compiler options to
-activate this conditional. If any set of the options matches, then this
-conditional is true.
+activate this conditional. If the list of sets of options is empty or
+if any set of the options matches, then this conditional is true.
+(It may be useful to specify an empty list of include sets if the
+conditional is always true unless one of the exclude sets matches.)
@item excludes
is a list of sets of options to search for in the compiler options to
Index: doc/ref.sgml
===================================================================
RCS file: /cvs/src/src/dejagnu/doc/ref.sgml,v
retrieving revision 1.3
diff -u -p -r1.3 ref.sgml
--- doc/ref.sgml 21 Apr 2002 08:47:03 -0000 1.3
+++ doc/ref.sgml 30 Apr 2003 20:16:01 -0000
@@ -787,7 +787,7 @@
<sect3 id=checkconditionalxfail xreflabel="check_conditional_xfail procedure">
<title>Check_conditional_xfail Procedure</title>
- <para>This procedure adds a condition xfail, based on compiler
+ <para>This procedure adds a conditional xfail, based on compiler
options used to create a test case executable. If an include options
is found in the compiler flags, and it's the right architecture,
it'll trigger an <emphasis>XFAIL</emphasis>. Otherwise it'll produce
@@ -825,9 +825,11 @@
<varlistentry>
<term><parameter>includes</parameter></term>
<listitem><para>This is a list of sets of options to search for in
- the compiler options to activate this conditional. If any set of
- the options matches, then this conditional is
- true.</para></listitem>
+ the compiler options to activate this conditional. If the list of
+ sets of options is empty or if any set of the options matches,
+ then this conditional is true. (It may be useful to specify an
+ empty list of include sets if the conditional is always true
+ unless one of the exclude sets matches.)</para></listitem>
</varlistentry>
<varlistentry>
<term><parameter>excludes</parameter></term>
Index: lib/framework.exp
===================================================================
RCS file: /cvs/src/src/dejagnu/lib/framework.exp,v
retrieving revision 1.9
diff -u -p -r1.9 framework.exp
--- lib/framework.exp 14 Sep 2002 00:31:38 -0000 1.9
+++ lib/framework.exp 30 Apr 2003 20:16:01 -0000
@@ -578,6 +578,11 @@ proc check_conditional_xfail { args } {
# list, regardless of order to make sure they're found.
# So we look for lists in side of lists, and make sure all
# the elements match before we decide this is legit.
+ # Se we 'incl_hit' to 1 before the loop so that if the 'includes'
+ # list is empty, this test will report a hit. (This can be
+ # useful if a target will always fail unless certain flags,
+ # specified in the 'excludes' list, are used.)
+ set incl_hit 1
for { set i 0 } { $i < [llength $includes] } { incr i } {
set incl_hit 0
set opt [lindex $includes $i]