summaryrefslogtreecommitdiff
path: root/testsuite
diff options
context:
space:
mode:
authorJosh Triplett <josh@joshtriplett.org>2014-03-16 16:04:58 -0700
committerJosh Triplett <josh@joshtriplett.org>2014-03-16 20:34:46 -0700
commit5695ec1444c5323e48fe4314f8c8f027625e67df (patch)
treee4853b0508ec91b102d6c76d1e562d21bede8822 /testsuite
parentdfdb02cc869855d3b68571e5f7aa77ae8c9d254a (diff)
downloadlibffi-5695ec1444c5323e48fe4314f8c8f027625e67df.tar.gz
testsuite: Factor out a function to run a matrix of tests
This commons up code from libffi.call/call.exp and libffi.special/special.exp, unifies the optimization option matrix between the two, and makes it easier to add more axes to the matrix in the future.
Diffstat (limited to 'testsuite')
-rw-r--r--testsuite/lib/libffi.exp17
-rw-r--r--testsuite/libffi.call/call.exp15
-rw-r--r--testsuite/libffi.special/special.exp11
3 files changed, 19 insertions, 24 deletions
diff --git a/testsuite/lib/libffi.exp b/testsuite/lib/libffi.exp
index 1ac2c36..014e520 100644
--- a/testsuite/lib/libffi.exp
+++ b/testsuite/lib/libffi.exp
@@ -273,6 +273,23 @@ 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"
+ set optimizations { "-O0" "-O2" "-O3" "-Os" "-O2 -fomit-frame-pointer" }
+ } else {
+ # Assume we are using the vendor compiler.
+ set common ""
+ set optimizations { "" }
+ }
+
+ set common [ concat $common $extra_flags ]
+ foreach opt $optimizations {
+ set options [ concat $common $opt ]
+ dg-runtest $testcases $options ""
+ }
+}
# Like check_conditional_xfail, but callable from a dg test.
diff --git a/testsuite/libffi.call/call.exp b/testsuite/libffi.call/call.exp
index c334685..c1ad737 100644
--- a/testsuite/libffi.call/call.exp
+++ b/testsuite/libffi.call/call.exp
@@ -19,20 +19,7 @@ libffi-init
global srcdir subdir
-if { [string match $using_gcc "yes"] } {
-
- dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] "-O0 -W -Wall" ""
- dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] "-O2" ""
- dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] "-O3" ""
- dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] "-Os" ""
- dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] "-O2 -fomit-frame-pointer" ""
-
-} else {
-
- # Assume we are using the vendor compiler.
- dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] "" ""
-
-}
+run-many-tests [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] ""
dg-finish
diff --git a/testsuite/libffi.special/special.exp b/testsuite/libffi.special/special.exp
index f1a5fa6..f7155bf 100644
--- a/testsuite/libffi.special/special.exp
+++ b/testsuite/libffi.special/special.exp
@@ -19,17 +19,8 @@ libffi-init
global srcdir subdir
-global cxx_options
-
-set cxx_options " -shared-libgcc -lstdc++"
-
if { [string match $using_gcc "yes"] } {
-
- dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.cc]] $cxx_options "-O0 -W -Wall"
- dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.cc]] $cxx_options "-O2"
- dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.cc]] $cxx_options "-O3"
- dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.cc]] $cxx_options "-Os"
-
+ run-many-tests [lsort [glob -nocomplain $srcdir/$subdir/*.cc]] "-shared-libgcc -lstdc++"
}
dg-finish