From 31362d785ed1db52516dfe02ebe8b163c53d29d0 Mon Sep 17 00:00:00 2001 From: Yuriy Kolerov Date: Thu, 28 Jul 2016 18:48:23 +0300 Subject: [PATCH 1/4] ARC: Link tests with pthread library Signed-off-by: Yuriy Kolerov --- testsuite/lib/libffi.exp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/testsuite/lib/libffi.exp b/testsuite/lib/libffi.exp index afc421b6..de91e3b2 100644 --- a/testsuite/lib/libffi.exp +++ b/testsuite/lib/libffi.exp @@ -219,6 +219,10 @@ proc libffi_target_compile { source dest type options } { lappend options "c++" } + if { [string match "arc*-*-linux*" $target_triplet] } { + lappend options "libs= -lpthread" + } + verbose "options: $options" return [target_compile $source $dest $type $options] } From f74ea2dc7994b4867f7ab45169e1b2422072cc92 Mon Sep 17 00:00:00 2001 From: Yuriy Kolerov Date: Thu, 28 Jul 2016 20:57:09 +0300 Subject: [PATCH 2/4] Allow setting an arbitary value for blddirffi in testsuite It is useful when tests are executed not from build directory. So the path of the build directory may be passed through site.exp or runtest. Signed-off-by: Yuriy Kolerov --- testsuite/lib/libffi.exp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/testsuite/lib/libffi.exp b/testsuite/lib/libffi.exp index de91e3b2..6e5f7a47 100644 --- a/testsuite/lib/libffi.exp +++ b/testsuite/lib/libffi.exp @@ -102,11 +102,14 @@ proc libffi-init { args } { global ld_library_path global compiler_vendor - set blddirffi [pwd]/.. + if ![info exists blddirffi] { + set blddirffi [pwd]/.. + } + verbose "libffi $blddirffi" # Which compiler are we building with? - set tmp [grep ../config.log "^ax_cv_c_compiler_vendor.*$"] + set tmp [grep "$blddirffi/config.log" "^ax_cv_c_compiler_vendor.*$"] regexp -- {^[^=]*=(.*)$} $tmp nil compiler_vendor if { [string match $compiler_vendor "gnu"] } { From f3201733d54bf26ac40c432f4305499dd3f20215 Mon Sep 17 00:00:00 2001 From: Yuriy Kolerov Date: Fri, 29 Jul 2016 19:18:41 +0300 Subject: [PATCH 3/4] Fix output expectations in cls_dbls_struct.c test This test with invalid output expectations may fail on some targets (e.g. ARC processors). Signed-off-by: Yuriy Kolerov --- testsuite/libffi.call/cls_dbls_struct.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/testsuite/libffi.call/cls_dbls_struct.c b/testsuite/libffi.call/cls_dbls_struct.c index d6637911..e451dea5 100644 --- a/testsuite/libffi.call/cls_dbls_struct.c +++ b/testsuite/libffi.call/cls_dbls_struct.c @@ -57,10 +57,10 @@ int main(int argc __UNUSED__, char** argv __UNUSED__) CHECK(ffi_prep_closure_loc(pcl, &cif, closure_test_gn, NULL, code) == FFI_OK); ((void*(*)(Dbls))(code))(arg); - /* { dg-output "1.0 2.0\n" } */ + /* { dg-output "1.0 2.0" } */ closure_test_fn(arg); - /* { dg-output "1.0 2.0\n" } */ + /* { dg-output "\n1.0 2.0" } */ return 0; } From ef8be84de5f9e611add396efe908b772eb1cae1d Mon Sep 17 00:00:00 2001 From: Yuriy Kolerov Date: Fri, 29 Jul 2016 21:01:38 +0300 Subject: [PATCH 4/4] Do not use fabsl() in float2.c test Some targets may support long double variables but in the same time may lack support of long double functions like fabsl(). Signed-off-by: Yuriy Kolerov --- testsuite/libffi.call/float2.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/testsuite/libffi.call/float2.c b/testsuite/libffi.call/float2.c index 20a8c402..d583e22a 100644 --- a/testsuite/libffi.call/float2.c +++ b/testsuite/libffi.call/float2.c @@ -22,6 +22,7 @@ int main (void) void *values[MAX_ARGS]; float f; long double ld; + long double original; args[0] = &ffi_type_float; values[0] = &f; @@ -49,7 +50,8 @@ int main (void) #endif /* These are not always the same!! Check for a reasonable delta */ - if (fabsl(ld - ldblit(f)) < LDBL_EPSILON) + original = ldblit(f); + if (((ld > original) ? (ld - original) : (original - ld)) < LDBL_EPSILON) puts("long double return value tests ok!"); else CHECK(0);