From 53fd7bd43eb9a513f5a81f9ebbd99a7cc4172430 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Sun, 21 May 2017 14:18:02 -0700 Subject: ffi: port glob tests to Darwin. * tests/017/glob-carray.tl (glob-t): Initialize reserve member to 0. Since it doesn't exist on Darwin, it will stay nil, and change the the test output. A Darwin variant of the corresponding FFI type is provided. * tests/017/glob-zarray.tl (glob-t): Likewise. --- tests/017/glob-carray.tl | 19 ++++++++++++++----- tests/017/glob-zarray.tl | 19 ++++++++++++++----- 2 files changed, 28 insertions(+), 10 deletions(-) diff --git a/tests/017/glob-carray.tl b/tests/017/glob-carray.tl index 3c68ac1a..f98359a8 100644 --- a/tests/017/glob-carray.tl +++ b/tests/017/glob-carray.tl @@ -1,12 +1,21 @@ (load "../common") (defstruct glob-t nil - pathc pathv reserve) + pathc pathv (reserve 0)) -(deffi-type glob-t (struct glob-t - (pathc size-t) - (pathv (carray str-d)) - (reserve size-t))) +(cond + ((eq (os-symbol) :macos) + (deffi-type glob-t (struct glob-t + (pathc size-t) + (nil int) + (nil size-t) + (nil int) + (pathv (carray str-d)) + (nil (array 4 cptr))))) + (t (deffi-type glob-t (struct glob-t + (pathc size-t) + (pathv (carray str-d)) + (reserve size-t))))) (with-dyn-lib nil (deffi globb "glob" int (str int closure (ptr-out glob-t))) diff --git a/tests/017/glob-zarray.tl b/tests/017/glob-zarray.tl index b6e16d13..0597da86 100644 --- a/tests/017/glob-zarray.tl +++ b/tests/017/glob-zarray.tl @@ -1,12 +1,21 @@ (load "../common") (defstruct glob-t nil - pathc pathv reserve) + pathc pathv (reserve 0)) -(deffi-type glob-t (struct glob-t - (pathc size-t) - (pathv (ptr-out-d (zarray str-d))) - (reserve size-t))) +(cond + ((eq (os-symbol) :macos) + (deffi-type glob-t (struct glob-t + (pathc size-t) + (nil int) + (nil size-t) + (nil int) + (pathv (ptr-out-d (zarray str-d))) + (nil (array 4 cptr))))) + (t (deffi-type glob-t (struct glob-t + (pathc size-t) + (pathv (ptr-out-d (zarray str-d))) + (reserve size-t))))) (with-dyn-lib (libc) (deffi globb "glob" int (str int closure (ptr-out glob-t))) -- cgit v1.2.3