summaryrefslogtreecommitdiff
path: root/ext/ffi_c/libffi/testsuite/lib/libffi.exp
diff options
context:
space:
mode:
Diffstat (limited to 'ext/ffi_c/libffi/testsuite/lib/libffi.exp')
-rw-r--r--ext/ffi_c/libffi/testsuite/lib/libffi.exp65
1 files changed, 64 insertions, 1 deletions
diff --git a/ext/ffi_c/libffi/testsuite/lib/libffi.exp b/ext/ffi_c/libffi/testsuite/lib/libffi.exp
index 4a65ed1..5051d31 100644
--- a/ext/ffi_c/libffi/testsuite/lib/libffi.exp
+++ b/ext/ffi_c/libffi/testsuite/lib/libffi.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2003, 2005, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
+# Copyright (C) 2003, 2005, 2008, 2009, 2010, 2011, 2014 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -101,9 +101,17 @@ proc libffi-init { args } {
global tool_root_dir
global ld_library_path
+ global using_gcc
+
set blddirffi [pwd]/..
verbose "libffi $blddirffi"
+ # Are we building with GCC?
+ set tmp [grep ../config.status "GCC='yes'"]
+ if { [string match $tmp "GCC='yes'"] } {
+
+ set using_gcc "yes"
+
set gccdir [lookfor_file $tool_root_dir gcc/libgcc.a]
if {$gccdir != ""} {
set gccdir [file dirname $gccdir]
@@ -127,6 +135,13 @@ proc libffi-init { args } {
}
}
}
+
+ } else {
+
+ set using_gcc "no"
+
+ }
+
# add the library path for libffi.
append ld_library_path ":${blddirffi}/.libs"
@@ -203,6 +218,14 @@ proc libffi_target_compile { source dest type options } {
lappend options "libs= -lffi"
+ if { [string match "aarch64*-*-linux*" $target_triplet] } {
+ lappend options "libs= -lpthread"
+ }
+
+ if { [string match "*.cc" $source] } {
+ lappend options "c++"
+ }
+
verbose "options: $options"
return [target_compile $source $dest $type $options]
}
@@ -254,6 +277,46 @@ proc libffi-dg-runtest { testcases default-extra-flags } {
}
}
+proc run-many-tests { testcases extra_flags } {
+ global using_gcc
+ if { [string match $using_gcc "yes"] } {
+ set common "-W -Wall -Wno-psabi"
+ set optimizations { "-O0" "-O2" "-O3" "-Os" "-O2 -fomit-frame-pointer" }
+ } else {
+ # Assume we are using the vendor compiler.
+ set common ""
+ set optimizations { "" }
+ }
+
+ set targetabis { "" }
+ if [string match $using_gcc "yes"] {
+ if [istarget "i?86-*-*"] {
+ set targetabis {
+ ""
+ "-DABI_NUM=FFI_STDCALL -DABI_ATTR=__STDCALL__"
+ "-DABI_NUM=FFI_THISCALL -DABI_ATTR=__THISCALL__"
+ "-DABI_NUM=FFI_FASTCALL -DABI_ATTR=__FASTCALL__"
+ }
+ }
+ }
+
+ set common [ concat $common $extra_flags ]
+ foreach test $testcases {
+ set testname [file tail $test]
+ if [search_for $test "ABI_NUM"] {
+ set abis $targetabis
+ } else {
+ set abis { "" }
+ }
+ foreach opt $optimizations {
+ foreach abi $abis {
+ set options [concat $common $opt $abi]
+ verbose "Testing $testname, $options" 1
+ dg-test $test $options ""
+ }
+ }
+ }
+}
# Like check_conditional_xfail, but callable from a dg test.