Fix all tests on OSX
This commit is contained in:
parent
684cfa4691
commit
de9736da96
|
@ -10,6 +10,7 @@ fn main() {
|
|||
let mingw = target.contains("windows-gnu");
|
||||
let linux = target.contains("unknown-linux");
|
||||
let android = target.contains("android");
|
||||
let darwin = target.contains("apple-darwin");
|
||||
let mut cfg = ctest::TestGenerator::new();
|
||||
|
||||
// Pull in extra goodies on linux/mingw
|
||||
|
@ -37,7 +38,7 @@ fn main() {
|
|||
.header("time.h")
|
||||
.header("wchar.h");
|
||||
|
||||
if target.contains("apple-darwin") {
|
||||
if darwin {
|
||||
cfg.header("mach-o/dyld.h");
|
||||
cfg.header("mach/mach_time.h");
|
||||
} else if linux || android {
|
||||
|
@ -82,7 +83,6 @@ fn main() {
|
|||
cfg.header("utime.h");
|
||||
cfg.header("pwd.h");
|
||||
cfg.header("grp.h");
|
||||
cfg.header("malloc.h");
|
||||
|
||||
if android {
|
||||
cfg.header("arpa/inet.h");
|
||||
|
@ -93,6 +93,13 @@ fn main() {
|
|||
cfg.header("execinfo.h");
|
||||
}
|
||||
|
||||
if darwin {
|
||||
cfg.header("malloc/malloc.h");
|
||||
cfg.header("crt_externs.h");
|
||||
} else {
|
||||
cfg.header("malloc.h");
|
||||
}
|
||||
|
||||
}
|
||||
if target.contains("linux") {
|
||||
cfg.header("sys/prctl.h");
|
||||
|
@ -108,6 +115,9 @@ fn main() {
|
|||
"time64_t" if windows => "__time64_t".to_string(),
|
||||
"ssize_t" if windows => "SSIZE_T".to_string(),
|
||||
|
||||
// OSX calls this something else
|
||||
"sighandler_t" if darwin => "sig_t".to_string(),
|
||||
|
||||
t if t.ends_with("_t") => t.to_string(),
|
||||
|
||||
// Windows uppercase structs don't have `struct` in front, there's a
|
||||
|
|
|
@ -150,7 +150,6 @@ extern {
|
|||
base: c_int) -> c_ulong;
|
||||
pub fn calloc(nobj: size_t, size: size_t) -> *mut c_void;
|
||||
pub fn malloc(size: size_t) -> *mut c_void;
|
||||
pub fn memalign(align: size_t, size: size_t) -> *mut c_void;
|
||||
pub fn realloc(p: *mut c_void, size: size_t) -> *mut c_void;
|
||||
pub fn free(p: *mut c_void);
|
||||
pub fn exit(status: c_int) -> !;
|
||||
|
|
|
@ -124,32 +124,33 @@ s! {
|
|||
|
||||
|
||||
pub struct pthread_mutex_t {
|
||||
__sig: libc::c_long,
|
||||
__sig: ::c_long,
|
||||
__opaque: [u8; __PTHREAD_MUTEX_SIZE__],
|
||||
}
|
||||
pub struct pthread_mutexattr_t {
|
||||
__sig: libc::c_long,
|
||||
__opaque: [u8; 16],
|
||||
__sig: ::c_long,
|
||||
__opaque: [u8; 8],
|
||||
}
|
||||
|
||||
pub struct pthread_cond_t {
|
||||
__sig: libc::c_long,
|
||||
__sig: ::c_long,
|
||||
__opaque: [u8; __PTHREAD_COND_SIZE__],
|
||||
}
|
||||
|
||||
pub struct pthread_rwlock_t {
|
||||
__sig: libc::c_long,
|
||||
__sig: ::c_long,
|
||||
__opaque: [u8; __PTHREAD_RWLOCK_SIZE__],
|
||||
}
|
||||
|
||||
pub struct siginfo_t {
|
||||
pub _signo: ::c_int,
|
||||
pub _errno: ::c_int,
|
||||
pub _code: ::c_int,
|
||||
pub _pid: ::pid_t,
|
||||
pub _uid: ::uid_t,
|
||||
pub _status: ::c_int,
|
||||
pub si_addr: *mut ::c_void
|
||||
pub si_signo: ::c_int,
|
||||
pub si_errno: ::c_int,
|
||||
pub si_code: ::c_int,
|
||||
pub si_pid: ::pid_t,
|
||||
pub si_uid: ::uid_t,
|
||||
pub si_status: ::c_int,
|
||||
pub si_addr: *mut ::c_void,
|
||||
_pad: [usize; 9],
|
||||
}
|
||||
|
||||
pub struct sigaction {
|
||||
|
@ -639,19 +640,19 @@ pub const _SC_PASS_MAX: c_int = 131;
|
|||
|
||||
|
||||
pub const PTHREAD_MUTEX_RECURSIVE: ::c_int = 2;
|
||||
pub const _PTHREAD_MUTEX_SIG_INIT: ::c_long = 0x32AAABA7;
|
||||
pub const _PTHREAD_COND_SIG_INIT: ::c_long = 0x3CB0B1BB;
|
||||
pub const _PTHREAD_RWLOCK_SIG_INIT: ::c_long = 0x2DA8B3B4;
|
||||
pub const _PTHREAD_MUTEX_SIG_init: ::c_long = 0x32AAABA7;
|
||||
pub const _PTHREAD_COND_SIG_init: ::c_long = 0x3CB0B1BB;
|
||||
pub const _PTHREAD_RWLOCK_SIG_init: ::c_long = 0x2DA8B3B4;
|
||||
pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t = pthread_mutex_t {
|
||||
__sig: _PTHREAD_MUTEX_SIG_INIT,
|
||||
__sig: _PTHREAD_MUTEX_SIG_init,
|
||||
__opaque: [0; __PTHREAD_MUTEX_SIZE__],
|
||||
};
|
||||
pub const PTHREAD_COND_INITIALIZER: pthread_cond_t = pthread_cond_t {
|
||||
__sig: _PTHREAD_COND_SIG_INIT,
|
||||
__sig: _PTHREAD_COND_SIG_init,
|
||||
__opaque: [0; __PTHREAD_COND_SIZE__],
|
||||
};
|
||||
pub const PTHREAD_RWLOCK_INITIALIZER: pthread_rwlock_t = pthread_rwlock_t {
|
||||
__sig: _PTHREAD_RWLOCK_SIG_INIT,
|
||||
__sig: _PTHREAD_RWLOCK_SIG_init,
|
||||
__opaque: [0; __PTHREAD_RWLOCK_SIZE__],
|
||||
};
|
||||
|
||||
|
@ -660,7 +661,7 @@ extern {
|
|||
bufsize: *mut ::uint32_t) -> ::c_int;
|
||||
pub fn _NSGetArgc() -> *mut c_int;
|
||||
pub fn _NSGetArgv() -> *mut *mut *mut c_char;
|
||||
pub fn _NSGetEnviron() -> *mut *const *const c_char;
|
||||
pub fn _NSGetEnviron() -> *mut *mut *mut c_char;
|
||||
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
|
||||
link_name = "mprotect$UNIX2003")]
|
||||
pub fn mprotect(addr: *mut ::c_void, len: ::size_t, prot: ::c_int)
|
||||
|
@ -679,14 +680,12 @@ extern {
|
|||
newp: *mut ::c_void,
|
||||
newlen: ::size_t)
|
||||
-> ::c_int;
|
||||
pub fn _tlv_atexit(dtor: unsafe extern fn(*mut u8),
|
||||
arg: *mut u8);
|
||||
pub fn mach_absolute_time() -> u64;
|
||||
pub fn mach_timebase_info(info: *mut ::mach_timebase_info) -> ::c_int;
|
||||
pub fn pthread_setname_np(name: *const ::c_char) -> ::c_int;
|
||||
pub fn pthread_get_stackaddr_np(thread: pthread_t) -> *mut ::c_void;
|
||||
pub fn pthread_get_stacksize_np(thread: pthread_t) -> ::size_t;
|
||||
pub fn __error() -> *const ::c_int;
|
||||
pub fn __error() -> *mut ::c_int;
|
||||
}
|
||||
|
||||
cfg_if! {
|
||||
|
|
|
@ -41,7 +41,7 @@ s! {
|
|||
pub pw_expire: ::time_t,
|
||||
}
|
||||
|
||||
pub struct sigaltstack {
|
||||
pub struct stack_t {
|
||||
pub ss_sp: *mut ::c_void,
|
||||
pub ss_size: ::size_t,
|
||||
pub ss_flags: ::c_int,
|
||||
|
@ -64,6 +64,8 @@ extern {
|
|||
mibp: *mut c_int,
|
||||
sizep: *mut size_t)
|
||||
-> c_int;
|
||||
pub fn setgroups(ngroups: ::c_int,
|
||||
ptr: *const ::gid_t) -> ::c_int;
|
||||
}
|
||||
|
||||
cfg_if! {
|
||||
|
|
|
@ -198,6 +198,8 @@ extern {
|
|||
pub fn getgroups(ngroups_max: c_int, groups: *mut gid_t)
|
||||
-> c_int;
|
||||
pub fn getlogin() -> *mut c_char;
|
||||
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
|
||||
link_name = "getopt$UNIX2003")]
|
||||
pub fn getopt(argc: c_int, argv: *const *mut c_char,
|
||||
optstr: *const c_char) -> c_int;
|
||||
pub fn getpgrp() -> pid_t;
|
||||
|
@ -300,7 +302,11 @@ extern {
|
|||
#[cfg_attr(target_os = "android", link_name = "bsd_signal")]
|
||||
pub fn signal(signum: c_int, handler: sighandler_t) -> sighandler_t;
|
||||
|
||||
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
|
||||
link_name = "getrlimit$UNIX2003")]
|
||||
pub fn getrlimit(resource: c_int, rlim: *mut rlimit) -> c_int;
|
||||
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
|
||||
link_name = "setrlimit$UNIX2003")]
|
||||
pub fn setrlimit(resource: c_int, rlim: *const rlimit) -> c_int;
|
||||
pub fn getrusage(resource: c_int, usage: *mut rusage) -> c_int;
|
||||
|
||||
|
@ -319,6 +325,8 @@ extern {
|
|||
attr: *const ::pthread_attr_t,
|
||||
f: extern fn(*mut ::c_void) -> *mut ::c_void,
|
||||
value: *mut ::c_void) -> ::c_int;
|
||||
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
|
||||
link_name = "pthread_join$UNIX2003")]
|
||||
pub fn pthread_join(native: ::pthread_t,
|
||||
value: *mut *mut ::c_void) -> ::c_int;
|
||||
pub fn pthread_attr_init(attr: *mut ::pthread_attr_t) -> ::c_int;
|
||||
|
@ -344,24 +352,44 @@ extern {
|
|||
pub fn pthread_mutex_unlock(lock: *mut pthread_mutex_t) -> ::c_int;
|
||||
|
||||
pub fn pthread_mutexattr_init(attr: *mut pthread_mutexattr_t) -> ::c_int;
|
||||
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
|
||||
link_name = "pthread_mutexattr_destroy$UNIX2003")]
|
||||
pub fn pthread_mutexattr_destroy(attr: *mut pthread_mutexattr_t) -> ::c_int;
|
||||
pub fn pthread_mutexattr_settype(attr: *mut pthread_mutexattr_t,
|
||||
_type: ::c_int) -> ::c_int;
|
||||
|
||||
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
|
||||
link_name = "pthread_cond_wait$UNIX2003")]
|
||||
pub fn pthread_cond_wait(cond: *mut pthread_cond_t,
|
||||
lock: *mut pthread_mutex_t) -> ::c_int;
|
||||
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
|
||||
link_name = "pthread_cond_timedwait$UNIX2003")]
|
||||
pub fn pthread_cond_timedwait(cond: *mut pthread_cond_t,
|
||||
lock: *mut pthread_mutex_t,
|
||||
abstime: *const ::timespec) -> ::c_int;
|
||||
pub fn pthread_cond_signal(cond: *mut pthread_cond_t) -> ::c_int;
|
||||
pub fn pthread_cond_broadcast(cond: *mut pthread_cond_t) -> ::c_int;
|
||||
pub fn pthread_cond_destroy(cond: *mut pthread_cond_t) -> ::c_int;
|
||||
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
|
||||
link_name = "pthread_rwlock_destroy$UNIX2003")]
|
||||
pub fn pthread_rwlock_destroy(lock: *mut pthread_rwlock_t) -> ::c_int;
|
||||
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
|
||||
link_name = "pthread_rwlock_rdlock$UNIX2003")]
|
||||
pub fn pthread_rwlock_rdlock(lock: *mut pthread_rwlock_t) -> ::c_int;
|
||||
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
|
||||
link_name = "pthread_rwlock_tryrdlock$UNIX2003")]
|
||||
pub fn pthread_rwlock_tryrdlock(lock: *mut pthread_rwlock_t) -> ::c_int;
|
||||
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
|
||||
link_name = "pthread_rwlock_wrlock$UNIX2003")]
|
||||
pub fn pthread_rwlock_wrlock(lock: *mut pthread_rwlock_t) -> ::c_int;
|
||||
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
|
||||
link_name = "pthread_rwlock_trywrlock$UNIX2003")]
|
||||
pub fn pthread_rwlock_trywrlock(lock: *mut pthread_rwlock_t) -> ::c_int;
|
||||
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
|
||||
link_name = "pthread_rwlock_unlock$UNIX2003")]
|
||||
pub fn pthread_rwlock_unlock(lock: *mut pthread_rwlock_t) -> ::c_int;
|
||||
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
|
||||
link_name = "pthread_sigmask$UNIX2003")]
|
||||
pub fn pthread_sigmask(how: ::c_int, set: *const sigset_t,
|
||||
oldset: *mut sigset_t) -> ::c_int;
|
||||
|
||||
|
@ -378,14 +406,14 @@ extern {
|
|||
pub fn sigaction(signum: ::c_int,
|
||||
act: *const sigaction,
|
||||
oldact: *mut sigaction) -> ::c_int;
|
||||
pub fn sigaltstack(ss: *const sigaltstack,
|
||||
oss: *mut sigaltstack) -> ::c_int;
|
||||
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
|
||||
link_name = "sigaltstack$UNIX2003")]
|
||||
pub fn sigaltstack(ss: *const stack_t,
|
||||
oss: *mut stack_t) -> ::c_int;
|
||||
|
||||
pub fn utimes(filename: *const ::c_char,
|
||||
times: *const ::timeval) -> ::c_int;
|
||||
pub fn gai_strerror(errcode: ::c_int) -> *const ::c_char;
|
||||
pub fn setgroups(ngroups: ::size_t,
|
||||
ptr: *const ::gid_t) -> ::c_int;
|
||||
pub fn dlopen(filename: *const ::c_char,
|
||||
flag: ::c_int) -> *mut ::c_void;
|
||||
pub fn dlerror() -> *mut ::c_char;
|
||||
|
@ -399,6 +427,7 @@ extern {
|
|||
extern {
|
||||
pub fn getifaddrs(ifap: *mut *mut ifaddrs) -> c_int;
|
||||
pub fn freeifaddrs(ifa: *mut ifaddrs);
|
||||
#[cfg_attr(target_os = "macos", link_name = "glob$INODE64")]
|
||||
pub fn glob(pattern: *const c_char,
|
||||
flags: c_int,
|
||||
errfunc: ::dox::Option<extern "C" fn(epath: *const c_char,
|
||||
|
|
|
@ -80,7 +80,7 @@ s! {
|
|||
pub pw_shell: *mut ::c_char,
|
||||
}
|
||||
|
||||
pub struct sigaltstack {
|
||||
pub struct stack_t {
|
||||
pub ss_sp: *mut ::c_void,
|
||||
pub ss_flags: ::c_int,
|
||||
pub ss_size: ::size_t
|
||||
|
|
|
@ -53,7 +53,7 @@ s! {
|
|||
_resv: [::c_int; 1],
|
||||
}
|
||||
|
||||
pub struct sigaltstack {
|
||||
pub struct stack_t {
|
||||
pub ss_sp: *mut ::c_void,
|
||||
pub ss_size: ::size_t,
|
||||
pub ss_flags: ::c_int,
|
||||
|
|
|
@ -6,7 +6,7 @@ s! {
|
|||
_restorer: *mut ::c_void,
|
||||
}
|
||||
|
||||
pub struct sigaltstack {
|
||||
pub struct stack_t {
|
||||
pub ss_sp: *mut ::c_void,
|
||||
pub ss_flags: ::c_int,
|
||||
pub ss_size: ::size_t
|
||||
|
|
|
@ -318,6 +318,9 @@ extern {
|
|||
pub fn pthread_attr_getstack(attr: *const ::pthread_attr_t,
|
||||
stackaddr: *mut *mut ::c_void,
|
||||
stacksize: *mut ::size_t) -> ::c_int;
|
||||
pub fn memalign(align: ::size_t, size: ::size_t) -> *mut ::c_void;
|
||||
pub fn setgroups(ngroups: ::size_t,
|
||||
ptr: *const ::gid_t) -> ::c_int;
|
||||
}
|
||||
|
||||
cfg_if! {
|
||||
|
|
Loading…
Reference in New Issue