This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[patch] testsuite: new proc dg-target-list
- From: Janis Johnson <janis187 at us dot ibm dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Fri, 5 Nov 2004 10:37:44 -0800
- Subject: [patch] testsuite: new proc dg-target-list
This patch adds proc dg-target-list which can be used in dg- commands
that expect a target list, possibly preceded by the keyword "target" or
"xfail". Its first argument is the keyword, or "" for no keyword, and
the second argument is a 1 or 0 that is the result of a TCL conditional
expression. It allows a lot of flexibility for specifying target lists
since the expression can include combinations of [istarget xxx] and
[check-whatever].
Some of examples of how this could be used in actual tests:
{ dg-do run [dg-target-list target [expr [istarget powerpc*-*-linux*] && [check_effective_target lp64]]] }
{ dg-xfail-if "" [dg-target-list "" [expr [check_effective_target ilp32] && [expr [istarget sparc*-*-*] || [istarget powerpc*-*-*]]]] { "*" } { "" } }
{ dg-final { scan-assembler "something" [dg-target-list xfail [check_gc_sections_available]] } }
My earlier versions of this were much more complex but then I figured
out how to get TCL to do most of the work. There might be a way to do
this without even using dg-target-list, but if so I haven't found it.
I've tested this with an expanded version of my generated test framework
tests, which I'll post shortly (I posted a smaller version a few days
ago).
OK for mainline?
2004-11-05 Janis Johnson <janis187@us.ibm.com>
* lib/gcc-dg.exp (dg-target-list): New
--- lib/gcc-dg.exp.orig 2004-11-04 18:16:39.000000000 -0800
+++ lib/gcc-dg.exp 2004-11-04 18:17:10.000000000 -0800
@@ -453,6 +453,25 @@ proc dg-xfail-if { args } {
}
}
+# Given an optional keyword "target" or "fail" and the result of a
+# condition which has been evaluated by the framework, return a list
+# containing the keyword and "*-*-*" if the condition is true or
+# "empty-empty-empty" if the condition is false.
+
+proc dg-target-list { what cond } {
+ switch $what {
+ "target" { set result [list $what] }
+ "xfail" { set result [list $what] }
+ "" { set result [list] }
+ default { error "`$what' not allowed here" }
+ }
+ if { $cond } {
+ lappend result "*-*-*"
+ } else {
+ lappend result "empty-empty-empty"
+ }
+ return $result
+}
# We need to make sure that additional_* are cleared out after every
# test. It is not enough to clear them out *before* the next test run