[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Testsuite fixes (was Re: [PATCH] Fix libffi on m68k-linux-gnu, completely)



Dixi quod…

>although I believe some 3.0.11 checks to be broken:

And indeed, with a few minor changes on top of git master,
I still get a full run of PASS plus one XPASS on amd64-linux!

With the other patches (from this message’s parent) and
these applied, I get a full PASS on m68k-linux as well.

So, please git am these three diffs ☺

bye,
//mirabilos
-- 
FWIW, I'm quite impressed with mksh interactively. I thought it was much
*much* more bare bones. But it turns out it beats the living hell out of
ksh93 in that respect. I'd even consider it for my daily use if I hadn't
wasted half my life on my zsh setup. :-) -- Frank Terbeck in #!/bin/mksh
From 5cb15a3bad1f0fb360520dd48bfc938c821cdcca Mon Sep 17 00:00:00 2001
From: Thorsten Glaser <tg@mirbsd.org>
Date: Sun, 2 Dec 2012 23:20:56 +0000
Subject: [PATCH 1/2] Fix tests writing to a closure retval via pointer casts

As explained in <[🔎] Pine.BSM.4.64L.1212022014490.23442@herc.mirbsd.org>
all other tests that do the same cast to an ffi_arg pointer instead.

PASS on amd64-linux (Xen domU) and m68k-linux (ARAnyM)

Signed-off-by: Thorsten Glaser <tg@mirbsd.org>
---
 testsuite/libffi.call/cls_uchar_va.c  |    4 ++--
 testsuite/libffi.call/cls_ushort_va.c |    4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/testsuite/libffi.call/cls_uchar_va.c b/testsuite/libffi.call/cls_uchar_va.c
index 19cd4f3..6491c5b 100644
--- a/testsuite/libffi.call/cls_uchar_va.c
+++ b/testsuite/libffi.call/cls_uchar_va.c
@@ -12,9 +12,9 @@ typedef unsigned char T;
 static void cls_ret_T_fn(ffi_cif* cif __UNUSED__, void* resp, void** args,
 			 void* userdata __UNUSED__)
  {
-   *(T *)resp = *(T *)args[0];
+   *(ffi_arg *)resp = *(T *)args[0];
 
-   printf("%d: %d %d\n", *(T *)resp, *(T *)args[0], *(T *)args[1]);
+   printf("%d: %d %d\n", (int)(*(ffi_arg *)resp), *(T *)args[0], *(T *)args[1]);
  }
 
 typedef T (*cls_ret_T)(T, ...);
diff --git a/testsuite/libffi.call/cls_ushort_va.c b/testsuite/libffi.call/cls_ushort_va.c
index b2b5a3b..37aa106 100644
--- a/testsuite/libffi.call/cls_ushort_va.c
+++ b/testsuite/libffi.call/cls_ushort_va.c
@@ -12,9 +12,9 @@ typedef unsigned short T;
 static void cls_ret_T_fn(ffi_cif* cif __UNUSED__, void* resp, void** args,
 			 void* userdata __UNUSED__)
  {
-   *(T *)resp = *(T *)args[0];
+   *(ffi_arg *)resp = *(T *)args[0];
 
-   printf("%d: %d %d\n", *(T *)resp, *(T *)args[0], *(T *)args[1]);
+   printf("%d: %d %d\n", (int)(*(ffi_arg *)resp), *(T *)args[0], *(T *)args[1]);
  }
 
 typedef T (*cls_ret_T)(T, ...);
-- 
1.6.3.1

From c7028a2c3661f7863d6a87798ffde0a868e0dd0b Mon Sep 17 00:00:00 2001
From: Thorsten Glaser <tg@mirbsd.org>
Date: Sun, 2 Dec 2012 23:22:11 +0000
Subject: [PATCH 2/2] Fix vararg test

The C standard indeed promotes char and short to int on varargs;
ffi does the same, but to do that, it must be told the correct
types in arg_types[], not the already-promoted types.

XPASS on amd64-linux, thus adjusting the dejagnu header.
PASS on m68k-linux (given my other patches applied).

Signed-off-by: Thorsten Glaser <tg@mirbsd.org>
---
 testsuite/libffi.call/va_1.c |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/testsuite/libffi.call/va_1.c b/testsuite/libffi.call/va_1.c
index 5c7cce9..cf4dd85 100644
--- a/testsuite/libffi.call/va_1.c
+++ b/testsuite/libffi.call/va_1.c
@@ -5,7 +5,7 @@
    Originator:	        ARM Ltd. */
 
 /* { dg-do run } */
-/* { dg-output "" { xfail avr32*-*-* x86_64-*-*-* } } */
+/* { dg-output "" { xfail avr32*-*-* } } */
 
 #include "ffitest.h"
 #include <stdarg.h>
@@ -132,10 +132,10 @@ main (void)
   arg_types[1] = &s_type;
   arg_types[2] = &l_type;
   arg_types[3] = &s_type;
-  arg_types[4] = &ffi_type_uint;
-  arg_types[5] = &ffi_type_sint;
-  arg_types[6] = &ffi_type_uint;
-  arg_types[7] = &ffi_type_sint;
+  arg_types[4] = &ffi_type_uchar;
+  arg_types[5] = &ffi_type_schar;
+  arg_types[6] = &ffi_type_ushort;
+  arg_types[7] = &ffi_type_sshort;
   arg_types[8] = &ffi_type_uint;
   arg_types[9] = &ffi_type_sint;
   arg_types[10] = &ffi_type_ulong;
-- 
1.6.3.1


Reply to: