Commit f03ba2032850545dc6869bb495170a8c6cbf849d

Tom Tromey 2016-08-02T10:23:25

Merge pull request #266 from dr-hannibal/arc-pthread Make testing easier outside of build directory and especially for ARC

diff --git a/testsuite/lib/libffi.exp b/testsuite/lib/libffi.exp
index afc421b..6e5f7a4 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"] } {
@@ -219,6 +222,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]
 }
diff --git a/testsuite/libffi.call/cls_dbls_struct.c b/testsuite/libffi.call/cls_dbls_struct.c
index d663791..e451dea 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;
 }
diff --git a/testsuite/libffi.call/float2.c b/testsuite/libffi.call/float2.c
index 20a8c40..d583e22 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);