diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 74f49f3e7bb0..0cdfaeadf905 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -89,7 +89,7 @@ standard, it's just a list shared among all OSs that declare `#[cfg(unix)]`. We have two automated tests running on [GitHub Actions](https://github.com/rust-lang/libc/actions): -1. [`libc-test`](https://github.com/gnzlbg/ctest) +1. `libc-test` - `cd libc-test && cargo test` - Use the `skip_*()` functions in `build.rs` if you really need a workaround. 2. Style checker diff --git a/build.rs b/build.rs index dab64847b2b6..d6a941611ed2 100644 --- a/build.rs +++ b/build.rs @@ -20,7 +20,6 @@ const ALLOWED_CFGS: &[&str] = &[ // FIXME(ctest): this config shouldn't be needed but ctest can't parse `const extern fn` "libc_const_extern_fn", "libc_deny_warnings", - "libc_ctest", // Corresponds to `__USE_TIME_BITS64` in UAPI "linux_time_bits64", "musl_v1_2_3", diff --git a/ci/run.sh b/ci/run.sh index c396d720cb65..5ccd6d74160b 100755 --- a/ci/run.sh +++ b/ci/run.sh @@ -23,7 +23,7 @@ case "$target" in esac case "$target" in - # garando_errors only compiles on `cfg(any(unix, windows))` + # crash in std::env::tmp_dir (no filesystem on wasm). *wasm*) cmd="$cmd --exclude ctest --exclude ctest-test --exclude ctest-next" ;; # https://github.com/bytecodealliance/rustix/issues/1496 *loongarch*) cmd="$cmd --exclude ctest --exclude ctest-test --exclude ctest-next" ;; diff --git a/libc-test/build.rs b/libc-test/build.rs index 3146ce669b84..6d2a1da0c248 100644 --- a/libc-test/build.rs +++ b/libc-test/build.rs @@ -1694,11 +1694,6 @@ fn test_wasi(target: &str) { "wchar.h", } - // Currently `ctest` doesn't support macros-in-static-expressions and will - // panic on them. That affects `CLOCK_*` defines in wasi to set this here - // to omit them. - cfg.cfg("libc_ctest", None); - cfg.rename_struct_ty(move |ty| match ty { "FILE" | "fd_set" | "DIR" => Some(ty.to_string()), t if t.ends_with("_t") => Some(t.to_string()), diff --git a/src/primitives.rs b/src/primitives.rs index 630b03a91123..57c218a654d5 100644 --- a/src/primitives.rs +++ b/src/primitives.rs @@ -20,14 +20,7 @@ pub type c_double = f64; cfg_if! { if #[cfg(all( not(windows), - // FIXME(ctest): just use `target_vendor` = "apple"` once `ctest` supports it - not(any( - target_os = "macos", - target_os = "ios", - target_os = "tvos", - target_os = "watchos", - target_os = "visionos", - )), + not(target_vendor = "apple"), not(target_os = "vita"), any( target_arch = "aarch64", @@ -91,13 +84,7 @@ pub type uint64_t = u64; cfg_if! { if #[cfg(all( target_arch = "aarch64", - not(any( - target_os = "windows", - target_os = "macos", - target_os = "ios", - target_os = "tvos", - target_os = "watchos" - )) + not(any(target_os = "windows", target_vendor = "apple")) ))] { /// C `__int128` (a GCC extension that's part of many ABIs) pub type __int128 = i128; @@ -107,15 +94,7 @@ cfg_if! { pub type __int128_t = i128; /// C __uint128_t (alternate name for [__uint128][]) pub type __uint128_t = u128; - } else if #[cfg(all( - target_arch = "aarch64", - any( - target_os = "macos", - target_os = "ios", - target_os = "tvos", - target_os = "watchos" - ) - ))] { + } else if #[cfg(all(target_arch = "aarch64", target_vendor = "apple"))] { /// C `__int128_t` pub type __int128_t = i128; /// C `__uint128_t` diff --git a/src/unix/linux_like/linux/musl/mod.rs b/src/unix/linux_like/linux/musl/mod.rs index 0505e56aa0d1..80d8003e2172 100644 --- a/src/unix/linux_like/linux/musl/mod.rs +++ b/src/unix/linux_like/linux/musl/mod.rs @@ -422,11 +422,7 @@ s_no_extra_traits! { pub aio_offset: off_t, __next: *mut c_void, __prev: *mut c_void, - // FIXME(ctest): length should be `32 - 2 * size_of::<*const ()>()` - #[cfg(target_pointer_width = "32")] - __dummy4: [c_char; 24], - #[cfg(target_pointer_width = "64")] - __dummy4: [c_char; 16], + __dummy4: [c_char; 32 - 2 * size_of::<*const ()>()], } pub struct sysinfo { diff --git a/src/wasi/mod.rs b/src/wasi/mod.rs index 4700ca54a05d..64459c2095c9 100644 --- a/src/wasi/mod.rs +++ b/src/wasi/mod.rs @@ -361,26 +361,17 @@ pub const _SC_PAGE_SIZE: c_int = _SC_PAGESIZE; pub const _SC_IOV_MAX: c_int = 60; pub const _SC_SYMLOOP_MAX: c_int = 173; -cfg_if! { - if #[cfg(libc_ctest)] { - // skip these constants when this is active because `ctest` currently - // panics on parsing the constants below - } else { - // unsafe code here is required in the stable, but not in nightly - #[allow(unused_unsafe)] - pub static CLOCK_MONOTONIC: clockid_t = - unsafe { clockid_t(core::ptr::addr_of!(_CLOCK_MONOTONIC)) }; - #[allow(unused_unsafe)] - pub static CLOCK_PROCESS_CPUTIME_ID: clockid_t = - unsafe { clockid_t(core::ptr::addr_of!(_CLOCK_PROCESS_CPUTIME_ID)) }; - #[allow(unused_unsafe)] - pub static CLOCK_REALTIME: clockid_t = - unsafe { clockid_t(core::ptr::addr_of!(_CLOCK_REALTIME)) }; - #[allow(unused_unsafe)] - pub static CLOCK_THREAD_CPUTIME_ID: clockid_t = - unsafe { clockid_t(core::ptr::addr_of!(_CLOCK_THREAD_CPUTIME_ID)) }; - } -} +// unsafe code here is required in the stable, but not in nightly +#[allow(unused_unsafe)] +pub static CLOCK_MONOTONIC: clockid_t = unsafe { clockid_t(core::ptr::addr_of!(_CLOCK_MONOTONIC)) }; +#[allow(unused_unsafe)] +pub static CLOCK_PROCESS_CPUTIME_ID: clockid_t = + unsafe { clockid_t(core::ptr::addr_of!(_CLOCK_PROCESS_CPUTIME_ID)) }; +#[allow(unused_unsafe)] +pub static CLOCK_REALTIME: clockid_t = unsafe { clockid_t(core::ptr::addr_of!(_CLOCK_REALTIME)) }; +#[allow(unused_unsafe)] +pub static CLOCK_THREAD_CPUTIME_ID: clockid_t = + unsafe { clockid_t(core::ptr::addr_of!(_CLOCK_THREAD_CPUTIME_ID)) }; pub const ABDAY_1: crate::nl_item = 0x20000; pub const ABDAY_2: crate::nl_item = 0x20001;