summaryrefslogtreecommitdiff
path: root/testsuite
diff options
context:
space:
mode:
authorAnthony Green <green@moxielogic.com>2018-05-09 10:50:46 -0400
committerAnthony Green <green@moxielogic.com>2018-05-09 10:50:46 -0400
commit8206253fdf01226173c36f087226d8ea53584566 (patch)
tree1b66b8a1eb9d16949d6752c0ae901c30c2868b18 /testsuite
parentb5ee395710e2db830749c3c95558c91b66ac111f (diff)
downloadlibffi-8206253fdf01226173c36f087226d8ea53584566.tar.gz
Mark some cases as xfail due to GCC bug
Diffstat (limited to 'testsuite')
-rw-r--r--testsuite/lib/libffi.exp191
-rw-r--r--testsuite/libffi.bhaible/bhaible.exp2
-rw-r--r--testsuite/libffi.bhaible/test-call.c2
-rw-r--r--testsuite/libffi.bhaible/test-callback.c2
4 files changed, 194 insertions, 3 deletions
diff --git a/testsuite/lib/libffi.exp b/testsuite/lib/libffi.exp
index 76ef29c..28f793a 100644
--- a/testsuite/lib/libffi.exp
+++ b/testsuite/lib/libffi.exp
@@ -24,6 +24,183 @@ load_lib libgloss.exp
load_gcc_lib target-libpath.exp
load_gcc_lib wrapper.exp
+proc check_effective_target_gccbug { } {
+ global has_gccbug
+ return $has_gccbug
+}
+
+# Return 1 if the target matches the effective target 'arg', 0 otherwise.
+# This can be used with any check_* proc that takes no argument and
+# returns only 1 or 0. It could be used with check_* procs that take
+# arguments with keywords that pass particular arguments.
+
+proc is-effective-target { arg } {
+ global et_index
+ set selected 0
+ if { ![info exists et_index] } {
+ # Initialize the effective target index that is used in some
+ # check_effective_target_* procs.
+ set et_index 0
+ }
+ if { [info procs check_effective_target_${arg}] != [list] } {
+ set selected [check_effective_target_${arg}]
+ } else {
+ error "unknown effective target keyword `$arg'"
+ }
+ verbose "is-effective-target: $arg $selected" 2
+ return $selected
+}
+
+proc is-effective-target-keyword { arg } {
+ if { [info procs check_effective_target_${arg}] != [list] } {
+ return 1
+ } else {
+ return 0
+ }
+}
+
+# Intercept the call to the DejaGnu version of dg-process-target to
+# support use of an effective-target keyword in place of a list of
+# target triplets to xfail or skip a test.
+#
+# The argument to dg-process-target is the keyword "target" or "xfail"
+# followed by a selector:
+# target-triplet-1 ...
+# effective-target-keyword
+# selector-expression
+#
+# For a target list the result is "S" if the target is selected, "N" otherwise.
+# For an xfail list the result is "F" if the target is affected, "P" otherwise.
+
+# In contexts that allow either "target" or "xfail" the argument can be
+# target selector1 xfail selector2
+# which returns "N" if selector1 is not selected, otherwise the result of
+# "xfail selector2".
+#
+# A selector expression appears within curly braces and uses a single logical
+# operator: !, &&, or ||. An operand is another selector expression, an
+# effective-target keyword, or a list of target triplets within quotes or
+# curly braces.
+
+if { [info procs saved-dg-process-target] == [list] } {
+ rename dg-process-target saved-dg-process-target
+
+ # Evaluate an operand within a selector expression.
+ proc selector_opd { op } {
+ set selector "target"
+ lappend selector $op
+ set answer [ expr { [dg-process-target $selector] == "S" } ]
+ verbose "selector_opd: `$op' $answer" 2
+ return $answer
+ }
+
+ # Evaluate a target triplet list within a selector expression.
+ # Unlike other operands, this needs to be expanded from a list to
+ # the same string as "target".
+ proc selector_list { op } {
+ set selector "target [join $op]"
+ set answer [ expr { [dg-process-target $selector] == "S" } ]
+ verbose "selector_list: `$op' $answer" 2
+ return $answer
+ }
+
+ # Evaluate a selector expression.
+ proc selector_expression { exp } {
+ if { [llength $exp] == 2 } {
+ if [string match "!" [lindex $exp 0]] {
+ set op1 [lindex $exp 1]
+ set answer [expr { ! [selector_opd $op1] }]
+ } else {
+ # Assume it's a list of target triplets.
+ set answer [selector_list $exp]
+ }
+ } elseif { [llength $exp] == 3 } {
+ set op1 [lindex $exp 0]
+ set opr [lindex $exp 1]
+ set op2 [lindex $exp 2]
+ if [string match "&&" $opr] {
+ set answer [expr { [selector_opd $op1] && [selector_opd $op2] }]
+ } elseif [string match "||" $opr] {
+ set answer [expr { [selector_opd $op1] || [selector_opd $op2] }]
+ } else {
+ # Assume it's a list of target triplets.
+ set answer [selector_list $exp]
+ }
+ } else {
+ # Assume it's a list of target triplets.
+ set answer [selector_list $exp]
+ }
+
+ verbose "selector_expression: `$exp' $answer" 2
+ return $answer
+ }
+
+ # Evaluate "target selector" or "xfail selector".
+
+ proc dg-process-target-1 { args } {
+ verbose "dg-process-target-1: `$args'" 2
+
+ # Extract the 'what' keyword from the argument list.
+ set selector [string trim [lindex $args 0]]
+ if [regexp "^xfail " $selector] {
+ set what "xfail"
+ } elseif [regexp "^target " $selector] {
+ set what "target"
+ } else {
+ error "syntax error in target selector \"$selector\""
+ }
+
+ # Extract the rest of the list, which might be a keyword.
+ regsub "^${what}" $selector "" rest
+ set rest [string trim $rest]
+
+ if [is-effective-target-keyword $rest] {
+ # The selector is an effective target keyword.
+ if [is-effective-target $rest] {
+ return [expr { $what == "xfail" ? "F" : "S" }]
+ } else {
+ return [expr { $what == "xfail" ? "P" : "N" }]
+ }
+ }
+
+ if [string match "{*}" $rest] {
+ if [selector_expression [lindex $rest 0]] {
+ return [expr { $what == "xfail" ? "F" : "S" }]
+ } else {
+ return [expr { $what == "xfail" ? "P" : "N" }]
+ }
+ }
+
+ # The selector is not an effective-target keyword, so process
+ # the list of target triplets.
+ return [saved-dg-process-target $selector]
+ }
+
+ # Intercept calls to the DejaGnu function. In addition to
+ # processing "target selector" or "xfail selector", handle
+ # "target selector1 xfail selector2".
+
+ proc dg-process-target { args } {
+ verbose "replacement dg-process-target: `$args'" 2
+
+ set selector [string trim [lindex $args 0]]
+
+ # If the argument list contains both 'target' and 'xfail',
+ # process 'target' and, if that succeeds, process 'xfail'.
+ if [regexp "^target .* xfail .*" $selector] {
+ set xfail_index [string first "xfail" $selector]
+ set xfail_selector [string range $selector $xfail_index end]
+ set target_selector [string range $selector 0 [expr $xfail_index-1]]
+ set target_selector [string trim $target_selector]
+ if { [dg-process-target-1 $target_selector] == "N" } {
+ return "N"
+ }
+ return [dg-process-target-1 $xfail_selector]
+
+ }
+ return [dg-process-target-1 $selector]
+ }
+}
# Define libffi callbacks for dg.exp.
@@ -299,6 +476,7 @@ proc libffi-dg-runtest { testcases default-extra-flags } {
proc run-many-tests { testcases extra_flags } {
global compiler_vendor
+ global has_gccbug
switch $compiler_vendor {
"clang" {
set common "-W -Wall"
@@ -329,7 +507,7 @@ proc run-many-tests { testcases extra_flags } {
&& !defined __i386__"] } {
set targetabis {
""
- "-DABI_NUM=FFI_WIN64 -DABI_ATTR=__MSABI__"
+ "-DABI_NUM=FFI_GNUW64 -DABI_ATTR=__MSABI__"
}
}
}
@@ -345,6 +523,17 @@ proc run-many-tests { testcases extra_flags } {
foreach opt $optimizations {
foreach abi $abis {
set options [concat $common $opt $abi]
+ set has_gccbug false;
+ if { [string match $compiler_vendor "gnu"] \
+ && [string match "*MSABI*" $abi] \
+ && ( ( [string match "*DGTEST=57 *" $common] \
+ && [string match "*call.c*" $testname] ) \
+ || ( [string match "*DGTEST=54 *" $common] \
+ && [string match "*callback*" $testname] ) \
+ || [string match "*DGTEST=55 *" $common] \
+ || [string match "*DGTEST=56 *" $common] ) } then {
+ set has_gccbug true;
+ }
verbose "Testing $testname, $options" 1
dg-test $test $options ""
}
diff --git a/testsuite/libffi.bhaible/bhaible.exp b/testsuite/libffi.bhaible/bhaible.exp
index 6a0bb45..4e5051b 100644
--- a/testsuite/libffi.bhaible/bhaible.exp
+++ b/testsuite/libffi.bhaible/bhaible.exp
@@ -19,6 +19,7 @@ libffi-init
global srcdir subdir
global compiler_vendor
+global has_gccbug
# The conversion of this testsuite into a dejagnu compatible testsuite
# was done in a pretty lazy fashion, and requires the use of compiler
@@ -37,6 +38,7 @@ if { ![string match $compiler_vendor "microsoft"] && ![string match $compiler_ve
set warning_options "-Wno-unused-variable -Wno-unused-parameter -Wno-uninitialized";
}
+
set tlist [lsort [glob -nocomplain -- $srcdir/$subdir/test-call.c]]
for {set i 1} {$i < 82} {incr i} {
diff --git a/testsuite/libffi.bhaible/test-call.c b/testsuite/libffi.bhaible/test-call.c
index 01a8a21..caa77de 100644
--- a/testsuite/libffi.bhaible/test-call.c
+++ b/testsuite/libffi.bhaible/test-call.c
@@ -16,7 +16,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
**/
-/* { dg-do run } */
+/* { dg-do run { xfail gccbug } }*/
#include <stdio.h>
#include <stdlib.h>
diff --git a/testsuite/libffi.bhaible/test-callback.c b/testsuite/libffi.bhaible/test-callback.c
index c2633c7..67a8145 100644
--- a/testsuite/libffi.bhaible/test-callback.c
+++ b/testsuite/libffi.bhaible/test-callback.c
@@ -16,7 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-/* { dg-do run } */
+/* { dg-do run { xfail gccbug } }*/
#include <stdio.h>
#include <stdlib.h>